2013-07-24 Sergio Martin <sergio.martin@artica.es>
* include/functions_modules.php include/functions_reporting.php operation/agentes/estado_monitores.php operation/search_agents.php: Fixed several errors on module status counts for bug #2338 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8563 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
829b6e591f
commit
1615c31696
|
@ -1,3 +1,11 @@
|
|||
2013-07-24 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_modules.php
|
||||
include/functions_reporting.php
|
||||
operation/agentes/estado_monitores.php
|
||||
operation/search_agents.php: Fixed several errors on
|
||||
module status counts for bug #2338
|
||||
|
||||
2013-07-23 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* godmode/alerts/alert_list.builder.php: Fix layout
|
||||
|
|
|
@ -370,11 +370,11 @@ function modules_create_agent_module ($id_agent, $name, $values = false, $disabl
|
|||
|
||||
if (isset ($values['id_tipo_modulo']) && ($values['id_tipo_modulo'] == 21 || $values['id_tipo_modulo'] == 22 || $values['id_tipo_modulo'] == 23)) {
|
||||
// Async modules start in normal status
|
||||
$status = 0;
|
||||
$status = AGENT_MODULE_STATUS_NORMAL;
|
||||
}
|
||||
else {
|
||||
// Sync modules start in unknown status
|
||||
$status = 4;
|
||||
$status = AGENT_MODULE_STATUS_NO_DATA;
|
||||
}
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
|
|
|
@ -2753,12 +2753,6 @@ function reporting_get_agent_module_info ($id_agent, $filter = false) {
|
|||
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_unknown"] = 0; //Number of 'unknown' monitors
|
||||
$return["monitor_alertsfired"] = 0; //Number of monitors with fired alerts
|
||||
$return["last_contact"] = 0; //Last agent contact
|
||||
$return["status"] = STATUS_AGENT_NO_DATA;
|
||||
$return["status_img"] = ui_print_status_image (STATUS_AGENT_NO_DATA, __('Agent without data'), true);
|
||||
|
@ -2767,9 +2761,9 @@ function reporting_get_agent_module_info ($id_agent, $filter = false) {
|
|||
$return["alert_img"] = ui_print_status_image (STATUS_ALERT_NOT_FIRED, __('Alert not fired'), true);
|
||||
$return["agent_group"] = agents_get_agent_group ($id_agent);
|
||||
|
||||
if (!check_acl ($config["id_user"], $return["agent_group"], "RR")) {
|
||||
if (!check_acl ($config["id_user"], $return["agent_group"], "AR")) {
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filter != '') {
|
||||
$filter = 'AND ';
|
||||
|
@ -2785,44 +2779,28 @@ function reporting_get_agent_module_info ($id_agent, $filter = false) {
|
|||
|
||||
$now = get_system_time ();
|
||||
|
||||
// Calculate modules for this agent
|
||||
foreach ($modules as $key => $module) {
|
||||
$return["modules"]++;
|
||||
|
||||
$alert_status = modules_get_agentmodule_status($key, false);
|
||||
$module_status = modules_get_agentmodule_status($key, true);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if ($alert_status == 4) {
|
||||
$return["monitor_alertsfired"]++;
|
||||
}
|
||||
|
||||
}
|
||||
// Get modules status for this agent
|
||||
|
||||
if ($return["modules"] > 0) {
|
||||
if ($return["monitor_critical"] > 0) {
|
||||
$agent = db_get_row ("tagente", "id_agente", $id_agent);
|
||||
|
||||
$return["total_count"] = $agent["total_count"];
|
||||
$return["normal_count"] = $agent["normal_count"];
|
||||
$return["warning_count"] = $agent["warning_count"];
|
||||
$return["critical_count"] = $agent["critical_count"];
|
||||
$return["unknown_count"] = $agent["unknown_count"];
|
||||
$return["fired_count"] = $agent["fired_count"];
|
||||
$return["notinit_count"] = $agent["notinit_count"];
|
||||
|
||||
if ($return["total_count"] > 0) {
|
||||
if ($return["critical_count"] > 0) {
|
||||
$return["status"] = STATUS_AGENT_CRITICAL;
|
||||
$return["status_img"] = ui_print_status_image (STATUS_AGENT_CRITICAL, __('At least one module in CRITICAL status'), true);
|
||||
}
|
||||
else if ($return["monitor_warning"] > 0) {
|
||||
else if ($return["warning_count"] > 0) {
|
||||
$return["status"] = STATUS_AGENT_WARNING;
|
||||
$return["status_img"] = ui_print_status_image (STATUS_AGENT_WARNING, __('At least one module in WARNING status'), true);
|
||||
}
|
||||
else if ($return["monitor_unknown"] > 0) {
|
||||
else if ($return["unknown_count"] > 0) {
|
||||
$return["status"] = STATUS_AGENT_DOWN;
|
||||
$return["status_img"] = ui_print_status_image (STATUS_AGENT_DOWN, __('At least one module is in UKNOWN status'), true);
|
||||
}
|
||||
|
@ -2833,7 +2811,7 @@ function reporting_get_agent_module_info ($id_agent, $filter = false) {
|
|||
}
|
||||
|
||||
//Alert not fired is by default
|
||||
if ($return["monitor_alertsfired"] > 0) {
|
||||
if ($return["fired_count"] > 0) {
|
||||
$return["alert_status"] = "fired";
|
||||
$return["alert_img"] = ui_print_status_image (STATUS_ALERT_FIRED, __('Alert fired'), true);
|
||||
$return["alert_value"] = STATUS_ALERT_FIRED;
|
||||
|
|
|
@ -189,9 +189,9 @@ switch ($config["dbtype"]) {
|
|||
ON tagente_modulo.id_module_group = tmodule_group.id_mg
|
||||
WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
AND %s %s
|
||||
AND tagente_estado.utimestamp != 0
|
||||
AND tagente_estado.estado != %d
|
||||
ORDER BY tagente_modulo.id_module_group , %s %s",
|
||||
$id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, $order['field'], $order['order']);
|
||||
$id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']);
|
||||
break;
|
||||
case "oracle":
|
||||
$sql = sprintf ("
|
||||
|
@ -205,9 +205,9 @@ switch ($config["dbtype"]) {
|
|||
AND %s %s
|
||||
AND tagente_modulo.delete_pending = 0
|
||||
AND tagente_modulo.disabled = 0
|
||||
AND tagente_estado.utimestamp != 0
|
||||
AND tagente_estado.estado != %d
|
||||
ORDER BY tagente_modulo.id_module_group , %s %s
|
||||
", $id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, $order['field'], $order['order']);
|
||||
", $id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']);
|
||||
break;
|
||||
}
|
||||
$count_modules = db_get_all_rows_sql ($sql);
|
||||
|
@ -230,9 +230,9 @@ switch ($config["dbtype"]) {
|
|||
ON tagente_modulo.id_module_group = tmodule_group.id_mg
|
||||
WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
|
||||
AND %s %s
|
||||
AND tagente_estado.utimestamp != 0
|
||||
AND tagente_estado.estado != %d
|
||||
ORDER BY tagente_modulo.id_module_group , %s %s",
|
||||
$id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, $order['field'], $order['order']);
|
||||
$id_agente, $status_text_monitor_sql, $status_filter_sql, $tags_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']);
|
||||
break;
|
||||
// If Dbms is Oracle then field_list in sql statement has to be recoded. See oracle_list_all_field_table()
|
||||
case "oracle":
|
||||
|
@ -251,9 +251,9 @@ switch ($config["dbtype"]) {
|
|||
AND %s %s
|
||||
AND tagente_modulo.delete_pending = 0
|
||||
AND tagente_modulo.disabled = 0
|
||||
AND tagente_estado.utimestamp != 0
|
||||
AND tagente_estado.estado != %d
|
||||
ORDER BY tagente_modulo.id_module_group , %s %s
|
||||
", $id_agente, $status_text_monitor_sql, $tags_sql, $status_filter_sql, $order['field'], $order['order']);
|
||||
", $id_agente, $status_text_monitor_sql, $tags_sql, $status_filter_sql, AGENT_MODULE_STATUS_NO_DATA, $order['field'], $order['order']);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,6 @@ else {
|
|||
$limit = " LIMIT " . $config['block_size'] . " OFFSET " . get_parameter ('offset',0);
|
||||
}
|
||||
|
||||
|
||||
$modules = db_get_all_rows_sql ($sql . $limit);
|
||||
if (empty ($modules)) {
|
||||
$modules = array ();
|
||||
|
|
|
@ -84,14 +84,7 @@ else {
|
|||
foreach ($agents as $agent) {
|
||||
$agent_info = reporting_get_agent_module_info ($agent["id_agente"]);
|
||||
|
||||
$counts_info = array('total_count' => $agent_info["modules"],
|
||||
'normal_count' => $agent_info["monitor_normal"],
|
||||
'critical_count' => $agent_info["monitor_critical"],
|
||||
'warning_count' => $agent_info["monitor_warning"],
|
||||
'unknown_count' => $agent_info["monitor_unknown"],
|
||||
'fired_count' => $agent_info["monitor_alertsfired"]);
|
||||
|
||||
$modulesCell = reporting_tiny_stats($counts_info, true);
|
||||
$modulesCell = reporting_tiny_stats($agent_info, true);
|
||||
|
||||
if ($agent['disabled']) {
|
||||
$cellName = "<em>" . ui_print_agent_name ($agent["id_agente"], true, "text-transform: uppercase;") . ui_print_help_tip(__('Disabled'), true) . "</em>";
|
||||
|
|
Loading…
Reference in New Issue