diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index ba5602312e..6b9a4ef6a1 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,18 @@ +2009-01-22 Sancho Lerena + + * images/*: Added more icons and backgrouns for visual console. + + * map_builder.php: Added support for warning image. Shows in preview. Fixed + grabbing image info if no file provided. + + * functions_visualmap.php, functions_db.php: Added support for warning status + in the maps. Also fixed status propagation from linked maps on agent object. + + * include/auth/mysql.php: Fixed typo when update password. + + * pandoradb_migrate_20_to_21.php: Added some missing lines for tusuario + table (comments). + 2009-01-22 Evi Vanoost * include/auth/ldap.php: Finally fixed (hopefully) the last major bug diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index 07d856881e..3bd1a796fa 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -115,10 +115,11 @@ if ($update_layout) { if ($get_background_info) { $file = (string) get_parameter ('background'); - - $info = getimagesize ('images/console/background/'.$file); - $info['width'] = $info[0]; - $info['height'] = $info[1]; + if (file_exist('images/console/background/'.$file)){ + $info = getimagesize ('images/console/background/'.$file); + $info['width'] = $info[0]; + $info['height'] = $info[1]; + } if (defined ('AJAX')) { echo json_encode ($info); exit; @@ -340,6 +341,8 @@ if (! $edit_layout && ! $id_layout) { continue; if (strpos ($image_file, "_ok")) continue; + if (strpos ($image_file, "_warning")) + continue; $image_file = substr ($image_file, 0, strlen ($image_file) - 4); $images_list[$image_file] = $image_file; } @@ -577,6 +580,7 @@ $(document).ready (function () { if (this.value != '') { $("#image_preview").append ($('').attr ('src', 'images/console/icons/' + this.value + '.png')); $("#image_preview").append ($('').attr ('src', 'images/console/icons/' + this.value + '_ok.png')); + $("#image_preview").append ($('').attr ('src', 'images/console/icons/' + this.value + '_warning.png')); $("#image_preview").append ($('').attr ('src', 'images/console/icons/' + this.value + '_bad.png')); } }); diff --git a/pandora_console/images/console/background/white.jpg b/pandora_console/images/console/background/white.jpg new file mode 100644 index 0000000000..8d10778a5a Binary files /dev/null and b/pandora_console/images/console/background/white.jpg differ diff --git a/pandora_console/images/console/background/white_boxed.jpg b/pandora_console/images/console/background/white_boxed.jpg new file mode 100644 index 0000000000..e1dcc611e1 Binary files /dev/null and b/pandora_console/images/console/background/white_boxed.jpg differ diff --git a/pandora_console/images/console/icons/computer_warning.png b/pandora_console/images/console/icons/computer_warning.png new file mode 100644 index 0000000000..e691db5941 Binary files /dev/null and b/pandora_console/images/console/icons/computer_warning.png differ diff --git a/pandora_console/images/console/icons/disk.png b/pandora_console/images/console/icons/disk.png new file mode 100644 index 0000000000..9d749df746 Binary files /dev/null and b/pandora_console/images/console/icons/disk.png differ diff --git a/pandora_console/images/console/icons/disk_bad.png b/pandora_console/images/console/icons/disk_bad.png new file mode 100644 index 0000000000..19798bbab8 Binary files /dev/null and b/pandora_console/images/console/icons/disk_bad.png differ diff --git a/pandora_console/images/console/icons/disk_ok.png b/pandora_console/images/console/icons/disk_ok.png new file mode 100644 index 0000000000..4b75780978 Binary files /dev/null and b/pandora_console/images/console/icons/disk_ok.png differ diff --git a/pandora_console/images/console/icons/disk_warning.png b/pandora_console/images/console/icons/disk_warning.png new file mode 100644 index 0000000000..a726c8919a Binary files /dev/null and b/pandora_console/images/console/icons/disk_warning.png differ diff --git a/pandora_console/images/console/icons/dot.png b/pandora_console/images/console/icons/dot.png index cc54a9baa6..07493411b7 100644 Binary files a/pandora_console/images/console/icons/dot.png and b/pandora_console/images/console/icons/dot.png differ diff --git a/pandora_console/images/console/icons/dot_warning.png b/pandora_console/images/console/icons/dot_warning.png new file mode 100644 index 0000000000..76a8035edc Binary files /dev/null and b/pandora_console/images/console/icons/dot_warning.png differ diff --git a/pandora_console/images/console/icons/firewall.png b/pandora_console/images/console/icons/firewall.png index 9015dd90e2..cd545ae0dc 100644 Binary files a/pandora_console/images/console/icons/firewall.png and b/pandora_console/images/console/icons/firewall.png differ diff --git a/pandora_console/images/console/icons/firewall_warning.png b/pandora_console/images/console/icons/firewall_warning.png new file mode 100644 index 0000000000..8106169d7e Binary files /dev/null and b/pandora_console/images/console/icons/firewall_warning.png differ diff --git a/pandora_console/images/console/icons/network.png b/pandora_console/images/console/icons/network.png new file mode 100644 index 0000000000..1f29071f1b Binary files /dev/null and b/pandora_console/images/console/icons/network.png differ diff --git a/pandora_console/images/console/icons/network_warning.png b/pandora_console/images/console/icons/network_warning.png new file mode 100644 index 0000000000..229b169b5d Binary files /dev/null and b/pandora_console/images/console/icons/network_warning.png differ diff --git a/pandora_console/images/console/icons/nuclear_warning.png b/pandora_console/images/console/icons/nuclear_warning.png new file mode 100644 index 0000000000..9496950779 Binary files /dev/null and b/pandora_console/images/console/icons/nuclear_warning.png differ diff --git a/pandora_console/images/console/icons/router_warning.png b/pandora_console/images/console/icons/router_warning.png new file mode 100644 index 0000000000..08d4952ed8 Binary files /dev/null and b/pandora_console/images/console/icons/router_warning.png differ diff --git a/pandora_console/images/console/icons/server_warning.png b/pandora_console/images/console/icons/server_warning.png new file mode 100644 index 0000000000..4f029072c0 Binary files /dev/null and b/pandora_console/images/console/icons/server_warning.png differ diff --git a/pandora_console/images/console/icons/smalldot_warning.png b/pandora_console/images/console/icons/smalldot_warning.png new file mode 100644 index 0000000000..e0a6161f07 Binary files /dev/null and b/pandora_console/images/console/icons/smalldot_warning.png differ diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php index ce1db2296b..50d986f19c 100644 --- a/pandora_console/include/auth/mysql.php +++ b/pandora_console/include/auth/mysql.php @@ -216,7 +216,7 @@ function process_user_password ( $user, $password_old, $password_new ) { return false; } - return process_sql_update ("tusuario", array ("password" => md5 ($password_new)), array ("id_user" => $id_user)); + return process_sql_update ("tusuario", array ("password" => md5 ($password_new)), array ("id_user" => $user)); } function process_user_info ($id_user, $user_info) { @@ -256,4 +256,4 @@ function process_user_isadmin ($id_user, $is_admin) { //Reference the global use authorization error to last auth error. $config["auth_error"] = &$mysql_cache["auth_error"]; -?> \ No newline at end of file +?> diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index bbb14100f1..3ee2f23ab9 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -1609,20 +1609,31 @@ function format_array_to_update_sql ($values) { function return_status_agent_module ($id_agentmodule = 0) { $status = get_db_value ('estado', 'tagente_estado', 'id_agente_modulo', $id_agentmodule); - if ($status == 100) { - // We need to check if there are any alert on this item - $times_fired = get_db_value ('SUM(times_fired)', 'talert_template_modules', - 'id_agent_module', $id_agentmodule); - if ($times_fired > 0) { - return 0; - } - // No alerts fired for this agent module - return 1; - } elseif ($status == 0) { // 0 is ok for estado field - return 1; - } else { - return 0; + $times_fired = get_db_value ('SUM(times_fired)', 'talert_template_modules', 'id_agent_module', $id_agentmodule); + if ($times_fired > 0) { + return 4; // Alert } + return $status; +} + +/** + * Get the worst status of all modules of a given agent. + * + * @param int Id agent to check. + * + * @return int Worst status of an agent for all of its modules + */ +function return_status_agent ($id_agent = 0) { + $status = get_db_sql ("SELECT MAX(estado) + FROM tagente_estado, tagente_modulo + WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo + AND tagente_modulo.disabled = 0 + AND tagente_modulo.delete_pending = 0 + AND tagente_modulo.id_agente = $id_agent"); + + // TODO: Check any alert for that agent who has recept alerts fired + + return $status; } /** @@ -1639,25 +1650,34 @@ function return_status_agent_module ($id_agentmodule = 0) { function return_status_layout ($id_layout = 0) { $temp_status = 0; $temp_total = 0; - $sql = sprintf ('SELECT id_agente_modulo, parent_item, id_layout_linked FROM `tlayout_data` WHERE `id_layout` = %d', $id_layout); + $sql = sprintf ('SELECT id_agente_modulo, parent_item, id_layout_linked, id_agent FROM `tlayout_data` WHERE `id_layout` = %d', $id_layout); $result = get_db_all_rows_sql ($sql); if ($result === false) return 0; foreach ($result as $rownum => $data) { + + // Other Layout (Recursive!) if (($data["id_layout_linked"] != 0) && ($data["id_agente_modulo"] == 0)) { - $temp_status += return_status_layout ($data["id_layout_linked"]); - $temp_total++; + $temp_status = return_status_layout ($data["id_layout_linked"]); + if ($temp_status > $temp_total){ + $temp_total = $temp_status; + } + + // Module + } elseif ($data["id_agente_modulo"] != 0) { + $temp_status = return_status_agent_module ($data["id_agente_modulo"]); + if ($temp_status > $temp_total) + $temp_total = $temp_status; + + // Agent } else { - $temp_status += return_status_agent_module ($data["id_agente_modulo"]); - $temp_total++; + $temp_status = return_status_agent ($data["id_agent"]); + if ($temp_status > $temp_total) + $temp_total = $temp_status; } } - if ($temp_status == $temp_total) { - return 1; - } - - return 0; + return $temp_total; } /** diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 96aec27033..3621a1ebd0 100644 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -2,7 +2,7 @@ // Pandora FMS - the Flexible Monitoring System // ============================================ -// Copyright (c) 2008 Artica Soluciones Tecnologicas, http://www.artica.es +// Copyright (c) 2009 Artica Soluciones Tecnologicas, http://www.artica.es // Please see http://pandora.sourceforge.net for full contribution list // This program is free software; you can redistribute it and/or @@ -38,20 +38,25 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines = // Linked to other layout ?? - Only if not module defined if ($layout_data['id_layout_linked'] != 0) { $status = return_status_layout ($layout_data['id_layout_linked']); + $status_parent = 3; } else { + + // Status for a simple module if ($layout_data['id_agente_modulo'] != 0) { $id_agent = get_db_value ("id_agente", "tagente_estado", "id_agente_modulo", $layout_data['id_agente_modulo']); $id_agent_module_parent = get_db_value ("id_agente_modulo", "tlayout_data", "id", $layout_data["parent_item"]); // Item value $status = return_status_agent_module ($layout_data['id_agente_modulo']); if ($layout_data['no_link_color'] == 1) - $status_parent = -1; + $status_parent = 3; else $status_parent = return_status_agent_module ($id_agent_module_parent); - } else { + + // Status for a whole agent + } elseif ($layout_data['id_agent'] != 0) { $id_agent = $layout_data['id_agent']; $agent_interval = get_agent_interval ($id_agent); - $sql = sprintf ('SELECT COUNT(*) + $sql = sprintf ('SELECT MAX(estado) FROM tagente_estado, tagente_modulo WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 @@ -61,9 +66,12 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines = OR (module_interval = 0 AND utimestamp >= UNIX_TIMESTAMP() - %d))', $id_agent, $agent_interval * 2); - $status = get_db_sql ($sql); $status_parent = $status; + } else { + $status = 3; + $status_parent = 3; + $id_agent = 0; } } @@ -72,34 +80,70 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines = // Link image //index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=1 if ($status == 0) // Bad monitor - $z_index = 2; - elseif ($status == 2) // Alert $z_index = 3; + elseif ($status == 2) // Warning + $z_index = 2; + elseif ($status == 4) // Alert + $z_index = 4; else $z_index = 1; // Print BAD over good - // Draw image - echo '"; + + // Line, not implemented in editor } else if ($layout_data['type'] == 2) { $line['id'] = $layout_data['id']; $line['x'] = $layout_data['pos_x']; diff --git a/pandora_console/pandoradb_migrate_20_to_21.sql b/pandora_console/pandoradb_migrate_20_to_21.sql index 268731b31b..189a85a74c 100644 --- a/pandora_console/pandoradb_migrate_20_to_21.sql +++ b/pandora_console/pandoradb_migrate_20_to_21.sql @@ -171,9 +171,12 @@ DEFAULT '0', ADD `min_critical` DOUBLE( 18, 2 ) NOT NULL DEFAULT `min_ff_event` INT( 4 ) UNSIGNED NOT NULL DEFAULT '0'; ALTER TABLE `tusuario` CHANGE `nombre_real` `fullname` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL; + +ALTER TABLE `tusuario` CHANGE `comentarios` `comments` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL; + ALTER TABLE `tusuario` CHANGE `id_usuario` `id_user` VARCHAR( 60 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0'; ALTER TABLE `tusuario` CHANGE `fecha_registro` `last_connect` BIGINT( 20 ) NOT NULL DEFAULT '0'; ALTER TABLE `tusuario` ADD UNIQUE (`id_user`); ALTER TABLE `tusuario` ADD `registered` BIGINT( 20 ) NOT NULL DEFAULT '0' AFTER `last_connect` ; ALTER TABLE `tusuario` ADD `firstname` VARCHAR( 255 ) NOT NULL AFTER `fullname` , ADD `lastname` VARCHAR( 255 ) NOT NULL AFTER `firstname` , ADD `middlename` VARCHAR( 255 ) NOT NULL AFTER `lastname`; -ALTER TABLE `tusuario` CHANGE `direccion` `email` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL , CHANGE `telefono` `phone` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL , CHANGE `nivel` `is_admin` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0' \ No newline at end of file +ALTER TABLE `tusuario` CHANGE `direccion` `email` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL , CHANGE `telefono` `phone` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL , CHANGE `nivel` `is_admin` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0';