diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 49babe1868..008e540179 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,27 @@ +2009-04-06 Sancho Lerena + + * godmode/setup/setup.php + * godmode/setup/setup_visuals.php + * include/config_process.php, + * include/functions_config.php: Added new parameter for status icons. + Old config (fontpath and attachment dir are now manageable in setup). + + * include/functions_ui.php, + godmode/servers/modificar_server.php + operation/agentes/status_monitor.php + operation/agentes/estado_agente.php + operation/agentes/bulbs.php + operation/agentes/estado_monitores.php + operation/agentes/tactical.php + operation/servers/view_server.php: Added support for custom status + images. + + * images/status_sets: Added three new status images pack: Default color + icons, faces and color with text. + + * reporting/fgraph.php: Temporal FIX for problem in access graphs that + takes 100% Apache CPU !!!. Need final fix for this. + 2009-04-03 Sancho Lerena * include/functions_alerts.php: Fixed another notice. diff --git a/pandora_console/godmode/servers/modificar_server.php b/pandora_console/godmode/servers/modificar_server.php index 6ab4fffa4d..1f74d028d0 100644 --- a/pandora_console/godmode/servers/modificar_server.php +++ b/pandora_console/godmode/servers/modificar_server.php @@ -84,7 +84,7 @@ if (isset($_GET["server"])) { $table->width = "90%"; $table->class = "databox"; $table->align = array ('',"center","center","center","center","center","center","center"); - $table->head = array (__('Name'),__('Status'),__('IP Address'),__('Description'),__('Type'),__('Started'),__('Updated'),__('Delete')); + $table->head = array (__('Name'),__('Status'),__('Description'),__('Type'),__('Started'),__('Updated'),__('Delete')); foreach ($result as $row) { $server = ""; @@ -104,10 +104,16 @@ if (isset($_GET["server"])) { $server .= ' '; } + + if ($row['status'] == 0) { + $server_status = print_status_image(STATUS_SERVER_DOWN, '', true); + } else { + $server_status = print_status_image(STATUS_SERVER_OK, '', true); + } + $table->data[] = array ( ''.$row["name"].'', - '', - $row["ip_address"], + $server_status, substr($row["description"],0,25), $server, human_time_comparation ($row["laststart"]), diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index ceea7580e2..7417a273c3 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -93,6 +93,14 @@ $table->data[19][1] = print_checkbox ('https', 1, $config["https"], true); $table->data[20][0] = __('Compact CSS and JS into header'); $table->data[20][1] = print_checkbox ('compact_header', 1, $config["compact_header"], true); + +$table->data[25][0] = __('Font path'); +$table->data[25][1] = print_input_text ('fontpath', $config["fontpath"], '', 50, 255, true); + +$table->data[26][0] = __('Attachment store'); +$table->data[26][1] = print_input_text ('attachment_store', $config["attachment_store"], '', 50, 255, true); + + enterprise_hook ('load_snmpforward_enterprise'); echo '
'; diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 0be4a01710..ad441421e4 100644 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -72,6 +72,14 @@ $table->data[7][1] = print_input_text ('block_size', $config["block_size"], '', $table->data[8][0] = __('Use round corners'); $table->data[8][1] = print_checkbox ('round_corner', 1, $config["round_corner"], true); +$table->data[9][0] = __('Status Icon set'); +$iconsets["default"] = __('Colors (Default)'); +$iconsets["faces"] = __('Faces'); +$iconsets["color_text"] = __('Color and text'); + +$table->data[9][1] = print_select ($iconsets, 'status_images_set', $config["status_images_set"], '', '', '', true); + + echo ''; print_input_hidden ('update_config', 1); print_table ($table); diff --git a/pandora_console/images/status_sets/color_text/agent_critical.png b/pandora_console/images/status_sets/color_text/agent_critical.png new file mode 100755 index 0000000000..4239af2438 Binary files /dev/null and b/pandora_console/images/status_sets/color_text/agent_critical.png differ diff --git a/pandora_console/images/status_sets/color_text/agent_down.png b/pandora_console/images/status_sets/color_text/agent_down.png new file mode 100755 index 0000000000..0c720c4170 Binary files /dev/null and b/pandora_console/images/status_sets/color_text/agent_down.png differ diff --git a/pandora_console/images/status_sets/color_text/agent_no_data.png b/pandora_console/images/status_sets/color_text/agent_no_data.png new file mode 100755 index 0000000000..8add7d7cd4 Binary files /dev/null and b/pandora_console/images/status_sets/color_text/agent_no_data.png differ diff --git a/pandora_console/images/status_sets/color_text/agent_no_monitors.png b/pandora_console/images/status_sets/color_text/agent_no_monitors.png new file mode 100755 index 0000000000..ec087d52ea Binary files /dev/null and b/pandora_console/images/status_sets/color_text/agent_no_monitors.png differ diff --git a/pandora_console/images/status_sets/color_text/agent_ok.png b/pandora_console/images/status_sets/color_text/agent_ok.png new file mode 100755 index 0000000000..6f130e23ad Binary files /dev/null and b/pandora_console/images/status_sets/color_text/agent_ok.png differ diff --git a/pandora_console/images/status_sets/color_text/agent_warning.png b/pandora_console/images/status_sets/color_text/agent_warning.png new file mode 100755 index 0000000000..da90ec581d Binary files /dev/null and b/pandora_console/images/status_sets/color_text/agent_warning.png differ diff --git a/pandora_console/images/status_sets/color_text/alert_disabled.png b/pandora_console/images/status_sets/color_text/alert_disabled.png new file mode 100755 index 0000000000..97ae9f375f Binary files /dev/null and b/pandora_console/images/status_sets/color_text/alert_disabled.png differ diff --git a/pandora_console/images/status_sets/color_text/alert_fired.png b/pandora_console/images/status_sets/color_text/alert_fired.png new file mode 100755 index 0000000000..48adca68df Binary files /dev/null and b/pandora_console/images/status_sets/color_text/alert_fired.png differ diff --git a/pandora_console/images/status_sets/color_text/alert_not_fired.png b/pandora_console/images/status_sets/color_text/alert_not_fired.png new file mode 100755 index 0000000000..6f130e23ad Binary files /dev/null and b/pandora_console/images/status_sets/color_text/alert_not_fired.png differ diff --git a/pandora_console/images/status_sets/color_text/module_critical.png b/pandora_console/images/status_sets/color_text/module_critical.png new file mode 100755 index 0000000000..4239af2438 Binary files /dev/null and b/pandora_console/images/status_sets/color_text/module_critical.png differ diff --git a/pandora_console/images/status_sets/color_text/module_ok.png b/pandora_console/images/status_sets/color_text/module_ok.png new file mode 100755 index 0000000000..6f130e23ad Binary files /dev/null and b/pandora_console/images/status_sets/color_text/module_ok.png differ diff --git a/pandora_console/images/status_sets/color_text/module_warning.png b/pandora_console/images/status_sets/color_text/module_warning.png new file mode 100755 index 0000000000..da90ec581d Binary files /dev/null and b/pandora_console/images/status_sets/color_text/module_warning.png differ diff --git a/pandora_console/images/status_sets/color_text/server_down.png b/pandora_console/images/status_sets/color_text/server_down.png new file mode 100755 index 0000000000..4239af2438 Binary files /dev/null and b/pandora_console/images/status_sets/color_text/server_down.png differ diff --git a/pandora_console/images/status_sets/color_text/server_ok.png b/pandora_console/images/status_sets/color_text/server_ok.png new file mode 100755 index 0000000000..6f130e23ad Binary files /dev/null and b/pandora_console/images/status_sets/color_text/server_ok.png differ diff --git a/pandora_console/images/status_sets/default/agent_critical.png b/pandora_console/images/status_sets/default/agent_critical.png new file mode 100755 index 0000000000..84356a404c Binary files /dev/null and b/pandora_console/images/status_sets/default/agent_critical.png differ diff --git a/pandora_console/images/status_sets/default/agent_down.png b/pandora_console/images/status_sets/default/agent_down.png new file mode 100755 index 0000000000..7b0ba937bb Binary files /dev/null and b/pandora_console/images/status_sets/default/agent_down.png differ diff --git a/pandora_console/images/status_sets/default/agent_no_data.png b/pandora_console/images/status_sets/default/agent_no_data.png new file mode 100755 index 0000000000..c68d728c51 Binary files /dev/null and b/pandora_console/images/status_sets/default/agent_no_data.png differ diff --git a/pandora_console/images/status_sets/default/agent_no_monitors.png b/pandora_console/images/status_sets/default/agent_no_monitors.png new file mode 100755 index 0000000000..5ef86b9c09 Binary files /dev/null and b/pandora_console/images/status_sets/default/agent_no_monitors.png differ diff --git a/pandora_console/images/status_sets/default/agent_ok.png b/pandora_console/images/status_sets/default/agent_ok.png new file mode 100755 index 0000000000..2f8624c0aa Binary files /dev/null and b/pandora_console/images/status_sets/default/agent_ok.png differ diff --git a/pandora_console/images/status_sets/default/agent_warning.png b/pandora_console/images/status_sets/default/agent_warning.png new file mode 100755 index 0000000000..af5c3ab87a Binary files /dev/null and b/pandora_console/images/status_sets/default/agent_warning.png differ diff --git a/pandora_console/images/status_sets/default/alert_disabled.png b/pandora_console/images/status_sets/default/alert_disabled.png new file mode 100755 index 0000000000..ead1ffd337 Binary files /dev/null and b/pandora_console/images/status_sets/default/alert_disabled.png differ diff --git a/pandora_console/images/status_sets/default/alert_fired.png b/pandora_console/images/status_sets/default/alert_fired.png new file mode 100755 index 0000000000..5d29d2b942 Binary files /dev/null and b/pandora_console/images/status_sets/default/alert_fired.png differ diff --git a/pandora_console/images/status_sets/default/alert_not_fired.png b/pandora_console/images/status_sets/default/alert_not_fired.png new file mode 100755 index 0000000000..d8c3ca37e7 Binary files /dev/null and b/pandora_console/images/status_sets/default/alert_not_fired.png differ diff --git a/pandora_console/images/status_sets/default/module_critical.png b/pandora_console/images/status_sets/default/module_critical.png new file mode 100755 index 0000000000..84356a404c Binary files /dev/null and b/pandora_console/images/status_sets/default/module_critical.png differ diff --git a/pandora_console/images/status_sets/default/module_ok.png b/pandora_console/images/status_sets/default/module_ok.png new file mode 100755 index 0000000000..08ea401ef0 Binary files /dev/null and b/pandora_console/images/status_sets/default/module_ok.png differ diff --git a/pandora_console/images/status_sets/default/module_warning.png b/pandora_console/images/status_sets/default/module_warning.png new file mode 100755 index 0000000000..af5c3ab87a Binary files /dev/null and b/pandora_console/images/status_sets/default/module_warning.png differ diff --git a/pandora_console/images/status_sets/default/server_down.png b/pandora_console/images/status_sets/default/server_down.png new file mode 100755 index 0000000000..18422d3fa0 Binary files /dev/null and b/pandora_console/images/status_sets/default/server_down.png differ diff --git a/pandora_console/images/status_sets/default/server_ok.png b/pandora_console/images/status_sets/default/server_ok.png new file mode 100755 index 0000000000..316e6dd1ef Binary files /dev/null and b/pandora_console/images/status_sets/default/server_ok.png differ diff --git a/pandora_console/images/status_sets/faces/agent_critical.png b/pandora_console/images/status_sets/faces/agent_critical.png new file mode 100755 index 0000000000..caa87af476 Binary files /dev/null and b/pandora_console/images/status_sets/faces/agent_critical.png differ diff --git a/pandora_console/images/status_sets/faces/agent_down.png b/pandora_console/images/status_sets/faces/agent_down.png new file mode 100755 index 0000000000..f35fc21aa4 Binary files /dev/null and b/pandora_console/images/status_sets/faces/agent_down.png differ diff --git a/pandora_console/images/status_sets/faces/agent_no_data.png b/pandora_console/images/status_sets/faces/agent_no_data.png new file mode 100755 index 0000000000..d8a1661260 Binary files /dev/null and b/pandora_console/images/status_sets/faces/agent_no_data.png differ diff --git a/pandora_console/images/status_sets/faces/agent_no_monitors.png b/pandora_console/images/status_sets/faces/agent_no_monitors.png new file mode 100755 index 0000000000..1039532a2d Binary files /dev/null and b/pandora_console/images/status_sets/faces/agent_no_monitors.png differ diff --git a/pandora_console/images/status_sets/faces/agent_ok.png b/pandora_console/images/status_sets/faces/agent_ok.png new file mode 100755 index 0000000000..3b7c0b6e64 Binary files /dev/null and b/pandora_console/images/status_sets/faces/agent_ok.png differ diff --git a/pandora_console/images/status_sets/faces/agent_warning.png b/pandora_console/images/status_sets/faces/agent_warning.png new file mode 100755 index 0000000000..854c743dad Binary files /dev/null and b/pandora_console/images/status_sets/faces/agent_warning.png differ diff --git a/pandora_console/images/status_sets/faces/alert_disabled.png b/pandora_console/images/status_sets/faces/alert_disabled.png new file mode 100755 index 0000000000..d8a1661260 Binary files /dev/null and b/pandora_console/images/status_sets/faces/alert_disabled.png differ diff --git a/pandora_console/images/status_sets/faces/alert_fired.png b/pandora_console/images/status_sets/faces/alert_fired.png new file mode 100755 index 0000000000..caa87af476 Binary files /dev/null and b/pandora_console/images/status_sets/faces/alert_fired.png differ diff --git a/pandora_console/images/status_sets/faces/alert_not_fired.png b/pandora_console/images/status_sets/faces/alert_not_fired.png new file mode 100755 index 0000000000..3b7c0b6e64 Binary files /dev/null and b/pandora_console/images/status_sets/faces/alert_not_fired.png differ diff --git a/pandora_console/images/status_sets/faces/module_critical.png b/pandora_console/images/status_sets/faces/module_critical.png new file mode 100755 index 0000000000..caa87af476 Binary files /dev/null and b/pandora_console/images/status_sets/faces/module_critical.png differ diff --git a/pandora_console/images/status_sets/faces/module_ok.png b/pandora_console/images/status_sets/faces/module_ok.png new file mode 100755 index 0000000000..3b7c0b6e64 Binary files /dev/null and b/pandora_console/images/status_sets/faces/module_ok.png differ diff --git a/pandora_console/images/status_sets/faces/module_warning.png b/pandora_console/images/status_sets/faces/module_warning.png new file mode 100755 index 0000000000..854c743dad Binary files /dev/null and b/pandora_console/images/status_sets/faces/module_warning.png differ diff --git a/pandora_console/images/status_sets/faces/server_down.png b/pandora_console/images/status_sets/faces/server_down.png new file mode 100755 index 0000000000..f35fc21aa4 Binary files /dev/null and b/pandora_console/images/status_sets/faces/server_down.png differ diff --git a/pandora_console/images/status_sets/faces/server_ok.png b/pandora_console/images/status_sets/faces/server_ok.png new file mode 100755 index 0000000000..3b7c0b6e64 Binary files /dev/null and b/pandora_console/images/status_sets/faces/server_ok.png differ diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 0c707338ad..d63609e1ab 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,18 +22,6 @@ $pandora_version = 'v3.0-dev'; $config['start_time'] = microtime (true); -// Next is the directory where "/attachment" directory is placed, to upload files stores. -// This MUST be writtable by http server user, and should be in pandora root. -// By default, Pandora adds /attachment to this, so by default is the pandora console home dir - -$config['attachment_store'] = $config['homedir'].'/attachment'; - -// Default font used for graphics (a Free TrueType font included with Pandora FMS) -$config['fontpath'] = $config['homedir'].'/reporting/FreeSans.ttf'; - -// Style (pandora by default) -$config['style'] = 'pandora'; - //Non-persistent connection. If you want persistent conn change it to mysql_pconnect() $config['dbconnection'] = mysql_connect ($config["dbhost"], $config["dbuser"], $config["dbpass"]); if (! $config['dbconnection']) { diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index cb354b36b2..ae2c81380f 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -107,6 +107,7 @@ function update_config () { update_config_value ('https', (bool) get_parameter ('https')); update_config_value ('compact_header', (bool) get_parameter ('compact_header')); update_config_value ('round_corner', (bool) get_parameter ('round_corner')); + update_config_value ('status_images_set', (string) get_parameter ('status_images_set', $config["status_images_set"])); } /** @@ -212,6 +213,10 @@ function process_config () { update_config_value ('compact_header', false); } + if (!isset ($config['status_images_set'])) { + update_config_value ('status_images_set', 'default'); + } + if (isset ($_SESSION['id_usuario'])) $config["id_user"] = $_SESSION["id_usuario"]; @@ -225,6 +230,22 @@ function process_config () { require_once ($config["homedir"]."/include/auth/".$config["auth"]["scheme"].".php"); } + + // Next is the directory where "/attachment" directory is placed, to upload files stores. + // This MUST be writtable by http server user, and should be in pandora root. + // By default, Pandora adds /attachment to this, so by default is the pandora console home dir + if (!isset ($config['attachment_store'])) { + update_config_value ( 'attachment_store', $config['homedir'].'/attachment'); + } + + if (!isset ($config['fontpath'])) { + update_config_value ( 'fontpath', $config['homedir'].'/reporting/FreeSans.ttf'); + } + + if (!isset ($config['style'])) { + update_config_value ( 'style', 'pandora'); + } + /* Finally, check if any value was overwritten in a form */ update_config (); } diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index ef5ff937f7..cb084ab647 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -325,22 +325,23 @@ function format_alert_row ($alert, $compound = false, $agent = true, $url = '') $data[3] = print_timestamp ($alert["last_fired"], true); - $options = array (); - $options["height"] = 18; - $options["width"] = 40; + + $status = STATUS_ALERT_NOT_FIRED; + $title = ""; if ($alert["times_fired"] > 0) { - $options["src"] = "images/pixel_red.png"; - $options["title"] = __('Alert fired').' '.$alert["times_fired"].' '.__('times'); + $status = STATUS_ALERT_FIRED; + $title = __('Alert fired').' '.$alert["times_fired"].' '.__('times'); } elseif ($alert["disabled"] > 0) { - $options["src"] = "images/pixel_gray.png"; - $options["title"] = __('Alert disabled'); + $status = STATUS_ALERT_DISABLED; + $title = __('Alert disabled'); } else { - $options["src"] = "images/pixel_green.png"; - $options["title"] = __('Alert not fired'); + $status = STATUS_ALERT_NOT_FIRED; + $title = __('Alert not fired'); } - $data[4] = print_image ($options["src"], true, $options); + $data[4] = print_status_image($status, $title, true); + if ($compound) { $data[5] = print_checkbox ("validate_compound[]", $alert["id"], false, true); @@ -1011,4 +1012,56 @@ function format_filesize ($bytes) { return format_numeric ($bytes / pow ($con, $log), 1).' '.$strs[$log]; } + + +/** + * Returns the current path to the selected image set to show the + * status of agents and alerts. + * + * @return array An array with the image path, image width and image height. + */ +function get_status_images_path() +{ + global $config; + + $imageset = $config["status_images_set"]; + + if (strpos($imageset, ",") === false) $imageset .= ",40x18"; + list($imageset, $sizes) = split(",", $imageset, 2); + + if (strpos($sizes, "x") === false) $sizes .= "x18"; + list($imagewidth, $imageheight) = split("x", $sizes, 2); // 40x18 + + $imagespath = "images/status_sets/$imageset"; + + return array($imagespath); +} + +define('STATUS_MODULE_OK', 'module_ok.png'); +define('STATUS_MODULE_CRITICAL', 'module_critical.png'); +define('STATUS_MODULE_WARNING', 'module_warning.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'); +define('STATUS_ALERT_DISABLED', 'alert_disabled.png'); + +define('STATUS_SERVER_OK', 'server_ok.png'); +define('STATUS_SERVER_DOWN', 'server_down.png'); + +function print_status_image($type, $title = "", $return = false) +{ + list($imagepath) = get_status_images_path(); + + $imagepath .= "/" . $type; + + return print_image ($imagepath, $return, array ("border" => 0, "title" => $title)); +} + ?> diff --git a/pandora_console/operation/agentes/bulbs.php b/pandora_console/operation/agentes/bulbs.php index 0046bf4a25..68ecf7b69d 100644 --- a/pandora_console/operation/agentes/bulbs.php +++ b/pandora_console/operation/agentes/bulbs.php @@ -16,25 +16,24 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - echo " - - - - - - - - + + + + + + + + + + + + + + + +
- ".__('All Monitors OK')." - ".__('At least one monitor fails')." - ".__('Change between Green/Red state')." - ".__('Alert fired')."
- ".__('Agent without monitors')." - ".__('Agent without data')." - ".__('Agent down')." - ".__('Alert not fired')."
" . print_status_image(STATUS_AGENT_OK, __('All Monitors OK'), true) . __('All Monitors OK') . "" . print_status_image(STATUS_MODULE_CRITICAL, __('At least one monitor fails'), true) . __('At least one monitor fails') . "" . print_status_image(STATUS_MODULE_WARNING, __('Change between Green/Red state'), true) . __('Change between Green/Red state') . "" . print_status_image(STATUS_ALERT_FIRED, __('Alert fired'), true) . __('Alert fired') . "" . print_status_image(STATUS_ALERT_DISABLED, __('Alert disabled'), true) . __('Alerts disabled') . "
" . print_status_image(STATUS_AGENT_NO_MONITORS, __('Agent without monitors'), true) . __('Agent without monitors') . "" . print_status_image(STATUS_AGENT_NO_DATA, __('Agent without data'), true) . __('Agent without data') . "" . print_status_image(STATUS_AGENT_DOWN, __('Agent down'), true) . __('Agent down') . "" . print_status_image(STATUS_ALERT_NOT_FIRED, __('Alert not fired'), true) . __('Alert not fired') . "
"; diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index b06696bb14..a1a6ef1629 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -304,31 +304,32 @@ if ($agents !== false) { if ($monitor_down > 0) echo " : ".$monitor_down.""; echo ""; - + + echo ""; if ($numero_modulos > 0){ if ($agent_down > 0) { - echo ''; + print_status_image(STATUS_AGENT_DOWN, __('Agent down')); } elseif ($monitor_critical > 0) { - echo ''; + print_status_image(STATUS_AGENT_CRITICAL, __('At least one module in CRITICAL status')); } elseif ($monitor_warning > 0) { - echo ''; + print_status_image(STATUS_AGENT_WARNING, __('At least one module in WARNING status')); } else { - echo ''; + print_status_image(STATUS_AGENT_OK, __('All Monitors OK')); } } else { - echo ''; + print_status_image(STATUS_AGENT_NO_DATA, __('Agent without data')); } // checks if an alert was fired recently echo ""; if (give_disabled_group ($id_grupo)) { - echo ""; + print_status_image(STATUS_ALERT_DISABLED, __('Alert disabled')); } else { if (check_alert_fired ($id_agente) == 1) - echo ''; + print_status_image(STATUS_ALERT_FIRED, __('Alert fired')); else - echo ''; + print_status_image(STATUS_ALERT_NOT_FIRED, __('Alert not fired')); } echo ""; echo ""; diff --git a/pandora_console/operation/agentes/estado_monitores.php b/pandora_console/operation/agentes/estado_monitores.php index 9bf0fcb63c..e5c8f328be 100644 --- a/pandora_console/operation/agentes/estado_monitores.php +++ b/pandora_console/operation/agentes/estado_monitores.php @@ -54,6 +54,8 @@ $table->head[4] = __('Status'); $table->head[5] = __('Interval'); $table->head[6] = __('Last contact'); +$table->align = array("left","left","left","left","center"); + foreach ($modules as $module) { $data = array (); if (($module["id_modulo"] != 1) && ($module["id_tipo_modulo"] != 100)) { @@ -72,20 +74,31 @@ foreach ($modules as $module) { $data[2] = substr ($module["nombre"], 0, 25); $data[3] = substr ($module["descripcion"], 0, 35); - + + + $status = STATUS_MODULE_WARNING; + $title = ""; + if ($module["estado"] == 2) { - $data[4] = ''; + $title .= " : " . format_for_graph($module["datos"]); } else { - $data[4] .= substr(salida_limpia($module["datos"]),0,42) . '">'; + $title .= " : " . substr(salida_limpia($module["datos"]),0,42); } + + $data[4] = print_status_image($status, $title, true); + + if ($module["module_interval"] > 0) { $data[5] = $module["module_interval"]; diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index b812b0c636..f2de50de1d 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -233,11 +233,11 @@ foreach ($result as $row) { $data[4] = $row["agent_interval"]; if ($row["estado"] == 0) { - $data[5] = ''; + $data[5] = print_status_image(STATUS_MODULE_OK, $row["datos"], true); } elseif ($row["estado"] == 1) { - $data[5] = ''; + $data[5] = print_status_image(STATUS_MODULE_CRITICAL, $row["datos"], true); } else { - $data[5] = ''; + $data[5] = print_status_image(STATUS_MODULE_WARNING, $row["datos"], true); } $seconds = get_system_time () - $row["utimestamp"]; diff --git a/pandora_console/operation/agentes/tactical.php b/pandora_console/operation/agentes/tactical.php index bd4fb32694..77a130e323 100644 --- a/pandora_console/operation/agentes/tactical.php +++ b/pandora_console/operation/agentes/tactical.php @@ -185,9 +185,9 @@ foreach ($serverinfo as $server) { $data[0] = $server["name"]; if ($server["status"] == 0){ - $data[1] = print_image ("images/pixel_red.png", true, array ("width" => 20, "height" => 20)); + $data[1] = print_status_image(STATUS_SERVER_DOWN, '', true); } else { - $data[1] = print_image ("images/pixel_green.png", true, array ("width" => 20, "height" => 20)); + $data[1] = print_status_image(STATUS_SERVER_OK, '', true); } $data[2] = print_image ("reporting/fgraph.php?tipo=progress&percent=".$server["load"]."&height=20&width=80", diff --git a/pandora_console/operation/servers/view_server.php b/pandora_console/operation/servers/view_server.php index 09b700a175..82ae5fd866 100644 --- a/pandora_console/operation/servers/view_server.php +++ b/pandora_console/operation/servers/view_server.php @@ -65,9 +65,9 @@ foreach ($servers as $server) { $data[0] = "".$server['name'].""; if ($server['status'] == 0) { - $data[1] = print_image ("images/pixel_red.png", true, array ("width" => 10, "height" => 10)); + $data[1] = print_status_image(STATUS_SERVER_DOWN, '', true); } else { - $data[1] = print_image ("images/pixel_green.png", true, array ("width" => 10, "height" => 10)); + $data[1] = print_status_image(STATUS_SERVER_OK, '', true); } // Load diff --git a/pandora_console/reporting/fgraph.php b/pandora_console/reporting/fgraph.php index c4235e189f..1adefd4cd9 100644 --- a/pandora_console/reporting/fgraph.php +++ b/pandora_console/reporting/fgraph.php @@ -429,6 +429,11 @@ function graphic_agentmodules ($id_agent, $width, $height) { function graphic_agentaccess ($id_agent, $width, $height, $period = 0) { global $config; + + /* BROKEN: Need to fix, it gets 100% CPU of Apache !!!*/ + + $data = array(); +/* $resolution = $config["graph_res"] * ($period * 2 / $width); // Number of "slices" we want in graph @@ -450,9 +455,15 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0) { "utimestamp < $date"), array ('utimestamp')); + if ($result === false) $result = array (); + +// SEEMS that problem is below +// it get's 100% cpu on apache and problem is localed here, I don't exactly +// why or what is happening here, but i'm sure that the problem is here. + $max_value = 0; foreach ($result as $access) { $utimestamp = $access['utimestamp']; @@ -463,7 +474,7 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0) { } } } - + */ $engine = get_graph_engine ($period); $engine->width = $width;