From 1624c390f4581033232c25e604a46e33f7aba53d Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Mon, 25 Feb 2013 16:44:26 +0000 Subject: [PATCH] 2013-02-25 Sergio Martin * include/functions_graph.php include/constants.php images/bell_error.png general/logon_ok.php: Restructurated the tactical view overview table. TODO: Change icons git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7718 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 8 + pandora_console/general/logon_ok.php | 204 ++++++++++++++------ pandora_console/images/bell_error.png | Bin 0 -> 813 bytes pandora_console/include/constants.php | 1 + pandora_console/include/functions_graph.php | 26 ++- 5 files changed, 175 insertions(+), 64 deletions(-) create mode 100644 pandora_console/images/bell_error.png diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 1ed6e877b0..21c6b4c991 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2013-02-25 Sergio Martin + + * include/functions_graph.php + include/constants.php + images/bell_error.png + general/logon_ok.php: Restructurated the tactical view + overview table. TODO: Change icons + 2013-02-25 Miguel de Dios * include/functions.php, operation/events/events.build_table.php, diff --git a/pandora_console/general/logon_ok.php b/pandora_console/general/logon_ok.php index 6d2fd22f42..5aed041847 100644 --- a/pandora_console/general/logon_ok.php +++ b/pandora_console/general/logon_ok.php @@ -99,67 +99,161 @@ $table->data[5][0] = html_print_table ($table); unset ($table); -echo ''; -echo ''; +/////////////// +// Overview +/////////////// -$cells = array (); -$cells[0][0] = __('Total agents'); -$cells[0][1] = $data["total_agents"]; -$cells[0]["color"] = "#000"; -$cells[0]["href"] = "index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60"; - -$cells[1][0] = __('Monitor checks'); -$cells[1][1] = $data["monitor_checks"]; -$cells[1]["color"] = "#000"; -$cells[1]["href"] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=-1"; - -$cells[2][0] = __('Monitors critical'); -$cells[2][1] = $data["monitor_critical"]; -$cells[2]["color"] = "#c00"; -$cells[2]["href"] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=2"; - -$cells[3][0] = __('Monitors warning'); -$cells[3][1] = $data["monitor_warning"]; -$cells[3]["color"] = "#ffb900"; -$cells[3]["href"] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=1"; - -$cells[4][0] = __('Monitors normal'); -$cells[4][1] = $data["monitor_ok"]; -$cells[4]["color"] = "#8ae234"; -$cells[4]["href"] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=0"; - -$cells[5][0] = __('Monitors unknown'); -$cells[5][1] = $data["monitor_unknown"]; -$cells[5]["color"] = "#aaa"; -$cells[5]["href"] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=3"; - -$cells[6][0] = __('Alerts defined'); -$cells[6][1] = $data["monitor_alerts"]; -$cells[6]["color"] = "#000"; -$cells[6]["href"] = "index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60"; - -$cells[7][0] = __('Users defined'); -$cells[7][1] = count (get_users ()); -$cells[7]["color"] = "#000"; +// Link URLS +$urls = array(); +$urls['total_agents'] = "index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60"; +$urls['monitor_checks'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=-1"; +$urls['monitor_critical'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=2"; +$urls['monitor_warning'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=1"; +$urls['monitor_ok'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=0"; +$urls['monitor_unknown'] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=3"; +$urls['monitor_alerts'] = "index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60"; +$urls['monitor_alerts_fired'] = "index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60&filter=fired"; if (check_acl ($config['id_user'], 0, "UM")) { - $user_link = 'index.php?sec=gusuarios&sec2=godmode/users/user_list'; + $urls['defined_users'] = "index.php?sec=gusuarios&sec2=godmode/users/user_list"; } else{ - $user_link = '#'; -} -$cells[7]["href"] = $user_link; - -foreach ($cells as $key => $row) { - //Switch class around - $class = (($key % 2) ? "datos2" : "datos"); - echo ''; - if ($row[1] === 0) { - $row[1] = "-"; - } - echo ''; + $urls['defined_users'] = 'javascript:'; } -echo '
'.__('Pandora FMS Overview').'
'.$row[0].''.$row[1].'
'; +// Transparent table as template to build subtables +$table_transparent->class = "none"; +$table_transparent->cellpadding = 0; +$table_transparent->cellspacing = 0; +$table_transparent->head = array (); +$table_transparent->data = array (); +$table_transparent->style[0] = $table_transparent->style[1] = $table_transparent->style[2] = $table_transparent->style[3] = 'text-align:center; width: 25%;'; +$table_transparent->width = "100%"; + +// Agents and modules table +$table_am = clone $table_transparent; + +$tdata = array(); +$tdata[0] = html_print_image('images/bricks.png', true, array('title' => __('Total agents'), 'width' => '20px')); +$tdata[1] = $data["total_agents"] == 0 ? '-' : $data["total_agents"]; +$tdata[1] = '' . $tdata[1] . ''; + +$tdata[2] = html_print_image('images/brick.png', true, array('title' => __('Monitor checks'), 'width' => '20px')); +$tdata[3] = $data["monitor_checks"] == 0 ? '-' : $data["monitor_checks"]; +$tdata[3] = '' . $tdata[3] . ''; +$table_am->rowclass[] = ''; +$table_am->data[] = $tdata; + +// Modules by status table +$table_mbs = clone $table_transparent; + +$tdata = array(); +$tdata[0] = html_print_image('images/status_sets/default/agent_critical_ball.png', true, array('title' => __('Monitor critical'), 'width' => '20px')); +$tdata[1] = $data["monitor_critical"] == 0 ? '-' : $data["monitor_critical"]; +$tdata[1] = '' . $tdata[1] . ''; + +$tdata[2] = html_print_image('images/status_sets/default/agent_warning_ball.png', true, array('title' => __('Monitor warning'), 'width' => '20px')); +$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/status_sets/default/agent_ok_ball.png', true, array('title' => __('Monitor normal'), 'width' => '20px')); +$tdata[1] = $data["monitor_ok"] == 0 ? '-' : $data["monitor_ok"]; +$tdata[1] = '' . $tdata[1] . ''; + +$tdata[2] = html_print_image('images/status_sets/default/agent_no_monitors_ball.png', true, array('title' => __('Monitor unknown'), 'width' => '20px')); +$tdata[3] = $data["monitor_unknown"] == 0 ? '-' : $data["monitor_unknown"]; +$tdata[3] = '' . $tdata[3] . ''; +$table_mbs->rowclass[] = ''; +$table_mbs->data[] = $tdata; + +$tdata = array(); +$table_mbs->colspan[count($table_mbs->data)][0] = 4; +$tdata[0] = '
' . graph_agent_status (false, 250, 150, true) . '
'; +$table_mbs->rowclass[] = ''; +$table_mbs->data[] = $tdata; + +// Alerts table +$table_al = clone $table_transparent; + +$tdata = array(); +$tdata[0] = html_print_image('images/bell.png', true, array('title' => __('Defined alerts'), 'width' => '20px')); +$tdata[1] = $data["monitor_alerts"] == 0 ? '-' : $data["monitor_alerts"]; +$tdata[1] = '' . $tdata[1] . ''; + +$tdata[2] = html_print_image('images/bell_error.png', true, array('title' => __('Fired alerts'), 'width' => '20px')); +$tdata[3] = $data["monitor_alerts_fired"] == 0 ? '-' : $data["monitor_alerts_fired"]; +$tdata[3] = '' . $tdata[3] . ''; +$table_al->rowclass[] = ''; +$table_al->data[] = $tdata; + +// Users table +$table_us = clone $table_transparent; + +$tdata = array(); +$tdata[0] = html_print_image('images/group.png', true, array('title' => __('Defined users'), 'width' => '20px')); +$tdata[1] = count (get_users ()); +$tdata[1] = '' . $tdata[1] . ''; + +$tdata[2] = $tdata[3] = ' '; +$table_us->rowclass[] = ''; +$table_us->data[] = $tdata; + +// Overview table build +$table->class = "databox"; +$table->cellpadding = 4; +$table->cellspacing = 4; +$table->head = array (); +$table->data = array (); +$table->style[0] = 'text-align:center;'; +$table->width = "100%"; +$table->head[0] = __('Pandora FMS Overview'); +$table->head_colspan[0] = 4; + +// Total agents and modules +$tdata = array(); +$tdata[0] = '
+ ' . + __('Total agents and monitors') . + '' . + html_print_table($table_am, true) . '
'; +$table->rowclass[] = ''; +$table->data[] = $tdata; + +// Modules by status +$tdata = array(); +$tdata[0] = '
+ ' . + __('Monitors by status') . + '' . + html_print_table($table_mbs, true) . '
'; +$table->rowclass[] = ''; +$table->data[] = $tdata; + +// Alerts +$tdata = array(); +$tdata[0] = '
+ ' . + __('Defined and fired alerts') . + '' . + html_print_table($table_al, true) . '
'; +$table->rowclass[] = ''; +$table->data[] = $tdata; + +// Users +$tdata = array(); +$tdata[0] = '
+ ' . + __('Users') . + '' . + html_print_table($table_us, true) . '
'; +$table->rowclass[] = ''; +$table->data[] = $tdata; + +html_print_table($table); +unset($table); + echo ""; echo '
'; echo "

