2008-11-20 Evi Vanoost <vanooste@rcbi.rochester.edu>

* operation/snmpconsole/snmp_view.php, godmode/snmpconsole/snmp_view.php:
	Added legend to satisfy feature request #2204169. Also made filters 
	persistent
	
	* operation/events/events.php: Usage of new function
	
	* operation/agentes/ver_agente.php,
	operation/agentes/estado_monitores.php: A bit of style update
	Fixed bug where $intervalo actually came from index.php
	
	* index.php: Put refresh in config (to prevent above bug)
	
	* include/styles/pandora_width.css, include/styles/pandora_red.css,
	include/styles/pandora_black.css, include/styles/pandora.css:
	Update so you can use datos_<color> in other things than td
	
	* include/functions_db.php: give_agentinterval is now get_agent_interval
	
	* include/functions.php: Added get_priority_class to find background 
	color classes		


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1253 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
guruevi 2008-11-20 21:26:59 +00:00
parent 7c5f35f70e
commit 82a084a873
14 changed files with 267 additions and 272 deletions

View File

@ -1,3 +1,26 @@
2008-11-20 Evi Vanoost <vanooste@rcbi.rochester.edu>
* operation/snmpconsole/snmp_view.php, godmode/snmpconsole/snmp_view.php:
Added legend to satisfy feature request #2204169. Also made filters
persistent
* operation/events/events.php: Usage of new function
* operation/agentes/ver_agente.php,
operation/agentes/estado_monitores.php: A bit of style update
Fixed bug where $intervalo actually came from index.php
* index.php: Put refresh in config (to prevent above bug)
* include/styles/pandora_width.css, include/styles/pandora_red.css,
include/styles/pandora_black.css, include/styles/pandora.css:
Update so you can use datos_<color> in other things than td
* include/functions_db.php: give_agentinterval is now get_agent_interval
* include/functions.php: Added get_priority_class to find background
color classes
2008-11-20 Jorge Gonzalez <jorgegonz@artica.es>
* pandoradb_data.sql: Corrected mistake for languages Slovak and

View File

