From 0cadefa2f04d8dd18647016a5672cf73ef3752db Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Tue, 24 Mar 2015 11:36:40 +0100 Subject: [PATCH] Fixed the previous merge with the 'develop' branch. --- .../include/functions_reporting.php | 200 +++++++----------- 1 file changed, 72 insertions(+), 128 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 7edcb5cfc7..0f7f2168fa 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -959,39 +959,8 @@ function reporting_get_stats_alerts($data, $links = false) { } } - $table_agent = html_get_predefined_table(); - - $agent_data = array(); - $agent_data[0] = html_print_image('images/agent_critical.png', true, array('title' => __('Agents critical'))); - $agent_data[1] = ""; - $agent_data[1] .= format_numeric($data["agent_critical"]) <= 0 ? '-' : format_numeric($data['agent_critical']); - $agent_data[1] .= ""; - - $agent_data[2] = html_print_image('images/agent_warning.png', true, array('title' => __('Agents warning'))); - $agent_data[3] = ""; - $agent_data[3] .= $data["agent_warning"] <= 0 ? '-' : format_numeric($data['agent_warning']); - $agent_data[3] .= ""; - - $table_agent->data[] = $agent_data; - - $agent_data = array(); - $agent_data[0] = html_print_image('images/agent_ok.png', true, array('title' => __('Agents ok'))); - $agent_data[1] = ""; - $agent_data[1] .= $data["agent_ok"] <= 0 ? '-' : format_numeric($data['agent_ok']); - $agent_data[1] .= ""; - - $agent_data[2] = html_print_image('images/agent_unknown.png', true, array('title' => __('Agents unknown'))); - $agent_data[3] = ""; - $agent_data[3] .= $data["agent_unknown"] <= 0 ? '-' : format_numeric($data['agent_unknown']); - $agent_data[3] .= ""; - - $table_agent->data[] = $agent_data; - - $agent_data = array(); - $agent_data[0] = html_print_image('images/agent_notinit.png', true, array('title' => __('Agents not init'))); - $agent_data[1] = ""; - $agent_data[1] .= $data["agent_not_init"] <= 0 ? '-' : format_numeric($data['agent_not_init']); - $agent_data[1] .= ""; + // Alerts table + $table_al = html_get_predefined_table(); $tdata = array(); $tdata[0] = html_print_image('images/bell.png', true, array('title' => __('Defined alerts'))); @@ -1004,14 +973,13 @@ function reporting_get_stats_alerts($data, $links = false) { $table_al->rowclass[] = ''; $table_al->data[] = $tdata; - if (!defined('METACONSOLE')) { + if(!defined('METACONSOLE')){ $output = '
' . __('Defined and fired alerts') . '' . html_print_table($table_al, true) . '
'; - } - else { + }else{ $table_al->class = "tactical_view"; $table_al->style = array(); $output = '
@@ -1027,86 +995,81 @@ function reporting_get_stats_alerts($data, $links = false) { function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_height = 150, $links = false, $data_agents=false) { global $config; - $table_node = html_get_predefined_table(); - - $node_data = array(); - $node_data[0] = html_print_image('images/server_export.png', true, array('title' => __('Nodes'))); - $node_data[1] = ""; - $node_data[1] .= $num_servers <= 0 ? '-' : format_numeric($num_servers); - $node_data[1] .= ""; - $table_node->data[] = $node_data; - - if (!defined('METACONSOLE')){ - $node_overview = '
- ' . - __('Node overview') . - '' . - html_print_table($table_node, true) . '
'; - }else{ - $table_node->style = array(); - $table_node->class = "tactical_view"; - $node_overview = '
- ' . - __('Node overview') . - '' . - html_print_table($table_node, true) . '
'; + // Link URLS + if ($links === false) { + $urls = array(); + $urls['monitor_critical'] = "index.php?" . + "sec=estado&sec2=operation/agentes/status_monitor&" . + "refr=60&status=" . AGENT_MODULE_STATUS_CRITICAL_BAD . "&pure=" . $config['pure']; + $urls['monitor_warning'] = "index.php?" . + "sec=estado&sec2=operation/agentes/status_monitor&" . + "refr=60&status=" . AGENT_MODULE_STATUS_WARNING . "&pure=" . $config['pure']; + $urls['monitor_ok'] = "index.php?" . + "sec=estado&sec2=operation/agentes/status_monitor&" . + "refr=60&status=" . AGENT_MODULE_STATUS_NORMAL . "&pure=" . $config['pure']; + $urls['monitor_unknown'] = "index.php?" . + "sec=estado&sec2=operation/agentes/status_monitor&" . + "refr=60&status=" . AGENT_MODULE_STATUS_UNKNOWN . "&pure=" . $config['pure']; + $urls['monitor_not_init'] = "index.php?" . + "sec=estado&sec2=operation/agentes/status_monitor&" . + "refr=60&status=" . AGENT_MODULE_STATUS_NOT_INIT . "&pure=" . $config['pure']; + } + else { + $urls = array(); + $urls['monitor_critical'] = $links['monitor_critical']; + $urls['monitor_warning'] = $links['monitor_warning']; + $urls['monitor_ok'] = $links['monitor_ok']; + $urls['monitor_unknown'] = $links['monitor_unknown']; + $urls['monitor_not_init'] = $links['monitor_not_init']; } // Modules by status table $table_mbs = html_get_predefined_table(); - $table_events->width = "100%"; - if (defined('METACONSOLE')) - $style = " vertical-align:middle;"; - else - $style = ""; - if (defined('METACONSOLE')){ - $table_events->style[0] = "background-color:#FC4444"; - $table_events->data[0][0] = html_print_image('images/module_event_critical.png', true, array('title' => __('Critical events'))); - $table_events->data[0][0] .= "   " . - ""; - $table_events->data[0][0] .= format_numeric($data['critical']) <= 0 ? ' -' : format_numeric($data['critical']); - $table_events->data[0][0] .= ""; - $table_events->style[1] = "background-color:#FAD403"; - $table_events->data[0][1] = html_print_image('images/module_event_warning.png', true, array('title' => __('Warning events'))); - $table_events->data[0][1] .= "   " . - ""; - $table_events->data[0][1] .= format_numeric($data['warning']) <= 0 ? ' -' : format_numeric($data['warning']); - $table_events->data[0][1] .= ""; - $table_events->style[2] = "background-color:#80BA27"; - $table_events->data[0][2] = html_print_image('images/module_event_ok.png', true, array('title' => __('OK events'))); - $table_events->data[0][2] .= "   " . - ""; - $table_events->data[0][2] .= format_numeric($data['normal']) <= 0 ? ' -' : format_numeric($data['normal']); - $table_events->data[0][2] .= ""; - $table_events->style[3] = "background-color:#B2B2B2"; - $table_events->data[0][3] = html_print_image('images/module_event_unknown.png', true, array('title' => __('Unknown events'))); - $table_events->data[0][3] .= "   " . - ""; - $table_events->data[0][3] .=format_numeric($data['unknown']) <= 0 ? ' -' : format_numeric($data['unknown']); - $table_events->data[0][3] .=""; - } - else{ - $table_events->data[0][0] = html_print_image('images/module_critical.png', true, array('title' => __('Critical events'))); - $table_events->data[0][0] .= "   " . - "". - format_numeric($data['critical']).""; - $table_events->data[0][1] = html_print_image('images/module_warning.png', true, array('title' => __('Warning events'))); - $table_events->data[0][1] .= "   " . - "". - format_numeric($data['warning']).""; - $table_events->data[0][2] = html_print_image('images/module_ok.png', true, array('title' => __('OK events'))); - $table_events->data[0][2] .= "   " . - "". - format_numeric($data['normal']).""; - $table_events->data[0][3] = html_print_image('images/module_unknown.png', true, array('title' => __('Unknown events'))); - $table_events->data[0][3] .= "   " . - "". - format_numeric($data['unknown']).""; + $tdata = array(); + $tdata[0] = html_print_image('images/module_critical.png', true, array('title' => __('Monitor critical'))); + $tdata[1] = $data["monitor_critical"] <= 0 ? '-' : $data["monitor_critical"]; + $tdata[1] = '' . $tdata[1] . ''; + + $tdata[2] = html_print_image('images/module_warning.png', true, array('title' => __('Monitor warning'))); + $tdata[3] = $data["monitor_warning"] <= 0 ? '-' : $data["monitor_warning"]; + $tdata[3] = '' . $tdata[3] . ''; + $table_mbs->rowclass[] = ''; + $table_mbs->data[] = $tdata; + + $tdata = array(); + $tdata[0] = html_print_image('images/module_ok.png', true, array('title' => __('Monitor normal'))); + $tdata[1] = $data["monitor_ok"] <= 0 ? '-' : $data["monitor_ok"]; + $tdata[1] = '' . $tdata[1] . ''; + + $tdata[2] = html_print_image('images/module_unknown.png', true, array('title' => __('Monitor unknown'))); + $tdata[3] = $data["monitor_unknown"] <= 0 ? '-' : $data["monitor_unknown"]; + $tdata[3] = '' . $tdata[3] . ''; + $table_mbs->rowclass[] = ''; + $table_mbs->data[] = $tdata; + + $tdata = array(); + $tdata[0] = html_print_image('images/module_notinit.png', true, array('title' => __('Monitor not init'))); + $tdata[1] = $data["monitor_not_init"] <= 0 ? '-' : $data["monitor_not_init"]; + $tdata[1] = '' . $tdata[1] . ''; + + $tdata[2] = $tdata[3] = ''; + $table_mbs->rowclass[] = ''; + $table_mbs->data[] = $tdata; + if ($data["monitor_checks"] > 0) { + $tdata = array(); + $table_mbs->colspan[count($table_mbs->data)][0] = 4; + $table_mbs->cellstyle[count($table_mbs->data)][0] = 'text-align: center;'; + $tdata[0] = '
' . + '
' . + graph_agent_status(false, $graph_width, $graph_height, true, true, $data_agents) . + '
'; + $table_mbs->rowclass[] = ''; + $table_mbs->data[] = $tdata; } - if (!defined("METACONSOLE")) { + if(!defined("METACONSOLE")){ $output = '
' . @@ -1115,7 +1078,7 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he html_print_table($table_mbs, true) . '
'; } - else { + else{ $table_mbs->class = "tactical_view"; $table_mbs->style=array(); $output = ' @@ -1126,7 +1089,6 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he html_print_table($table_mbs, true) . '
'; } - return $output; } @@ -1178,24 +1140,6 @@ function reporting_get_stats_agents_monitors($data) { function reporting_get_stats_users($data) { global $config; - include_once ('../../include/graphs/functions_gd.php'); - $max_value = count($events); - - $ttl = 1; - $urlImage = ui_get_full_url(false, true, false, false); - - $colors = array( - EVENT_CRIT_MAINTENANCE => COL_MAINTENANCE, - EVENT_CRIT_INFORMATIONAL => COL_INFORMATIONAL, - EVENT_CRIT_NORMAL => COL_NORMAL, - EVENT_CRIT_MINOR => COL_MINOR, - EVENT_CRIT_WARNING => COL_WARNING, - EVENT_CRIT_MAJOR => COL_MAJOR, - EVENT_CRIT_CRITICAL => COL_CRITICAL - ); - - foreach ($events as $data) { - // Link URLS $urls = array(); if (check_acl ($config['id_user'], 0, "UM")) {