"; diff --git a/pandora_console/images/bell_error.png b/pandora_console/images/bell_error.png new file mode 100644 index 0000000000000000000000000000000000000000..a0ddc002810338ce423552488f54ff4bb590221d GIT binary patch literal 813 zcmV+|1JeA7P)CQtw$vWGj$RSg4MP#$JT9~>*(5N&#&*-6OANOx%eB+tcDd0+ph(OOzXSet)ue=n#fRxPKJ!7q4Td0;96nICJD&_1!IjO3|5$ zB?m6qJ0|JPj^WOKMAWJi)R#~rO?G5}x#h+&;9;Orbn?K3RQBnYtlT7BF%S3ddx+;E zzK5AgqM-}%ezvFMqYrZN->*2k%otxsA%lG*M~%!Q2k}?GqPcJtab3bqk4-Ou*)vQk zDnq0+U6BWX8G8DGJ+wPN{OsFCkL?rG-p6duqJhu-)h6q87fEEXA3KI;W|2r(Z^=@p zLD1B~ww^3r>mIkSO_N9nU7BVaVE1;h?4`+#PGRTwuyWHvyat}HGo1$RhFq!L`k65F z>Fyq7{+3N`shc}8&i3)+G+Q8Ie$oM+J6S$aE8V+xclHZ*?tYS> z-Dcvo1MJ!NI;-mz1BEwXbC#J47fEMaq9}$_7)f>jfEP|x_O4XdO21tFlDt!(R$fHK zCp)|stFMiCRZt{<8WT42~V9+p44CDi|?-{ImoJvRNYc z_%M+doc!kO*b~N9Yn(YhF+cvs#i5va2MyPNzyFxTQVvTuuT#2w_R^MH2t7YJ`|*^k rqKHUbBZ;dBDypdXDyoQ}s)K(4xVc{-Vpqm500000NkvXXu0mjfWm$>@ literal 0 HcmV?d00001 diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php index 954c7f3466..ea1f47b198 100644 --- a/pandora_console/include/constants.php +++ b/pandora_console/include/constants.php @@ -116,6 +116,7 @@ switch ($config["dbtype"]) { /* Color constants */ define('COL_CRITICAL','#FF0000'); define('COL_WARNING','#FFFF00'); +define('COL_WARNING_DARK','#FFB900'); define('COL_NORMAL','#38B800'); define('COL_NOTINIT','#3BA0FF'); define('COL_UNKNOWN','#AAAAAA'); diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index b11d1fa8a0..d8ed8b4cc1 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -1339,22 +1339,30 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0, $return = } /** - * Print a pie graph with events data of agent + * Print a pie graph with events data of agent or all agents (if id_agent = false) * * @param integer id_agent Agent ID * @param integer width pie graph width * @param integer height pie graph height * @param bool return or echo flag */ -function graph_agent_status ($id_agent, $width = 300, $height = 200, $return = false) { +function graph_agent_status ($id_agent = false, $width = 300, $height = 200, $return = false) { global $config; - $filter = array('id_agente' => $id_agent, 'disabled' => 0); - $fields = array('critical_count Critical', - 'warning_count Warning', - 'normal_count Normal', - 'unknown_count Unknown'/*, - 'sum(notinit_count) "Not init"'*/); + + $filter = array('disabled' => 0, 'id_grupo' => array_keys(users_get_groups(false, 'AR', false))); + + + if(!empty($id_agent)) { + $filter['id_agente'] = $id_agent; + } + + $fields = array('SUM(critical_count) Critical', + 'SUM(warning_count) Warning', + 'SUM(normal_count) Normal', + 'SUM(unknown_count) Unknown', + 'SUM(fired_count) "Fired Alerts"'/*, + 'SUM(notinit_count) "Not init"'*/); $agent_status = db_get_all_rows_filter('tagente', $filter, $fields); @@ -1363,7 +1371,7 @@ function graph_agent_status ($id_agent, $width = 300, $height = 200, $return = f $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", 'url' => ui_get_full_url("/images/logo_vertical_water.png")); - $colors = array(COL_CRITICAL, COL_WARNING, COL_NORMAL, COL_UNKNOWN/*, COL_NOTINIT*/); + $colors = array(COL_CRITICAL, COL_WARNING, COL_NORMAL, COL_UNKNOWN, COL_ALERTFIRED/*, COL_NOTINIT*/); $out = pie2d_graph($config['flash_charts'], $data, $width, $height, __("other"), '', $water_mark, $config['fontpath'], $config['font_size'], 1, "hidden", $colors);