@ -331,25 +331,8 @@ if (isset ($_GET["update_alert"])) {
<img src="images/config.png" border="0" alt="'.__('Update').'"></a>';
$idx = count ($table->data); //The current index of the table is 1 less than the count of table data so we count before adding to table->data
array_push ($table->data, $data);
switch ($row["priority"]) {
case 0:
$table->rowclass[$idx] = "datos_blue";
break;
case 1:
$table->rowclass[$idx] = "datos_grey";
break;
case 2:
$table->rowclass[$idx] = "datos_green";
break;
case 3:
$table->rowclass[$idx] = "datos_yellow";
break;
case 4:
$table->rowclass[$idx] = "datos_red";
break;
default:
$table->rowclass[$idx] = "datos_grey";
}
$table->rowclass[$idx] = get_priority_class ($row["priority"]);
}
if (!empty ($table->data)) {
@ -362,7 +345,14 @@ if (isset ($_GET["update_alert"])) {
echo '<form name="agente" method="post" action="index.php?sec=gsnmpconsole&sec2=godmode/snmpconsole/snmp_alert&update_alert=-1">';
print_submit_button (__('Create'), "add_alert", false, 'class="sub next"');
echo "</form></div>";
echo '<div style="margin-left: 30px; line-height: 17px; vertical-align: top; width:120px;">';
echo '<h3>'.__('Legend').'</h3>';
foreach (get_priorities () as $num => $name) {
echo '<span class="'.get_priority_class ($num).'">'.$name.'</span>';
echo '<br />';
}
echo '</div>';
}
?>
<script type="text/javascript" src="include/javascript/jquery.js"></script>

View File

@ -1202,8 +1202,6 @@ function get_priorities () {
* @return priority string.
*/
function get_priority_name ($priority) {
global $config;
switch ($priority) {
case 0:
return __('Maintenance');
@ -1215,11 +1213,36 @@ function get_priority_name ($priority) {
return __('Warning');
case 4:
return __('Critical');
case -1:
default:
return __('All');
}
}
/**
* Get priority class (CSS class) from priority value.
*
* @param priority value (integer) as stored eg. in database.
*
* @return priority class.
*/
function get_priority_class ($priority) {
switch ($priority) {
case 0:
return "datos_blue";
case 1:
return "datos_grey";
case 2:
return "datos_green";
case 3:
return "datos_yellow";
case 4:
return "datos_red";
default:
return "datos_grey";
}
}
/**
* Avoid magic_quotes protection
* Deprecated by get_parameter functions and safe_input funcitons

View File

@ -1071,11 +1071,11 @@ function event_insert ($event, $id_group, $id_agent, $status = 0,
*/
function get_module_interval ($id_agent_module) {
$interval = (int) get_db_value ('module_interval', 'tagente_modulo', 'id_agente_modulo', $id_agent_module);
if ($interval)
if ($interval > 0)
return $interval;
$id_agent = get_db_value ('id_agente', 'tagente_modulo', 'id_agente_modulo', (int) $id_agent_module);
return (int) give_agentinterval ($id_agent);
$id_agent = give_agent_id_from_module_id ($id_agent_module);
return (int) get_agent_interval ($id_agent);
}
/**
@ -1085,7 +1085,7 @@ function get_module_interval ($id_agent_module) {
*
* @return The interval value of a given agent
*/
function give_agentinterval ($id_agent) {
function get_agent_interval ($id_agent) {
return (int) get_db_value ('intervalo', 'tagente', 'id_agente', $id_agent);
}
@ -2144,26 +2144,7 @@ function smal_event_table ($filter = "", $limit = 10, $width = 440) {
}
/* Only incident read access to view data ! */
switch ($event["criticity"]) {
case 0:
$tdclass = "datos_blue";
break;
case 1:
$tdclass = "datos_grey";
break;
case 2:
$tdclass = "datos_green";
break;
case 3:
$tdclass = "datos_yellow";
break;
case 4:
$tdclass = "datos_red";
break;
default:
$tdclass = "datos_grey";
}
$tdclass = get_priority_class ($event["criticity"]);
$criticity_label = get_priority_name ($event["criticity"]);
/* Colored box */
echo "<tr><td class='$tdclass' title='$criticity_label' align='center'>";

View File

@ -639,34 +639,35 @@ span#logo_text2 {
width: 180px;
}
td.datos_green, td.datos_greenf9 {
/* classes for event priorities. Sits now in functions.php */
.datos_green, .datos_greenf9 {
background-color: #BBFFA4;
padding: 5px 5px 5px 5px;
}
td.datos_red, td.datos_redf9 {
.datos_red, .datos_redf9 {
background-color: #FFC0B5;
padding: 5px 5px 5px 5px;
}
td.datos_yellow, td.datos_yellowf9 {
.datos_yellow, .datos_yellowf9 {
background-color: #F4FFBF;
padding: 5px 5px 5px 5px;
}
td.datos_blue, td.datos_bluef9 {
.datos_blue, .datos_bluef9 {
background-color: #CDE2EA;
padding: 5px 5px 5px 5px;
}
td.datos_grey, td.datos_greyf9 {
.datos_grey, .datos_greyf9 {
background-color: #E4E4E4;
padding: 5px 5px 5px 5px;
}
.datos_greyf9, .datos_bluef9, .datos_greenf9, .datos_redf9, .datos_yellowf9 {
font-size: 6.5pt;
}
td.datos_greyf9, td.datos_bluef9, td.datos_greenf9, td.datos_redf9, td.datos_yellowf9 {
font-size: 6.5pt;
padding: 5px 5px 5px 5px;
}
/* end of classes for event priorities */
div#main_pure {
background-color: #fefefe;

View File

@ -635,34 +635,35 @@ span#logo_text2 {
width: 180px;
}
td.datos_green, td.datos_greenf9 {
background-color: #004807;
padding: 5px 5px 5px 5px;
/* classes for event priorities. Sits now in functions.php */
.datos_green, .datos_greenf9 {
background-color: #BBFFA4;
}
td.datos_red, td.datos_redf9 {
background-color: #652000;
padding: 5px 5px 5px 5px;
.datos_red, .datos_redf9 {
background-color: #FFC0B5;
}
td.datos_yellow, td.datos_yellowf9 {
background-color: #575A00;
padding: 5px 5px 5px 5px;
.datos_yellow, .datos_yellowf9 {
background-color: #F4FFBF;
}
td.datos_blue, td.datos_bluef9 {
background-color: #003B5A;
padding: 5px 5px 5px 5px;
.datos_blue, .datos_bluef9 {
background-color: #CDE2EA;
}
td.datos_grey, td.datos_greyf9 {
background-color: #303030;
padding: 5px 5px 5px 5px;
.datos_grey, .datos_greyf9 {
background-color: #E4E4E4;
}
.datos_greyf9, .datos_bluef9, .datos_greenf9, .datos_redf9, .datos_yellowf9 {
font-size: 6.5pt;
}
td.datos_greyf9, td.datos_bluef9, td.datos_greenf9, td.datos_redf9, td.datos_yellowf9 {
font-size: 6.5pt;
padding: 5px 5px 5px 5px;
}
/* end of classes for event priorities */
div#main_pure {
background-color: #000;

View File

@ -659,34 +659,35 @@ span#logo_text2 {
width: 180px;
}
td.datos_green, td.datos_greenf9 {
background-color: #C7EAD5;
padding: 5px 5px 5px 5px;
/* classes for event priorities. Sits now in functions.php */
.datos_green, .datos_greenf9 {
background-color: #BBFFA4;
}
td.datos_red, td.datos_redf9 {
background-color: #FFC0B5;
padding: 5px 5px 5px 5px;
.datos_red, .datos_redf9 {
background-color: #FFC0B5;
}
td.datos_yellow, td.datos_yellowf9 {
background-color: #F4FFBF;
padding: 5px 5px 5px 5px;
.datos_yellow, .datos_yellowf9 {
background-color: #F4FFBF;
}
td.datos_blue, td.datos_bluef9 {
background-color: #CDE2EA;
padding: 5px 5px 5px 5px;
.datos_blue, .datos_bluef9 {
background-color: #CDE2EA;
}
td.datos_grey, td.datos_greyf9 {
background-color: #DCDCDC;
padding: 5px 5px 5px 5px;
.datos_grey, .datos_greyf9 {
background-color: #E4E4E4;
}
.datos_greyf9, .datos_bluef9, .datos_greenf9, .datos_redf9, .datos_yellowf9 {
font-size: 6.5pt;
}
td.datos_greyf9, td.datos_bluef9, td.datos_greenf9, td.datos_redf9, td.datos_yellowf9 {
font-size: 6.5pt;
padding: 5px 5px 5px 5px;
}
/* end of classes for event priorities */
div#main_pure {
background-color: #fefefe;

View File

@ -645,34 +645,35 @@ span#logo_text2 {
width: 180px;
}
td.datos_green, td.datos_greenf9 {
background-color: #C7EAD5;
padding: 5px 5px 5px 5px;
/* classes for event priorities. Sits now in functions.php */
.datos_green, .datos_greenf9 {
background-color: #BBFFA4;
}
td.datos_red, td.datos_redf9 {
.datos_red, .datos_redf9 {
background-color: #FFC0B5;
padding: 5px 5px 5px 5px;
}
td.datos_yellow, td.datos_yellowf9 {
.datos_yellow, .datos_yellowf9 {
background-color: #F4FFBF;
padding: 5px 5px 5px 5px;
}
td.datos_blue, td.datos_bluef9 {
.datos_blue, .datos_bluef9 {
background-color: #CDE2EA;
padding: 5px 5px 5px 5px;
}
td.datos_grey, td.datos_greyf9 {
background-color: #DCDCDC;
padding: 5px 5px 5px 5px;
.datos_grey, .datos_greyf9 {
background-color: #E4E4E4;
}
.datos_greyf9, .datos_bluef9, .datos_greenf9, .datos_redf9, .datos_yellowf9 {
font-size: 6.5pt;
}
td.datos_greyf9, td.datos_bluef9, td.datos_greenf9, td.datos_redf9, td.datos_yellowf9 {
font-size: 6.5pt;
padding: 5px 5px 5px 5px;
}
/* end of classes for event priorities */
div#main_pure {
background-color: #fefefe;

View File

@ -77,8 +77,8 @@ echo '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head
$config["pure"] = get_parameter ("pure", 0);
// Auto Refresh page
$intervalo = get_parameter ("refr", 0);
if ($intervalo > 0) {
$config["refr"] = get_parameter ("refr", 0);
if ($config["refr"] > 0) {
// Agent selection filters and refresh
$query = 'http' . (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == TRUE ? 's': '') . '://' . $_SERVER['SERVER_NAME'];
if ($_SERVER['SERVER_PORT'] != 80 && (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == TRUE && $_SERVER['SERVER_PORT'] != 443))
@ -102,7 +102,7 @@ if ($intervalo > 0) {
$query .= ":" . $_SERVER['SERVER_PORT'];
$query .= $_SERVER['REQUEST_URI'] . '&ag_group_refresh=' . $ag_group;
} else {
echo '<meta http-equiv="refresh" content="' . $intervalo . '; URL=' . $query . '">';
echo '<meta http-equiv="refresh" content="' . $config["refr"] . '; URL=' . $query . '">';
}
}

View File

@ -72,7 +72,7 @@ echo '<td class="datos" colspan="2"><img src="images/'.dame_so_icon ($agent["id_
// Parent
echo '<tr><td class="datos2"><b>'.__('Parent').'</b></td>';
echo '<td class="datos2" colspan="2"><a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent["id_parent"].'">'.dame_nombre_agente ($agent["id_parent"]).'</a></td></tr>';
echo '<td class="datos2" colspan="2"><a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent["id_parent"].'">'.get_agent_name ($agent["id_parent"]).'</a></td></tr>';
// Agent Interval
echo '<tr><td class="datos"><b>'.__('Interval').'</b></td>';

View File

@ -16,111 +16,113 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Load globar vars
require("include/config.php");
check_login();
require_once ("include/config.php");
// $id_agente can be obtained as global variable or GET param.
if (isset($_GET["id_agente"])){
$id_agente = $_GET["id_agente"];
}
// Get all module from agent
$sql_t='SELECT * FROM tagente_estado, tagente_modulo WHERE tagente_modulo.disabled = 0 AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente='.$id_agente.' AND tagente_estado.estado != 100 AND tagente_estado.utimestamp != 0 ORDER BY tagente_modulo.nombre';
$result_t=mysql_query($sql_t);
if (mysql_num_rows ($result_t)) {
echo "<h3>".__('Full list of Monitors')."</h3>";
echo "<table width='750' cellpadding=4 cellspacing=4 class='databox'>";
echo "<tr><th>X</th>";
echo "<th>".__('Type')."</th>
<th>".__('Module name')."</th>
<th>".__('Description')."</th>
<th>".__('Status')."</th>
<th>".__('Interval')."</th>
<th>".__('Last contact')."</th>";
$color=0;
while ($row_t=mysql_fetch_array($result_t)){
# For evey module in the status table
$est_modulo = substr($row_t["nombre"],0,25);
$est_tipo = dame_nombre_tipo_modulo($row_t["id_tipo_modulo"]);
$est_description = $row_t["descripcion"];
$est_timestamp = $row_t["timestamp"];
$est_estado = $row_t["estado"];
$est_datos = $row_t["datos"];
$est_cambio = $row_t["cambio"];
if (!isset ($id_agente)) {
//This page is included, $id_agente should be passed to it.
audit_db ($config['id_user'], $config['remote_addr'], "HACK Attempt",
"Trying to get to monitor list without id_agent passed");
include ("general/noaccess.php");
exit;
}
// Get all module from agent
$sql_t='SELECT * FROM tagente_estado, tagente_modulo WHERE tagente_modulo.disabled = 0 AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente='.$id_agente.' AND tagente_estado.estado != 100 AND tagente_estado.utimestamp != 0 ORDER BY tagente_modulo.nombre';
$result_t=mysql_query($sql_t);
if (mysql_num_rows ($result_t)) {
echo "<h3>".__('Full list of Monitors')."</h3>";
echo "<table width='750' cellpadding=4 cellspacing=4 class='databox'>";
echo "<tr><th>X</th>";
echo "<th>".__('Type')."</th>
<th>".__('Module name')."</th>
<th>".__('Description')."</th>
<th>".__('Status')."</th>
<th>".__('Interval')."</th>
<th>".__('Last contact')."</th>";
$color=0;
while ($row_t=mysql_fetch_array($result_t)){
# For evey module in the status table
$est_modulo = substr($row_t["nombre"],0,25);
$est_tipo = dame_nombre_tipo_modulo($row_t["id_tipo_modulo"]);
$est_description = $row_t["descripcion"];
$est_timestamp = $row_t["timestamp"];
$est_estado = $row_t["estado"];
$est_datos = $row_t["datos"];
$est_cambio = $row_t["cambio"];
if ($row_t["module_interval"] > 0) {
$est_interval = $row_t["module_interval"];
if (($est_interval != $intervalo) && ($est_interval > 0)) {
$temp_interval = $est_interval;
} else {
$temp_interval = $intervalo;
}
if ($est_estado <>100){ # si no es un modulo de tipo datos
# Determinamos si se ha caido el agente (tiempo de intervalo * 2 superado)
if ($color == 1){
$tdcolor = "datos";
$color = 0;
}
else {
$tdcolor = "datos2";
$color = 1;
}
$seconds = time() - $row_t["utimestamp"];
if ($seconds >= ($temp_interval*2)) // If every interval x 2 secs. we get nothing, there's and alert
$agent_down = 1;
else
$agent_down = 0;
echo "<tr><td class='".$tdcolor."'>";
if (($row_t["id_modulo"] != 1) AND ($row_t["id_tipo_modulo"] < 100)) {
if ($row_t["flag"] == 0){
echo "<a href='index.php?sec=estado& sec2=operation/agentes/ver_agente& id_agente=".$id_agente."&id_agente_modulo=".$row_t["id_agente_modulo"]."&flag=1& tab=main&refr=60'><img src='images/target.png' border='0'></a>";
} else {
echo "<a href='index.php?sec=estado& sec2=operation/agentes/ver_agente&id_agente=".$id_agente."&id_agente_modulo=".$row_t["id_agente_modulo"]."&tab=main&refr=60'><img src='images/refresh.png' border='0'></a>";
}
}
echo "<td class='".$tdcolor."'>";
echo "<img src='images/".show_icon_type($row_t["id_tipo_modulo"])."' border=0>";
echo "<td class='".$tdcolor."'>".$est_modulo."</td>";
echo "<td class='".$tdcolor."f9'>";
echo substr($est_description,0,35);
echo "<td class='".$tdcolor."' align='center'>";
if ($est_estado == 1){
if ($est_cambio == 1)
echo "<img src='images/pixel_yellow.png' width=40 height=18 title='".__('Change between Green/Red state')."'>";
else
echo "<img src='images/pixel_red.png' width=40 height=18 title='".__('At least one monitor fails')."'>";
} else
echo "<img src='images/pixel_green.png' width=40 height=18 title='".__('All Monitors OK')."'>";
echo "<td align='center' class='".$tdcolor."'>";
if ($temp_interval != $intervalo)
echo $temp_interval."</td>";
else
echo "--";
echo "<td class='".$tdcolor."f9'>";
if ($agent_down == 1) { // If agent down, it's shown red and bold
echo "<span class='redb'>";
}
else {
echo "<span>";
}
if ($row_t["timestamp"]=='0000-00-00 00:00:00') {
echo __('Never');
} else {
echo human_time_comparation($row_t["timestamp"]);
}
echo "</span></td>";
}
} else {
$est_interval = get_module_interval ($row_t["module_interval"]); //This function will return the correct interval
}
echo '</table>';
if ($est_estado <>100){ # si no es un modulo de tipo datos
# Determinamos si se ha caido el agente (tiempo de intervalo * 2 superado)
if ($color == 1){
$tdcolor = "datos";
$color = 0;
}
else {
$tdcolor = "datos2";
$color = 1;
}
$seconds = time() - $row_t["utimestamp"];
if ($seconds >= ($est_interval*2)) // If every interval x 2 secs. we get nothing, there's and alert
$agent_down = 1;
else
$agent_down = 0;
} else {
echo "<div class='nf'>".__('This agent doesn \'t have any monitor with data')."</div>";
echo "<tr><td class='".$tdcolor."'>";
if (($row_t["id_modulo"] != 1) AND ($row_t["id_tipo_modulo"] < 100)) {
if ($row_t["flag"] == 0){
echo "<a href='index.php?sec=estado& sec2=operation/agentes/ver_agente& id_agente=".$id_agente."&id_agente_modulo=".$row_t["id_agente_modulo"]."&flag=1& tab=main&refr=60'><img src='images/target.png' border='0'></a>";
} else {
echo "<a href='index.php?sec=estado& sec2=operation/agentes/ver_agente&id_agente=".$id_agente."&id_agente_modulo=".$row_t["id_agente_modulo"]."&tab=main&refr=60'><img src='images/refresh.png' border='0'></a>";
}
}
echo "<td class='".$tdcolor."'>";
echo "<img src='images/".show_icon_type($row_t["id_tipo_modulo"])."' border=0>";
echo "<td class='".$tdcolor."'>".$est_modulo."</td>";
echo "<td class='".$tdcolor."f9'>";
echo substr($est_description,0,35);
echo "<td class='".$tdcolor."' align='center'>";
if ($est_estado == 1){
if ($est_cambio == 1)
echo "<img src='images/pixel_yellow.png' width=40 height=18 title='".__('Change between Green/Red state')."'>";
else
echo "<img src='images/pixel_red.png' width=40 height=18 title='".__('At least one monitor fails')."'>";
} else
echo "<img src='images/pixel_green.png' width=40 height=18 title='".__('All Monitors OK')."'>";
echo "<td align='center' class='".$tdcolor."'>";
if ($est_interval > 0) {
echo $est_interval;
} else {
echo "--";
}
echo "</td><td class='".$tdcolor."f9'>";
if ($agent_down == 1) { // If agent down, it's shown red and bold
echo "<span class='redb'>";
}
else {
echo "<span>";
}
if ($row_t["timestamp"]=='0000-00-00 00:00:00') {
echo __('Never');
} else {
echo human_time_comparation($row_t["timestamp"]);
}
echo "</span></td>";
}
}
echo '</table>';
} else {
echo "<div class='nf'>".__('This agent doesn \'t have any monitor with data')."</div>";
}
?>

View File

@ -17,10 +17,10 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Load global vars
require("include/config.php");
enterprise_include('operation/agentes/ver_agente.php');
require_once ("include/config.php");
enterprise_include ('operation/agentes/ver_agente.php');
check_login();
check_login ();
if (defined ('AJAX')) {
$get_agent_json = (bool) get_parameter ('get_agent_json');
@ -129,6 +129,7 @@ $id_agente = (int) get_parameter ("id_agente");
if (! $id_agente) {
return;
}
// get group for this id_agente
$id_grupo = get_db_value ('id_grupo', 'tagente', 'id_agente', $id_agente);
if (! give_acl ($config['id_user'], $id_grupo, "AR")) {
@ -141,7 +142,7 @@ if (! give_acl ($config['id_user'], $id_grupo, "AR")) {
// Check for validate alert request
$validate_alert = get_parameter ("validate_alert");
if ($validate_alert != ""){
if (give_acl ($config['id_user'], $id_grupo, "AW")==1){
if (give_acl ($config['id_user'], $id_grupo, "AW") == 1) {
$alert_row = get_db_row ("talerta_agente_modulo", "id_aam", $validate_alert);
if ($alert_row["id_agente_modulo"] != 0){
$am_row = get_db_row ("tagente_modulo", "id_agente_modulo", $alert_row["id_agente_modulo"]);

View File

@ -266,25 +266,7 @@ foreach ($result as $row) {
$data = array ();
//First pass along the class of this row
switch ($row["criticity"]) {
case 0:
$table->rowclass[] = "datos_blue";
break;
case 1:
$table->rowclass[] = "datos_grey";
break;
case 2:
$table->rowclass[] = "datos_green";
break;
case 3:
$table->rowclass[] = "datos_yellow";
break;
case 4:
$table->rowclass[] = "datos_red";
break;
default:
$table->rowclass[] = "datos_grey";
}
$table->rowclass[] = get_priority_class ($row["criticity"]);
// Colored box
if ($row["estado"] == 0) {

View File

@ -36,8 +36,9 @@ $filter_oid = (string) get_parameter ("filter_oid", '');
$filter_severity = (int) get_parameter ("filter_severity", -1);
$filter_fired = (int) get_parameter ("filter_fired", -1);
$search_string = (string) get_parameter ("search_string", '');
$config["block_size"] = (int) get_parameter ("pagination", $config["block_size"]);
$pagination = (int) get_parameter ("pagination", $config["block_size"]);
$offset = (int) get_parameter ('offset',0);
$url = "index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&filter_agent=".$filter_agent."&filter_oid=".$filter_oid."&filter_severity=".$filter_severity."&filter_fired=".$filter_fired."&search_string=".$search_string."&pagination=".$pagination."&offset=".$offset;
// OPERATIONS
@ -97,10 +98,10 @@ if (isset ($_POST["updatebt"])) {
echo "<h2>Pandora SNMP &gt; " . __('SNMP console');
if ($config["pure"] == 1) {
echo "&nbsp;<a target='_top' href='index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&pure=0'><img src='images/monitor.png' title='".__('Normal screen')."'></a>";
echo '&nbsp;<a target="_top" href="'.$url.'&pure=1&refr=30"><img src="images/monitor.png" title="'.__('Normal screen').'" /></a>';
} else {
// Fullscreen
echo "&nbsp;<a target='_top' href='index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&refr=30&pure=1'><img src='images/monitor.png' title='".__('Full screen')."'></a>";
echo '&nbsp;<a target="_top" href="'.$url.'&pure=0&refr=0"><img src="images/monitor.png" title="'.__('Full screen').'" /></a>';
}
echo "</h2>";
@ -114,10 +115,9 @@ if (empty ($traps)) {
}
// Toggle filters
echo '<a href="#" onmousedown="toggleDiv(\'filters\');">';
echo "<b>".__('Toggle filters')." ".'<img src="images/wand.png" /></a></b>';
echo '<a href="#" onmousedown="toggleDiv(\'filters\');"><b>'.__('Toggle filters').'</b>&nbsp;<img src="images/wand.png" /></a>';
echo '<form method="POST" action="index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view">';
echo '<form method="POST" action="index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&refr='.$config["refr"].'&pure='.$config["pure"].'">';
$table->width = '90%';
$table->size = array ();
$table->size[0] = '120px';
@ -139,9 +139,9 @@ foreach ($traps as $trap) {
}
if ($config["pure"] == 1) {
echo "<div id='filters' style='display:none'>";
echo '<div id="filters" style="display:none;">';
} else {
echo "<div id='filters' style='display:block'>"; //There is no value all to property display
echo '<div id="filters" style="display:block;">'; //There is no value all to property display
}
// Agent select
@ -167,11 +167,11 @@ $lpagination[50]=50;
$lpagination[100]=100;
$lpagination[200]=200;
$lpagination[500]=500;
$table->data[2][1] = print_select ($lpagination, "pagination", $config["block_size"], 'javascript:this.form.submit();', __('Default'), $config["block_size"], true);
$table->data[2][1] = print_select ($lpagination, "pagination", $pagination, 'this.form.submit();', __('Default'), $config["block_size"], true);
// Severity select
$table->data[2][2] = '<strong>'.__('Severity').'</strong>';
$table->data[2][3] = print_select ($severities, 'filter_severity', $filter_severity, 'javascript:this.form.submit();', __('All'), -1, true);
$table->data[2][3] = print_select ($severities, 'filter_severity', $filter_severity, 'this.form.submit();', __('All'), -1, true);
print_table ($table);
unset ($table);
@ -183,9 +183,9 @@ echo '<br />';
// Prepare index for pagination
$trapcount = get_db_sql ("SELECT COUNT(*) FROM ttrap");
pagination ($trapcount, "index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view", $offset);
pagination ($trapcount, "index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&filter_agent=".$filter_agent."&filter_oid=".$filter_oid."&pagination=".$pagination."&offset=".$offset."&refr=".$config["refr"]."&pure=".$config["pure"], $offset, $pagination);
echo '<form name="eventtable" method="POST" action="index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&offset='.$offset.'">';
echo '<form name="eventtable" method="POST" action="index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&pagination='.$pagination.'&offset='.$offset.'">';
$table->cellpadding = 4;
$table->cellspacing = 4;
@ -338,25 +338,7 @@ foreach ($traps as $trap) {
}
// Severity
switch ($severity) {
case 0:
$table->rowclass[$idx] = "datos_blue";
break;
case 1:
$table->rowclass[$idx] = "datos_grey";
break;
case 2:
$table->rowclass[$idx] = "datos_green";
break;
case 3:
$table->rowclass[$idx] = "datos_yellow";
break;
case 4:
$table->rowclass[$idx] = "datos_red";
break;
default:
$table->rowclass[$idx] = "datos_grey";
}
$table->rowclass[$idx] = get_priority_class ($severity);
//Actions
$data[8] = "";
@ -391,26 +373,33 @@ if (give_acl ($config['id_user'], 0, "IM")) {
}
echo "</div></form>";
echo '<table>';
echo '<tr>';
echo '<td rowspan="4" class="f9" style="padding-left: 30px; line-height: 17px; vertical-align: top;">';
echo '<div style="float:left; padding-left:30px; line-height: 17px; vertical-align: top; width:120px;">';
echo '<h3>' . __('Status') . '</h3>';
echo '<img src="images/pixel_green.png" width="20" height="20" /> - ' . __('Validated');
echo '<br />';
echo '<img src="images/pixel_red.png" width="20" height="20" /> - ' . __('Not validated');
echo '</td>';
echo '<td rowspan="4" class="f9" style="padding-left: 30px; line-height: 17px; vertical-align: top;">';
echo '</div>';
echo '<div style="float:left; padding-left:30px; line-height: 17px; vertical-align: top; width:120px;">';
echo '<h3>' . __('Alert') . '</h3>';
echo '<img src="images/pixel_yellow.png" width="20" height="20" /> - ' .__('Fired');
echo '<br />';
echo '<img src="images/pixel_gray.png" width="20" height="20" /> - ' . __('Not fired');
echo '<td rowspan="4" class="f9" style="padding-left: 30px; line-height: 17px; vertical-align: top;">';
echo '</div>';
echo '<div style="float:left; padding-left:30px; line-height: 19px; vertical-align: top; width:120px;">';
echo '<h3>' . __('Action') . '</h3>';
echo '<img src="images/ok.png" /> - ' .__('Validate');
echo '<img src="images/ok.png" width="18" height="18" /> - ' .__('Validate');
echo '<br />';
echo '<img src="images/cross.png" /> - ' . __('Delete');
echo '</td>';
echo '</td></tr></table>';
echo '<img src="images/cross.png" width="18" height="18" /> - ' . __('Delete');
echo '</div>';
echo '<div style="float:left; padding-left:30px; line-height: 17px; vertical-align: top; width:120px;">';
echo '<h3>'.__('Legend').'</h3>';
foreach (get_priorities () as $num => $name) {
echo '<span class="'.get_priority_class ($num).'">'.$name.'</span>';
echo '<br />';
}
echo '</div>';
echo '<div style="clear:both;">&nbsp;</div>';
?>
<script language="JavaScript" type="text/javascript">