diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 2aa5edbfc6..5a4675163e 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,22 @@ +2009-01-21 Esteban Sanchez + + * pandoradb.sql, pandoradb_migrate_20_to_21.sql: Added id_agent field + to tlayout_data. It's needed to give support to nodes in visual + console that represents a whole agent which turns red if any module is + down. + + * operation/visual_console/render_view.php: Removed refresh countdown + and selection because it's now done in the page header. + + * include/functions_visual_map.php: Some fixes to support id_agent + field in tlayout_data. Also fixed the SQL to check if any module on an + agent is down. + + * godmode/reporting/map_builder.php: Update and insert id_agent when + managing a node element. + + * include/styles/pandora.css: Added a style to input image elements. + 2009-01-21 Esteban Sanchez * godmode/agentes/alert_manager.php: Added the hability to delete diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index d828dfa24b..07d856881e 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -139,6 +139,7 @@ if ($create_layout_data) { $layout_data_type = (string) get_parameter ("type"); $layout_data_label = (string) get_parameter ("label"); $layout_data_image = (string) get_parameter ("image"); + $layout_data_id_agent = (int) get_parameter ("agent"); $layout_data_id_agent_module = (int) get_parameter ("module"); $layout_data_label_color = (string) get_parameter ("label_color"); $layout_data_parent_item = (int) get_parameter ("parent_item"); @@ -153,6 +154,7 @@ if ($create_layout_data) { 'label_color' => $layout_data_label_color, 'image' => $layout_data_image, 'type' => $layout_data_type, + 'id_agent' => $layout_data_id_agent, 'id_agente_modulo' => $layout_data_id_agent_module, 'parent_item' => $layout_data_parent_item, 'period' => $layout_data_period * 3600, @@ -209,6 +211,7 @@ if ($update_layout_data) { $layout_data_type = (int) get_parameter ("type"); $layout_data_label = (string) get_parameter ("label"); $layout_data_image = (string) get_parameter ("image"); + $layout_data_id_agent = (int) get_parameter ("agent"); $layout_data_id_agent_module = (int) get_parameter ("module"); $layout_data_label_color = (string) get_parameter ("label_color"); $layout_data_parent_item = (int) get_parameter ("parent_item"); @@ -220,6 +223,7 @@ if ($update_layout_data) { $sql = sprintf ('UPDATE tlayout_data SET image = "%s", label = "%s", label_color = "%s", + id_agent = %d, id_agente_modulo = %d, type = %d, parent_item = %d, period = %d, id_layout_linked = %d, @@ -227,6 +231,7 @@ if ($update_layout_data) { WHERE id = %d', $layout_data_image, $layout_data_label, $layout_data_label_color, + $layout_data_id_agent, $layout_data_id_agent_module, $layout_data_type, $layout_data_parent_item, $layout_data_period * 3600, @@ -343,7 +348,7 @@ if (! $edit_layout && ! $id_layout) { /* Layout data trash */ echo '
'; echo '
'; - echo '

'.__('Map element trash').'

'; + echo '

'.__('Map element trash').'

'; echo __('Drag an element here to delete from the map'); echo ' '; print_input_hidden ('delete_layout_data', 1); diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 4201dfea56..96aec27033 100644 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -39,8 +39,8 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines = if ($layout_data['id_layout_linked'] != 0) { $status = return_status_layout ($layout_data['id_layout_linked']); } else { - $id_agent = get_db_value ("id_agente", "tagente_estado", "id_agente_modulo", $layout_data['id_agente_modulo']); 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']); @@ -49,16 +49,19 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines = else $status_parent = return_status_agent_module ($id_agent_module_parent); } else { - $interval = get_agent_interval ($id_agent); + $id_agent = $layout_data['id_agent']; + $agent_interval = get_agent_interval ($id_agent); $sql = sprintf ('SELECT COUNT(*) FROM tagente_estado, tagente_modulo WHERE tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.disabled = 0 AND tagente_modulo.id_agente = %d - AND (utimestamp >= UNIX_TIMESTAMP() - module_interval * 2 + AND ((module_interval > 0 + AND utimestamp >= UNIX_TIMESTAMP() - module_interval * 2) OR (module_interval = 0 AND utimestamp >= UNIX_TIMESTAMP() - %d))', - $id_agent, $interval * 2); + $id_agent, $agent_interval * 2); + $status = get_db_sql ($sql); $status_parent = $status; } diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index ab0a296c38..23e5452c97 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -225,9 +225,6 @@ label { th > label { padding-top: 7px; } -input:hover { - background-color: #d4dccd; -} input.chk {margin-right: 0px; border: 0px none; height: 14px; @@ -750,3 +747,6 @@ select#template, select#action { #label-checkbox-matches_value { display: inline; } +input[type=image] { + border:0px; +} diff --git a/pandora_console/operation/visual_console/render_view.php b/pandora_console/operation/visual_console/render_view.php index 872362a196..1988a98561 100644 --- a/pandora_console/operation/visual_console/render_view.php +++ b/pandora_console/operation/visual_console/render_view.php @@ -72,31 +72,6 @@ echo ''; print_pandora_visual_map ($id_layout); -$refresh_values = array (); -$refresh_values[5] = "5 ". __('Seconds'); -$refresh_values[30] = "30 ". __('Seconds'); -$refresh_values[60] = "1 ". __('minutes'); -$refresh_values[120] = "2 ". __('minutes'); -$refresh_values[300] = "5 ". __('minutes'); -$refresh_values[600] = "10 ". __('minutes'); -$refresh_values[1800] = "30 ". __('minutes'); - -$table->width = '500px'; -$table->data = array (); -$table->data[0][0] = __('Autorefresh time'); -$table->data[0][1] = print_select ($refresh_values, 'refr', $refr, '', 'N/A', 0, true); -$table->data[0][2] = print_submit_button (__('Refresh'), '', false, 'class="sub next"', true); - -echo "
"; -echo "
"; - -if ($refr) { - echo '
'; - echo '
'; -} - -echo "
"; -echo "
"; echo ''; print_input_hidden ('pure', $config["pure"]); @@ -105,18 +80,9 @@ print_table ($table); echo ""; ?> - - - diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 372494b6c4..c64ce66071 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -692,6 +692,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_data` ( `type` tinyint(1) UNSIGNED NOT NULL default 0, `period` INTEGER UNSIGNED NOT NULL default 3600, `id_agente_modulo` mediumint(8) unsigned NOT NULL default '0', + `id_agent` int(10) unsigned NOT NULL default 0, `id_layout_linked` INTEGER unsigned NOT NULL default '0', `parent_item` INTEGER UNSIGNED NOT NULL default 0, `label_color` varchar(20) DEFAULT "", diff --git a/pandora_console/pandoradb_migrate_20_to_21.sql b/pandora_console/pandoradb_migrate_20_to_21.sql index 61b9f979eb..ecdc3ba9e2 100644 --- a/pandora_console/pandoradb_migrate_20_to_21.sql +++ b/pandora_console/pandoradb_migrate_20_to_21.sql @@ -29,6 +29,8 @@ ALTER TABLE `tagente_modulo` DROP PRIMARY KEY , ADD PRIMARY KEY ALTER TABLE `tagent_access` DROP `timestamp`; +ALTER TABLE `tlayout_data` ADD `id_agent` int(10) unsigned NOT NULL default 0; + CREATE TABLE IF NOT EXISTS `talert_commands` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(100) NOT NULL default '',