2010-08-04 Sergio Martin <sergio.martin@artica.es>
* include/styles/pandora.css include/functions_reporting.php include/functions_ui.php include/functions_db.php operation/agentes/status_monitor.php operation/agentes/estado_agente.php operation/agentes/bulbs.php operation/agentes/estado_monitores.php operation/agentes/group_view.php images/status_sets/default/module_no_data.png images/status_sets/default/alert_fired.png images/status_sets/default/agent_no_monitors.png images/status_sets/default/alert_fired_ball.png images/status_sets/default/agent_no_monitors_ball.png images/status_sets/default/agent_down_ball.png images/status_sets/default/agent_down.png: Fixed several modules and agents list status to use the new unknown status. Some images was changed too for show the same colour than the visual and network maps git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3091 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
|
@ -1,3 +1,24 @@
|
|||
2010-08-04 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/styles/pandora.css
|
||||
include/functions_reporting.php
|
||||
include/functions_ui.php
|
||||
include/functions_db.php
|
||||
operation/agentes/status_monitor.php
|
||||
operation/agentes/estado_agente.php
|
||||
operation/agentes/bulbs.php
|
||||
operation/agentes/estado_monitores.php
|
||||
operation/agentes/group_view.php
|
||||
images/status_sets/default/module_no_data.png
|
||||
images/status_sets/default/alert_fired.png
|
||||
images/status_sets/default/agent_no_monitors.png
|
||||
images/status_sets/default/alert_fired_ball.png
|
||||
images/status_sets/default/agent_no_monitors_ball.png
|
||||
images/status_sets/default/agent_down_ball.png
|
||||
images/status_sets/default/agent_down.png: Fixed several modules
|
||||
and agents list status to use the new unknown status. Some images was
|
||||
changed too for show the same colour than the visual and network maps
|
||||
|
||||
2010-08-03 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_networkmap.php
|
||||
|
|
Before Width: | Height: | Size: 207 B After Width: | Height: | Size: 207 B |
Before Width: | Height: | Size: 355 B After Width: | Height: | Size: 354 B |
Before Width: | Height: | Size: 207 B |
Before Width: | Height: | Size: 354 B |
Before Width: | Height: | Size: 189 B After Width: | Height: | Size: 191 B |
Before Width: | Height: | Size: 221 B After Width: | Height: | Size: 264 B |
After Width: | Height: | Size: 207 B |
|
@ -2657,6 +2657,19 @@ function get_agentmodule_status ($id_agentmodule = 0) {
|
|||
return $status_row['estado'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last status of an agent module.
|
||||
*
|
||||
* @param int Id agent module to check.
|
||||
*
|
||||
* @return int Module last status.
|
||||
*/
|
||||
function get_agentmodule_last_status ($id_agentmodule = 0) {
|
||||
$status_row = get_db_row ("tagente_estado", "id_agente_modulo", $id_agentmodule);
|
||||
|
||||
return $status_row['last_status'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the worst status of all modules of a given agent.
|
||||
*
|
||||
|
|
|
@ -1482,10 +1482,11 @@ function get_module_detailed_event_reporting ($id_modules, $period = 0, $date =
|
|||
* Get a detailed report of the modules of the agent
|
||||
*
|
||||
* @param int $id_agent Agent id to get the report for.
|
||||
* @param string $filter filter for get partial modules.
|
||||
*
|
||||
* @return array An array
|
||||
*/
|
||||
function get_agent_module_info ($id_agent) {
|
||||
function get_agent_module_info ($id_agent, $filter = false) {
|
||||
global $config;
|
||||
|
||||
$return = array ();
|
||||
|
@ -1493,9 +1494,9 @@ function get_agent_module_info ($id_agent) {
|
|||
$return["monitor_normal"] = 0; //Number of 'good' monitors
|
||||
$return["monitor_warning"] = 0; //Number of 'warning' monitors
|
||||
$return["monitor_critical"] = 0; //Number of 'critical' monitors
|
||||
$return["monitor_down"] = 0; //Number of 'down' monitors
|
||||
$return["monitor_unknown"] = 0; //Number of 'unknown' monitors
|
||||
$return["monitor_alertsfired"] = 0; //Number of monitors with fired alerts
|
||||
$return["last_contact"] = 0; //Last agent contact
|
||||
$return["interval"] = get_agent_interval ($id_agent); //How often the agent gets contacted
|
||||
$return["status_img"] = print_status_image (STATUS_AGENT_NO_DATA, __('Agent without data'), true);
|
||||
$return["alert_status"] = "notfired";
|
||||
$return["alert_img"] = print_status_image (STATUS_ALERT_NOT_FIRED, __('Alert not fired'), true);
|
||||
|
@ -1505,14 +1506,8 @@ function get_agent_module_info ($id_agent) {
|
|||
return $return;
|
||||
}
|
||||
|
||||
$sql = sprintf ("SELECT * FROM tagente_estado, tagente_modulo
|
||||
WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
AND tagente_modulo.disabled = 0
|
||||
AND tagente_estado.utimestamp > 0
|
||||
AND tagente_modulo.id_agente = %d", $id_agent);
|
||||
|
||||
$modules = get_db_all_rows_sql ($sql, false, false);
|
||||
|
||||
$modules = get_agent_modules($id_agent, false, $filter, true, false);
|
||||
|
||||
if ($modules === false) {
|
||||
return $return;
|
||||
}
|
||||
|
@ -1520,156 +1515,58 @@ function get_agent_module_info ($id_agent) {
|
|||
$now = get_system_time ();
|
||||
|
||||
// Calculate modules for this agent
|
||||
foreach ($modules as $module) {
|
||||
foreach ($modules as $key => $module) {
|
||||
$return["modules"]++;
|
||||
|
||||
if ($module["module_interval"] > $return["interval"]) {
|
||||
$return["interval"] = $module["module_interval"];
|
||||
} elseif ($module["module_interval"] == 0) {
|
||||
$module["module_interval"] = $return["interval"];
|
||||
$module_status = get_agentmodule_status($key);
|
||||
|
||||
switch($module_status){
|
||||
case 0:
|
||||
$return["monitor_normal"]++;
|
||||
break;
|
||||
case 1:
|
||||
$return["monitor_critical"]++;
|
||||
break;
|
||||
case 2:
|
||||
$return["monitor_warning"]++;
|
||||
break;
|
||||
case 3:
|
||||
$return["monitor_unknown"]++;
|
||||
break;
|
||||
case 4:
|
||||
$return["monitor_alertsfired"]++;
|
||||
break;
|
||||
}
|
||||
|
||||
if ($module["utimestamp"] > $return["last_contact"]) {
|
||||
$return["last_contact"] = $module["utimestamp"];
|
||||
}
|
||||
|
||||
if (($module["id_tipo_modulo"] < 21 || $module["id_tipo_modulo"] > 23 ) AND ($module["id_tipo_modulo"] != 100)) {
|
||||
$async = 0;
|
||||
} else {
|
||||
$async = 1;
|
||||
}
|
||||
|
||||
if ($async == 0 && ($module["utimestamp"] < ($now - $module["module_interval"] * 2))) {
|
||||
$return["monitor_down"]++;
|
||||
} elseif ($module["estado"] == 2) {
|
||||
$return["monitor_warning"]++;
|
||||
} elseif ($module["estado"] == 1) {
|
||||
$return["monitor_critical"]++;
|
||||
} else {
|
||||
$return["monitor_normal"]++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($return["modules"] > 0) {
|
||||
if ($return["modules"] == $return["monitor_down"])
|
||||
$return["status_img"] = print_status_image (STATUS_AGENT_DOWN, __('At least one module is in UKNOWN status'), true);
|
||||
else if ($return["monitor_critical"] > 0)
|
||||
if ($return["monitor_critical"] > 0) {
|
||||
$return["status_img"] = print_status_image (STATUS_AGENT_CRITICAL, __('At least one module in CRITICAL status'), true);
|
||||
else if ($return["monitor_warning"] > 0)
|
||||
}
|
||||
else if ($return["monitor_warning"] > 0) {
|
||||
$return["status_img"] = print_status_image (STATUS_AGENT_WARNING, __('At least one module in WARNING status'), true);
|
||||
else
|
||||
}
|
||||
else if ($return["monitor_unknown"] > 0) {
|
||||
$return["status_img"] = print_status_image (STATUS_AGENT_DOWN, __('At least one module is in UKNOWN status'), true);
|
||||
}
|
||||
else {
|
||||
$return["status_img"] = print_status_image (STATUS_AGENT_OK, __('All Monitors OK'), true);
|
||||
}
|
||||
}
|
||||
|
||||
//Alert not fired is by default
|
||||
if (give_disabled_group ($return["agent_group"])) {
|
||||
if ($return["monitor_alertsfired"] > 0) {
|
||||
$return["alert_status"] = "fired";
|
||||
$return["alert_img"] = print_status_image (STATUS_ALERT_FIRED, __('Alert fired'), true);
|
||||
} elseif (give_disabled_group ($return["agent_group"])) {
|
||||
$return["alert_status"] = "disabled";
|
||||
$return["alert_img"] = print_status_image (STATUS_ALERT_DISABLED, __('Alert disabled'), true);
|
||||
} elseif (check_alert_fired ($id_agent) == 1) {
|
||||
$return["alert_status"] = "fired";
|
||||
$return["alert_img"] = print_status_image (STATUS_ALERT_FIRED, __('Alert fired'), true);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a detailed report of the modules of the agent
|
||||
*
|
||||
* @param int $id_agent Agent id to get the report for.
|
||||
*
|
||||
* @return array An array
|
||||
*/
|
||||
function get_agent_module_info_with_filter ($id_agent,$filter = '') {
|
||||
global $config;
|
||||
|
||||
$return = array ();
|
||||
$return["modules"] = 0; //Number of modules
|
||||
$return["monitor_normal"] = 0; //Number of 'good' monitors
|
||||
$return["monitor_warning"] = 0; //Number of 'warning' monitors
|
||||
$return["monitor_critical"] = 0; //Number of 'critical' monitors
|
||||
$return["monitor_down"] = 0; //Number of 'down' monitors
|
||||
$return["last_contact"] = 0; //Last agent contact
|
||||
$return["interval"] = get_agent_interval ($id_agent); //How often the agent gets contacted
|
||||
$return["status_img"] = print_status_image (STATUS_AGENT_NO_DATA, __('Agent without data'), true);
|
||||
$return["alert_status"] = "notfired";
|
||||
$return["alert_img"] = print_status_image (STATUS_ALERT_NOT_FIRED, __('Alert not fired'), true);
|
||||
$return["agent_group"] = get_agent_group ($id_agent);
|
||||
|
||||
if (!give_acl ($config["id_user"], $return["agent_group"], "AR")) {
|
||||
return $return;
|
||||
}
|
||||
|
||||
$sql = sprintf ("SELECT * FROM tagente_estado, tagente_modulo
|
||||
WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
AND tagente_modulo.disabled = 0
|
||||
AND tagente_estado.utimestamp > 0
|
||||
AND tagente_modulo.id_agente = %d", $id_agent);
|
||||
|
||||
$sql .= $filter;
|
||||
|
||||
$modules = get_db_all_rows_sql ($sql);
|
||||
|
||||
if ($modules === false) {
|
||||
return $return;
|
||||
}
|
||||
|
||||
$now = get_system_time ();
|
||||
|
||||
// Calculate modules for this agent
|
||||
foreach ($modules as $module) {
|
||||
$return["modules"]++;
|
||||
|
||||
if ($module["module_interval"] > $return["interval"]) {
|
||||
$return["interval"] = $module["module_interval"];
|
||||
} elseif ($module["module_interval"] == 0) {
|
||||
$module["module_interval"] = $return["interval"];
|
||||
}
|
||||
|
||||
if ($module["utimestamp"] > $return["last_contact"]) {
|
||||
$return["last_contact"] = $module["utimestamp"];
|
||||
}
|
||||
|
||||
if (($module["id_tipo_modulo"] < 21 || $module["id_tipo_modulo"] > 23 ) AND ($module["id_tipo_modulo"] != 100)) {
|
||||
$async = 0;
|
||||
} else {
|
||||
$async = 1;
|
||||
}
|
||||
|
||||
if ($async == 0 && ($module["utimestamp"] < ($now - $module["module_interval"] * 2))) {
|
||||
$return["monitor_down"]++;
|
||||
} elseif ($module["estado"] == 2) {
|
||||
$return["monitor_warning"]++;
|
||||
} elseif ($module["estado"] == 1) {
|
||||
$return["monitor_critical"]++;
|
||||
} else {
|
||||
$return["monitor_normal"]++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($return["modules"] > 0) {
|
||||
if ($return["modules"] == $return["monitor_down"])
|
||||
$return["status_img"] = print_status_image (STATUS_AGENT_DOWN, __('At least one module is in UKNOWN status'), true);
|
||||
else if ($return["monitor_critical"] > 0)
|
||||
$return["status_img"] = print_status_image (STATUS_AGENT_CRITICAL, __('At least one module in CRITICAL status'), true);
|
||||
else if ($return["monitor_warning"] > 0)
|
||||
$return["status_img"] = print_status_image (STATUS_AGENT_WARNING, __('At least one module in WARNING status'), true);
|
||||
else
|
||||
$return["status_img"] = print_status_image (STATUS_AGENT_OK, __('All Monitors OK'), true);
|
||||
}
|
||||
|
||||
//Alert not fired is by default
|
||||
if (give_disabled_group ($return["agent_group"])) {
|
||||
$return["alert_status"] = "disabled";
|
||||
$return["alert_img"] = print_status_image (STATUS_ALERT_DISABLED, __('Alert disabled'), true);
|
||||
} elseif (check_alert_fired ($id_agent) == 1) {
|
||||
$return["alert_status"] = "fired";
|
||||
$return["alert_img"] = print_status_image (STATUS_ALERT_FIRED, __('Alert fired'), true);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is used once, in reporting_viewer.php, the HTML report render
|
||||
* file. This function proccess each report item and write the render in the
|
||||
|
|
|
@ -298,9 +298,13 @@ function print_os_icon ($id_os, $name = true, $return = false) {
|
|||
*
|
||||
* @return string HTML with agent name and link
|
||||
*/
|
||||
function print_agent_name ($id_agent, $return = false, $cutoff = 0, $style = '') {
|
||||
function print_agent_name ($id_agent, $return = false, $cutoff = 0, $style = '', $cutname = false) {
|
||||
$agent_name = (string) get_agent_name ($id_agent);
|
||||
$output = '<a style="' . $style . '" href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent.'" title="'.$agent_name.'"><b>'.$agent_name.'</b></a>';
|
||||
$agent_name_full = $agent_name;
|
||||
if($cutname) {
|
||||
$agent_name = printTruncateText($agent_name, $cutname);
|
||||
}
|
||||
$output = '<a style="' . $style . '" href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent.'" title="'.$agent_name_full.'"><b>'.$agent_name.'</b></a>';
|
||||
|
||||
//TODO: Add a pretty javascript (using jQuery) popup-box with agent details
|
||||
|
||||
|
@ -1179,13 +1183,13 @@ function get_status_images_path () {
|
|||
define ('STATUS_MODULE_OK', 'module_ok.png');
|
||||
define ('STATUS_MODULE_CRITICAL', 'module_critical.png');
|
||||
define ('STATUS_MODULE_WARNING', 'module_warning.png');
|
||||
define ('STATUS_MODULE_NO_DATA', 'module_no_data.png');
|
||||
|
||||
define ('STATUS_AGENT_CRITICAL', 'agent_critical.png');
|
||||
define ('STATUS_AGENT_WARNING', 'agent_warning.png');
|
||||
define ('STATUS_AGENT_DOWN', 'agent_down.png');
|
||||
define ('STATUS_AGENT_OK', 'agent_ok.png');
|
||||
define ('STATUS_AGENT_NO_DATA', 'agent_no_data.png');
|
||||
define ('STATUS_AGENT_NO_MONITORS', 'agent_no_monitors.png');
|
||||
|
||||
define ('STATUS_ALERT_FIRED', 'alert_fired.png');
|
||||
define ('STATUS_ALERT_NOT_FIRED', 'alert_not_fired.png');
|
||||
|
|
|
@ -481,6 +481,9 @@ tr.rowOdd:hover {
|
|||
border-bottom: 1px solid #708090;
|
||||
width: 100%;
|
||||
}
|
||||
.orange {
|
||||
color: #ffa300;
|
||||
}
|
||||
.green {
|
||||
color: #5a8629;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ echo '
|
|||
|
||||
</tr><tr>
|
||||
|
||||
<td class="f9i">' . print_status_image(STATUS_AGENT_NO_MONITORS, __('Agent without monitors'), true) . __('Agent without monitors') . '</td>
|
||||
<td class="f9i">' . print_status_image(STATUS_AGENT_NO_DATA, __('Agent without data'), true) . __('Agent without data') . '</td>
|
||||
<td class="f9i">' . print_status_image(STATUS_AGENT_DOWN, __('Agent down'), true) . __('Agent down') . '</td>
|
||||
|
||||
|
|
|
@ -295,7 +295,7 @@ foreach ($agents as $agent) {
|
|||
$data[0] .= '</a> ';
|
||||
}
|
||||
|
||||
$data[0] .= print_agent_name ($agent["id_agente"], true, "none");
|
||||
$data[0] .= print_agent_name ($agent["id_agente"], true, "none", '', 23);
|
||||
|
||||
$data[1] = print_os_icon ($agent["id_os"], false, true);
|
||||
|
||||
|
@ -313,14 +313,16 @@ foreach ($agents as $agent) {
|
|||
$data[4] = '<b>';
|
||||
$data[4] .= $agent_info["modules"];
|
||||
|
||||
if ($agent_info["monitor_alertsfired"] > 0)
|
||||
$data[4] .= ' : <span class="orange">'.$agent_info["monitor_alertsfired"].'</span>';
|
||||
if ($agent_info["monitor_critical"] > 0)
|
||||
$data[4] .= ' : <span class="red">'.$agent_info["monitor_critical"].'</span>';
|
||||
if ($agent_info["monitor_warning"] > 0)
|
||||
$data[4] .= ' : <span class="yellow">'.$agent_info["monitor_warning"].'</span>';
|
||||
if ($agent_info["monitor_unknown"] > 0)
|
||||
$data[4] .= ' : <span class="grey">'.$agent_info["monitor_unknown"].'</span>';
|
||||
if ($agent_info["monitor_normal"] > 0)
|
||||
$data[4] .= ' : <span class="green">'.$agent_info["monitor_normal"].'</span>';
|
||||
if ($agent_info["monitor_down"] > 0)
|
||||
$data[4] .= ' : <span class="grey">'.$agent_info["monitor_down"].'</span>';
|
||||
$data[4] .= '</b>';
|
||||
|
||||
$data[5] = $agent_info["status_img"];
|
||||
|
|
|
@ -203,21 +203,37 @@ foreach ($modules as $module) {
|
|||
$status = STATUS_MODULE_WARNING;
|
||||
$title = "";
|
||||
|
||||
if ($module["estado"] == 2) {
|
||||
$status = STATUS_MODULE_WARNING;
|
||||
$title = __('WARNING');
|
||||
} elseif ($module["estado"] == 1) {
|
||||
if ($module["estado"] == 1) {
|
||||
$status = STATUS_MODULE_CRITICAL;
|
||||
$title = __('CRITICAL');
|
||||
} else {
|
||||
} elseif ($module["estado"] == 2) {
|
||||
$status = STATUS_MODULE_WARNING;
|
||||
$title = __('WARNING');
|
||||
} elseif ($module["estado"] == 0) {
|
||||
$status = STATUS_MODULE_OK;
|
||||
$title = __('NORMAL');
|
||||
} elseif ($module["estado"] == 3) {
|
||||
$last_status = get_agentmodule_last_status($module['id_agente_modulo']);
|
||||
switch($last_status) {
|
||||
case 0:
|
||||
$status = STATUS_MODULE_OK;
|
||||
$title = __('UNKNOWN')." - ".__('Last status')." ".__('NORMAL');
|
||||
break;
|
||||
case 1:
|
||||
$status = STATUS_MODULE_CRITICAL;
|
||||
$title = __('UNKNOWN')." - ".__('Last status')." ".__('CRITICAL');
|
||||
break;
|
||||
case 2:
|
||||
$status = STATUS_MODULE_WARNING;
|
||||
$title = __('UNKNOWN')." - ".__('Last status')." ".__('WARNING');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_numeric($module["datos"])) {
|
||||
$title .= " : " . format_for_graph($module["datos"]);
|
||||
$title .= ": " . format_for_graph($module["datos"]);
|
||||
} else {
|
||||
$title .= " : " . substr(safe_output($module["datos"]),0,42);
|
||||
$title .= ": " . substr(safe_output($module["datos"]),0,42);
|
||||
}
|
||||
|
||||
$data[4] = print_status_image($status, $title, true);
|
||||
|
@ -257,8 +273,7 @@ foreach ($modules as $module) {
|
|||
$data[6] .= " <a href='index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=$id_agente&tab=data_view&period=86400&id=".$module["id_agente_modulo"]."'><img border=0 src='images/binary.png'></a>";
|
||||
}
|
||||
|
||||
$seconds = get_system_time () - $module["utimestamp"];
|
||||
if ($module['id_tipo_modulo'] < 21 && $module["module_interval"] > 0 && $module["utimestamp"] > 0 && $seconds >= ($module["module_interval"] * 2)) {
|
||||
if ($module['estado'] == 3) {
|
||||
$data[7] = '<span class="redb">';
|
||||
} else {
|
||||
$data[7] = '<span>';
|
||||
|
|
|
@ -155,7 +155,7 @@ foreach ($groups as $id_group => $group_name) {
|
|||
|
||||
// Monitors Not Init
|
||||
if ($data["monitor_not_init"] > 0){
|
||||
echo "<td style='font-weight: bold; font-size: 18px; color: #bc0000; text-align: center;'>";
|
||||
echo "<td style='font-weight: bold; font-size: 18px; color: #729fcf; text-align: center;'>";
|
||||
echo $data["monitor_not_init"];
|
||||
echo "</td>";
|
||||
} else {
|
||||
|
@ -173,7 +173,7 @@ foreach ($groups as $id_group => $group_name) {
|
|||
|
||||
// Monitors Warning
|
||||
if ($data["monitor_warning"] > 0){
|
||||
echo "<td style='font-weight: bold; font-size: 18px; color: #aba900; text-align: center;'>";
|
||||
echo "<td style='font-weight: bold; font-size: 18px; color: #f2ef00; text-align: center;'>";
|
||||
echo $data["monitor_warning"];
|
||||
echo "</td>";
|
||||
} else {
|
||||
|
@ -190,7 +190,7 @@ foreach ($groups as $id_group => $group_name) {
|
|||
}
|
||||
// Alerts fired
|
||||
if ($data["monitor_alerts_fired"] > 0){
|
||||
echo "<td style='font-weight: bold; font-size: 18px; color: #8b01ae; text-align: center;'>";
|
||||
echo "<td style='font-weight: bold; font-size: 18px; color: #ffa300; text-align: center;'>";
|
||||
echo $data["monitor_alerts_fired"];
|
||||
echo "</td>";
|
||||
} else {
|
||||
|
|
|
@ -104,7 +104,6 @@ if ($modulegroup > 0) {
|
|||
$sql .= sprintf (" AND tagente_modulo.id_module_group = '%d'", $modulegroup);
|
||||
}
|
||||
|
||||
|
||||
// Module name selector
|
||||
if ($ag_modulename != "") {
|
||||
$sql .= sprintf (" AND tagente_modulo.nombre = '%s'", $ag_modulename);
|
||||
|
@ -116,31 +115,24 @@ if ($ag_freestring != "") {
|
|||
}
|
||||
|
||||
// Status selector
|
||||
if ($status == 0) { //Up
|
||||
if ($status == 0) { //Normal
|
||||
$sql .= " AND tagente_estado.estado = 0
|
||||
AND ((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) < (tagente_estado.current_interval * 2) OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100)))
|
||||
AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24))) ";
|
||||
AND (utimestamp > 0 OR (tagente_modulo.id_tipo_modulo IN(21,22,23,100))) ";
|
||||
}
|
||||
elseif ($status == 2) { //Critical
|
||||
$sql .= " AND tagente_estado.estado = 1
|
||||
AND ((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) < (tagente_estado.current_interval * 2) OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100)))
|
||||
AND utimestamp > 0 ";
|
||||
$sql .= " AND tagente_estado.estado = 1 AND utimestamp > 0";
|
||||
}
|
||||
elseif ($status == 1) { //Warning
|
||||
$sql .= " AND tagente_estado.estado = 2
|
||||
AND ((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) < (tagente_estado.current_interval * 2) OR (tagente_modulo.id_tipo_modulo IN(21,22,23,24,100)))
|
||||
AND utimestamp > 0 ";
|
||||
$sql .= " AND tagente_estado.estado = 2 AND utimestamp > 0";
|
||||
}
|
||||
elseif ($status == 4) { //Not normal
|
||||
$sql .= " AND (((UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) >= (tagente_estado.current_interval * 2) AND (tagente_modulo.id_tipo_modulo NOT IN(21,22,23,24,100))) OR tagente_estado.estado = 2 OR tagente_estado.estado = 1) AND utimestamp > 0";
|
||||
|
||||
$sql .= " AND tagente_estado.estado <> 0";
|
||||
}
|
||||
elseif ($status == 3) { //Unknown
|
||||
$sql .= " AND utimestamp > 0 AND tagente_modulo.id_tipo_modulo NOT IN(21,22,23,24,100) AND (UNIX_TIMESTAMP(NOW()) - tagente_estado.utimestamp) >= (tagente_estado.current_interval * 2)";
|
||||
|
||||
}
|
||||
$sql .= " AND tagente_estado.estado = 3";
|
||||
}
|
||||
elseif ($status == 5) { //Not init
|
||||
$sql .= " AND tagente_estado.utimestamp = 0 AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,24)";
|
||||
$sql .= " AND tagente_estado.utimestamp = 0 AND tagente_modulo.id_tipo_modulo NOT IN (21,22,23,100)";
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY tagente.id_grupo, tagente.nombre";
|
||||
|
@ -225,12 +217,27 @@ foreach ($result as $row) {
|
|||
|
||||
$data[4] = ($row['module_interval'] == 0) ? $row['agent_interval'] : $row['module_interval'];
|
||||
|
||||
if ($row["estado"] == 0) {
|
||||
$data[5] = print_status_image(STATUS_MODULE_OK, $row["datos"], true);
|
||||
if($row['utimestamp'] == 0 && (($row['module_type'] < 21 || $row['module_type'] > 23) && $row['module_type'] != 100)){
|
||||
$data[5] = print_status_image(STATUS_MODULE_NO_DATA, __('NOT INIT'), true);
|
||||
} elseif ($row["estado"] == 0) {
|
||||
$data[5] = print_status_image(STATUS_MODULE_OK, __('NORMAL').": ".$row["datos"], true);
|
||||
} elseif ($row["estado"] == 1) {
|
||||
$data[5] = print_status_image(STATUS_MODULE_CRITICAL, $row["datos"], true);
|
||||
$data[5] = print_status_image(STATUS_MODULE_CRITICAL, __('CRITICAL').": ".$row["datos"], true);
|
||||
} elseif ($row["estado"] == 2) {
|
||||
$data[5] = print_status_image(STATUS_MODULE_WARNING, __('WARNING').": ".$row["datos"], true);
|
||||
} else {
|
||||
$data[5] = print_status_image(STATUS_MODULE_WARNING, $row["datos"], true);
|
||||
$last_status = get_agentmodule_last_status($row['id_agente_modulo']);
|
||||
switch($last_status) {
|
||||
case 0:
|
||||
$data[5] = print_status_image(STATUS_MODULE_OK, __('UNKNOWN')." - ".__('Last status')." ".__('NORMAL').": ".$row["datos"], true);
|
||||
break;
|
||||
case 1:
|
||||
$data[5] = print_status_image(STATUS_MODULE_CRITICAL, __('UNKNOWN')." - ".__('Last status')." ".__('CRITICAL').": ".$row["datos"], true);
|
||||
break;
|
||||
case 2:
|
||||
$data[5] = print_status_image(STATUS_MODULE_WARNING, __('UNKNOWN')." - ".__('Last status')." ".__('WARNING').": ".$row["datos"], true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$data[6] = "";
|
||||
|
@ -254,21 +261,14 @@ foreach ($result as $row) {
|
|||
$data[7] = format_numeric($row["datos"]);
|
||||
else
|
||||
$data[7] = "<span title='".$row['datos']."' style='white-space: nowrap;'>".substr(safe_output($row["datos"]),0,12)."</span>";
|
||||
|
||||
$seconds = get_system_time () - $row["utimestamp"];
|
||||
|
||||
if ($row["module_interval"] > 0)
|
||||
$interval = $row["module_interval"];
|
||||
else
|
||||
$interval = $row["agent_interval"];
|
||||
|
||||
if ((($row["module_type"] < 21) OR ($row["module_type"] > 24)) AND ($row["module_type"] != 100)){
|
||||
if ($seconds >= ($interval * 2)) {
|
||||
$option = array ("html_attr" => 'class="redb"');
|
||||
}
|
||||
else {
|
||||
$option = array ();
|
||||
}
|
||||
if ($row['estado'] == 3){
|
||||
$option = array ("html_attr" => 'class="redb"');
|
||||
} else {
|
||||
$option = array ();
|
||||
}
|
||||
|
|