diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 711eaba368..5fa3ba95e8 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,36 @@ +2009-02-17 Sancho Lerena + + * pandoradb.sql: treport_content, changed report type to string to allow + new report types without altering DB schema. Added id_agent for supporting + reports based on agent ids. Tplugin new field for plugin type in order to + support generic Nagios plugins. + + * pandoradb_migrate_20_to_21.sql: Updated with last changes. + + * module_manager_editor_common.php: Removed some ugly labels :-) + + * reporting_builder.php: New report (Agent detailed and grouped + event/alerts). Added support to add descriptions in each block. + + * plugin.php: Support for new plugin type option. + + * config_process.php: Build update. + + * functions.php: Updated new report type. + + * functions_db.php: Added support for new report type. + + * functions_reporting.php: Fixed problem with enterprise. Added new function + to support new reports. + + * events.php: Support for grouping events. Fixed graph problem. Added quick + search link to event fulltext. + + * reporting_viewer.php: Added support for adding descriptions in each block. + Also show new report type. + + * fgraph.php: Fixed problem in event graph. + 2009-02-17 Evi Vanoost * general/login_page.php: Fixed HTML and use print_image function diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index e8498e19b4..65ff3d9d7f 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -73,7 +73,6 @@ function add_component_selection ($id_network_component_type) { $component_groups = get_network_component_groups ($id_network_component_type); $data[1] = ''; - $data[1] .= __('Group').'
'; $data[1] .= print_select ($component_groups, 'network_component_group', '', '', '--'.__('Manual setup').'--', 0, true, false, false); @@ -83,7 +82,6 @@ function add_component_selection ($id_network_component_type) { $data[1] .= __('No component was found'); $data[1] .= '
'; $data[1] .= ''; diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index fa5bc1ee89..4754955a94 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -2,7 +2,7 @@ // Pandora FMS - the Flexible Monitoring System // ============================================ -// Copyright (c) 2008 Artica Soluciones Tecnológicas, http://www.artica.es +// Copyright (c) 2009 Artica Soluciones Tecnológicas, 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 @@ -136,16 +136,18 @@ if ($add_content) { $id_agent_module = (int) get_parameter ('id_module'); $period = (int) get_parameter ('period'); $type = (string) get_parameter ('type'); + $id_agent = (int) get_parameter ('id_agent',0); $id_custom_graph = (int) get_parameter ('id_custom_graph'); + $module_description = (string) get_parameter ('module_description', ''); $order = (int) get_db_value ('COUNT(*)', 'treport_content', 'id_report', $id_report); $sql = sprintf ('INSERT INTO treport_content (id_report, id_gs, id_agent_module, - `order`, type, period) - VALUES (%d, %s, %s, %d, "%s", %d)', + `order`, type, period, description, id_agent) + VALUES (%d, %s, %s, %d, "%s", %d, "%s", %d)', $id_report, $id_custom_graph ? $id_custom_graph : "NULL", $id_agent_module ? $id_agent_module : "NULL", - $order, $type, $period * 3600); + $order, $type, $period * 3600, $module_description, $id_agent); $result = process_sql ($sql); if ($result !== false) { @@ -159,6 +161,7 @@ if ($add_content) { $sla_max = 0; $sla_min = 0; $sla_limit = 0; + $module_description = ""; } else { echo '

'.__('There was a problem creating reporting')."

"; /* Do not unset so the values are kept in the form */ @@ -334,6 +337,9 @@ if ($edit_sla_report_content) { $table->style[0] = 'font-weight: bold'; $table->data[0][0] = __('Report name'); $table->data[0][1] = print_input_text ('report_name', $report_name, '', 35, 150, true); + + $table->data[0][1] .= "  "; + $table->data[1][0] = __('Group'); if ($report_id_group) { /* Changing the group is not allowed. */ @@ -418,6 +424,10 @@ if ($edit_sla_report_content) { $table->data[4][1] = print_select_from_sql ('SELECT id_graph, name FROM tgraph', 'id_custom_graph', 0, '', '--', 0, true); + $module_description = ""; + $table->data[5][0] = __('Description'); + $table->data[5][1] = print_textarea ("module_description", 3, 35, $module_description, 'height: 50px;', true) ; + echo "
"; print_table ($table); echo '
'; @@ -470,10 +480,11 @@ if ($edit_sla_report_content) { '">'; } $data[1] = get_report_name ($report_content['type']); - $data[2] = '--'; + $data[2] = get_agent_name ($report_content['id_agent']); $data[3] = '--'; if (get_report_type_data_source ($report_content['type']) == 'module') { - $data[2] = strtolower (get_agentmodule_agent_name ($report_content['id_agent_module'])); + if ($report_content['id_agent_module'] > 0) + $data[2] = strtolower (get_agentmodule_agent_name ($report_content['id_agent_module'])); $data[3] = strtolower (get_db_value ('descripcion', 'tagente_modulo', 'id_agente_modulo', $report_content['id_agent_module'])); } $data[4] = human_time_description ($report_content['period']); @@ -597,7 +608,7 @@ function report_type_changed () { $(custom_graph_inputs).fadeIn ('normal'); }); - break; + break; case 'sla': case 'agent-group': $(module_inputs).fadeOut ('normal'); diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php index 07dd6467ab..525d905f59 100644 --- a/pandora_console/godmode/servers/plugin.php +++ b/pandora_console/godmode/servers/plugin.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 @@ -41,6 +41,8 @@ if (isset($_GET["update_plugin"])){ // if modified any parameter $plugin_net_port_opt = get_parameter ("form_net_port_opt", ""); $plugin_user_opt = get_parameter ("form_user_opt", ""); $plugin_pass_opt = get_parameter ("form_pass_opt", ""); + $plugin_plugin_type = get_parameter ("form_plugin_type", "0"); + $sql_update ="UPDATE tplugin SET name = '$plugin_name', description = '$plugin_description', @@ -49,6 +51,7 @@ if (isset($_GET["update_plugin"])){ // if modified any parameter net_dst_opt = '$plugin_net_dst_opt', net_port_opt = '$plugin_net_port_opt', user_opt = '$plugin_user_opt', + plugin_type = '$plugin_plugin_type', pass_opt = '$plugin_pass_opt' WHERE id = $plugin_id"; $result=mysql_query($sql_update); @@ -69,7 +72,9 @@ if (isset($_GET["create_plugin"])){ $plugin_net_port_opt = get_parameter ("form_net_port_opt", ""); $plugin_user_opt = get_parameter ("form_user_opt", ""); $plugin_pass_opt = get_parameter ("form_pass_opt", ""); - $sql_insert ="INSERT tplugin (name, description, max_timeout, execute, net_dst_opt, net_port_opt, user_opt, pass_opt) VALUES ('$plugin_name', '$plugin_description', '$plugin_max_timeout', '$plugin_execute', '$plugin_net_dst_opt', '$plugin_net_port_opt', '$plugin_user_opt', '$plugin_pass_opt')"; + $plugin_plugin_type = get_parameter ("form_plugin_type", "0"); + + $sql_insert ="INSERT tplugin (name, description, max_timeout, execute, net_dst_opt, net_port_opt, user_opt, pass_opt, plugin_type) VALUES ('$plugin_name', '$plugin_description', '$plugin_max_timeout', '$plugin_execute', '$plugin_net_dst_opt', '$plugin_net_port_opt', '$plugin_user_opt', '$plugin_pass_opt', $plugin_plugin_type)"; $result=mysql_query($sql_insert); if (! $result){ echo "

".__('Problem creating plugin')."

"; @@ -108,6 +113,7 @@ if ($view != ""){ $form_net_port_opt = $plugin ["net_port_opt"]; $form_user_opt = $plugin ["user_opt"]; $form_pass_opt = $plugin ["pass_opt"]; + $form_plugin_type = $plugin ["plugin_type"]; } if ($create != ""){ $form_name = ""; @@ -118,6 +124,7 @@ if ($create != ""){ $form_net_port_opt = ""; $form_user_opt = ""; $form_pass_opt = ""; + $form_plugin_type = 0; } // SHOW THE FORM @@ -150,6 +157,12 @@ if (($create != "") OR ($view != "")){ echo ''; echo ''; + echo ''.__('Plugin type'); + echo ''; + $fields[0]= __("Standard"); + $fields[1]= __("Nagios"); + print_select ($fields, "form_plugin_type", $form_plugin_type); + echo ''.__('Max.Timeout'); echo ''; echo ''; @@ -194,9 +207,10 @@ else { $sql1='SELECT * FROM tplugin ORDER BY name'; $result=mysql_query($sql1); if (mysql_num_rows($result) > 0){ - echo ''; + echo '
'; echo "
".__('Name'); - echo "".__('execute'); + echo "".__('Type'); + echo "".__('Command'); echo "".__('Delete'); $color = 0; while ($row=mysql_fetch_array($result)){ @@ -214,6 +228,11 @@ else { echo $row["name"]; echo ""; echo ""; + if ($row["plugin_type"] == 0) + echo __('Standard'); + else + echo __('Nagios'); + echo ""; echo $row["execute"]; echo ""; echo ""; @@ -223,7 +242,7 @@ else { echo '
'. __('There are no plugins in the system'); echo "
"; } - echo ""; + echo "
"; echo ""; echo ""; echo "
"; echo ""; echo ""; diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 3ae86a41e1..b45491c7d0 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. //Pandora Version -$build_version = 'PC090216'; +$build_version = 'PC090217'; $pandora_version = 'v2.1-dev'; // Next is the directory where "/attachment" directory is placed, to upload files stores. diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 6722b9d049..6267b3b193 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -715,6 +715,7 @@ function get_report_types () { $types['general_group_report'] = __('General group report'); $types['monitor_health'] = __('Monitor health'); $types['agents_detailed'] = __('Agents detailed view'); + $types['agent_detailed_event'] = __('Agent detailed event'); return $types; } @@ -756,6 +757,7 @@ function get_report_type_data_source ($type) { case 'min_value': case 10: case 'sumatory': + case 'agent_detailed_event': return 'module'; case 2: case 'custom_graph': diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 93afcee3f6..f09729083b 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -714,6 +714,30 @@ function get_group_events ($id_group, $period, $date) { return get_db_all_rows_sql ($sql); } +/** + * Get all the events happened in an Agent during a period of time. + * + * The returned events will be in the time interval ($date - $period, $date] + * + * @param int $id_agent Agent id to get events. + * @param int $period Period of time in seconds to get events. + * @param int $date Beginning date to get events. + * + * @return array An array with all the events happened. + */ +function get_agent_events ($id_agent, $period, $date) { + $datelimit = $date - $period; + + $sql = sprintf ('SELECT evento,event_type,criticity, count(*) as count_rep, max(timestamp) AS time2 + FROM tevento WHERE id_agente = %d AND utimestamp > %d AND utimestamp <=%d + GROUP BY id_agentmodule, evento ORDER BY time2 DESC', $id_agent, + $datelimit, $date); + + return get_db_all_rows_sql ($sql); +} + + + /** * Get all the monitors defined in an agent. * diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 3f1ed423e9..baf77c21f7 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -17,7 +17,9 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -require_once ("include/functions_agents.php"); +global $config; + +require_once ($config["homedir"]."/include/functions_agents.php"); /** * Get SLA of a module. @@ -254,6 +256,7 @@ function get_group_stats ($id_group) { return $data; } + /** * Get an event reporting table. * @@ -727,4 +730,54 @@ function get_agents_detailed_reporting ($id_group, $period = 0, $date = 0, $retu return $output; } + +/** + * Get a detailed report of summarized events per agent + * + * It construct a table object with all the grouped events happened in an agent + * during a period of time. + * + * @param int Agent id to get the report. + * @param int Period of time to get the report. + * @param int Beginning date of the report + * @param int Flag to return or echo the report table (echo by default). + * + * @return object A table object + */ +function get_agents_detailed_event_reporting ($id_agent, $period, $date = 0) { + if (empty ($date)) { + $date = get_system_time (); + } elseif (!is_numeric ($date)) { + $date = strtotime ($date); + } + + $table->width = '99%'; + $table->data = array (); + $table->head = array (); + $table->head[0] = __('Event name'); + $table->head[1] = __('Event type'); + $table->head[2] = __('Criticity'); + $table->head[3] = __('Count'); + $table->head[4] = __('Timestamp'); + + $events = get_agent_events ($id_agent, $period, $date); + if (empty ($events)) { + $events = array (); + } + foreach ($events as $event) { + $data = array (); + $data[0] = $event['evento']; + $data[1] = $event['event_type']; + $data[2] = get_priority_name($event['criticity']); + $data[3] = $event['count_rep']; + $data[4] = $event['time2']; + array_push ($table->data, $data); + } + + $output = print_table ($table, true); + return $output; +} + + + ?> diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 1308f61cc9..00377d2224 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -3,7 +3,7 @@ // Pandora FMS - the Flexible Monitoring System // ============================================ // Copyright (c) 2009 Artica Soluciones Tecnologicas, http://www.artica.es -// Please see http://pandora.sourceforge.net for full contribution list +// Please see http://pandorafms.org for full contribution list // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -62,7 +62,7 @@ $pagination = (int) get_parameter ("pagination", $config["block_size"]); $groups = get_user_groups ($config["id_user"], "IR"); $event_view_hr = (int) get_parameter ("event_view_hr", $config["event_view_hr"]); $id_user_ack = (int) get_parameter ("id_user_ack", 0); -$group_rep = (int) get_parameter ("group_rep", 0); +$group_rep = (int) get_parameter ("group_rep", 1); //Group selection if ($ev_group > 1 && in_array ($ev_group, array_keys ($groups))) { @@ -99,7 +99,7 @@ if ($id_user_ack != 0) $unixtime = date("U") - ($event_view_hr*60*60); $sql_post .= " AND utimestamp > $unixtime "; -$url = "index.php?sec=eventos&sec2=operation/events/events&search=$search&event_type=$event_type&severity=$severity&status=$status&ev_group=$ev_group&refr=60&id_agent=$id_agent&id_event=$id_event&pagination=$pagination"; +$url = "index.php?sec=eventos&sec2=operation/events/events&search=$search&event_type=$event_type&severity=$severity&status=$status&ev_group=$ev_group&refr=60&id_agent=$id_agent&id_event=$id_event&pagination=$pagination&group_rep=$group_rep"; echo "

".__('Events')." > ".__('Main event view'). " "; @@ -209,7 +209,10 @@ echo "

"; echo __("Repeated"); echo ""; -print_checkbox ("group_rep", 1, $group_rep, false); + +$repeated_sel[0] = __("All events"); +$repeated_sel[1] = __("Group events"); +print_select ($repeated_sel, "group_rep", $group_rep); echo "
"; @@ -233,7 +236,7 @@ echo '
 
'; if ($group_rep == 0) $sql = "SELECT * FROM tevento WHERE 1=1 ".$sql_post." ORDER BY utimestamp DESC LIMIT ".$offset.",".$pagination; else - $sql = "SELECT *, COUNT(*) AS event_rep FROM tevento WHERE 1=1 ".$sql_post." GROUP BY evento, id_agentmodule ORDER BY utimestamp DESC LIMIT ".$offset.",".$pagination; + $sql = "SELECT *, COUNT(*) AS event_rep, max(timestamp) AS timestamp_rep FROM tevento WHERE 1=1 ".$sql_post." GROUP BY evento, id_agentmodule ORDER BY timestamp_rep DESC LIMIT ".$offset.",".$pagination; $result = get_db_all_rows_sql ($sql); if ($group_rep == 0) @@ -285,7 +288,10 @@ $table->align[4] = 'center'; $table->head[5] = __('Group'); $table->align[5] = 'center'; -$table->head[6] = __('User ID'); +if ($group_rep == 0) + $table->head[6] = __('User ID'); +else + $table->head[6] = __('Rep'); $table->align[6] = 'center'; $table->head[7] = __('Timestamp'); @@ -352,15 +358,13 @@ foreach ($result as $row) { // Event description $data[2] = ''; - if (strlen ($row["evento"]) > 39) { - $data[2] .= substr ($row["evento"], 0, 37)."..."; + $data[2] .= ""; + if (strlen ($row["evento"]) > 50) { + $data[2] .= substr ($row["evento"], 0, 50)."..."; } else { $data[2] .= $row["evento"]; } - $data[2] .= ''; - - if ($group_rep == 1) - $data[2] .= " ( ".$row["event_rep"] . " ) "; + $data[2] .= ''; if ($row["event_type"] == "system") { $data[3] = __('System'); @@ -388,23 +392,24 @@ foreach ($result as $row) { $data[5] = print_group_icon ($row["id_grupo"], true); - if (!empty ($row["estado"])) { - if ($row["id_usuario"] != '0' && $row["id_usuario"] != ''){ - $data[6] = ''.substr ($row["id_usuario"],0,8).''; + if ($group_rep == 1) + $data[6] = $row["event_rep"]; + else { + if (!empty ($row["estado"])) { + if ($row["id_usuario"] != '0' && $row["id_usuario"] != ''){ + $data[6] = ''.substr ($row["id_usuario"],0,8).''; + } else { + $data[6]=__('System'); + } } else { - $data[6]=__('System'); + $data[6] = ''; } - } else { - $data[6] = ''; } - + //Time if ($group_rep == 1){ - if ($row["event_rep"] == 1) - $data[7] = print_timestamp ($row["timestamp"], true); - else - $data[7] = print_timestamp (get_db_sql ("SELECT timestamp FROM tevento WHERE id_agentmodule = ".$row["id_agentmodule"]." AND evento = '".$row["evento"]."' ORDER BY utimestamp DESC LIMIT 1"), true); + $data[7] = print_timestamp ($row['timestamp_rep'], true); } else { $data[7] = print_timestamp ($row["timestamp"], true); } @@ -430,20 +435,23 @@ foreach ($result as $row) { array_push ($table->data, $data); } -if (empty ($table->data)) { - echo '
'.__('No events').'
'; -} else { + echo ''; - print_table ($table); - echo '
'; + if (!empty ($table->data)) + print_table ($table); + if (empty ($table->data)) + echo '
'; + else + echo '
'; + if (give_acl ($config["id_user"], 0, "IW") == 1) { print_submit_button (__('Validate'), 'validate', false, 'class="sub ok"'); } if (give_acl ($config["id_user"], 0,"IM") == 1) { print_submit_button (__('Delete'), 'delete', false, 'class="sub delete"'); } - echo '
- '; - if ($config["pure"]== 0) { - echo '
'; - echo '

'.__('Status').'

'; - echo ' - '.__('Validated event'); - echo '
'; - echo ' - '.__('Not validated event'); + if (!empty ($table->data)){ + if ($config["pure"]== 0) { + echo '
'; + echo '

'.__('Status').'

'; + echo ' - '.__('Validated event'); + echo '
'; + echo ' - '.__('Not validated event'); + + echo '
'; + echo '

'.__('Action').'

'; + echo ' - '.__('Validate event'); + echo '
'; + echo ' - '.__('Delete event'); + echo '
'; + echo ' - '.__('Create incident'); + echo '
 
'; + } + } + + else + echo '
'.__('No events').'
'; - echo '
'; - echo '

'.__('Action').'

'; - echo ' - '.__('Validate event'); - echo '
'; - echo ' - '.__('Delete event'); - echo '
'; - echo ' - '.__('Create incident'); - echo '
 
'; - } -} unset ($table); ?> diff --git a/pandora_console/operation/reporting/reporting_viewer.php b/pandora_console/operation/reporting/reporting_viewer.php index e42a8cbc23..e5641f06cf 100644 --- a/pandora_console/operation/reporting/reporting_viewer.php +++ b/pandora_console/operation/reporting/reporting_viewer.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 @@ -138,6 +138,14 @@ foreach ($contents as $content) { $data[2] = '

'.human_time_description ($content['period']).'

'; array_push ($table->data, $data); + // Put description at the end of the module (if exists) + if ($content["description"] != ""){ + $table->colspan[2][0] = 4; + $data_desc = array(); + $data_desc[0] = $content["description"]; + array_push ($table->data, $data_desc); + } + $data = array (); $data[0] = ''; array_push ($table->data, $data); @@ -152,6 +160,14 @@ foreach ($contents as $content) { $data[2] = "

".human_time_description ($content['period'])."

"; array_push ($table->data, $data); + // Put description at the end of the module (if exists) + if ($content["description"] != ""){ + $table->colspan[0][0] = 4; + $data_desc = array(); + $data_desc[0] = $content["description"]; + array_push ($table->data, $data_desc); + } + $result = get_db_all_rows_field_filter ("tgraph_source", "id_graph", $content['id_gs']); $modules = array (); $weights = array (); @@ -182,11 +198,19 @@ foreach ($contents as $content) { $data[1] = '

'.human_time_description ($content['period']).'

';; $n = array_push ($table->data, $data); + // Put description at the end of the module (if exists) + if ($content["description"] != ""){ + $table->colspan[1][0] = 3; + $data_desc = array(); + $data_desc[0] = $content["description"]; + array_push ($table->data, $data_desc); + } + $slas = get_db_all_rows_field_filter ('treport_content_sla_combined', 'id_report_content', $content['id_rc']); if ($slas === false) { $data = array (); - $table->colspan[1][0] = 3; + $table->colspan[2][0] = 3; $data[0] = __('There are no SLAs defined'); array_push ($table->data, $data); $slas = array (); @@ -196,7 +220,7 @@ foreach ($contents as $content) { foreach ($slas as $sla) { $data = array (); - $table->colspan[$n][0] = 2; + $table->colspan[$n][0] = 3; $data[0] = ''.__('Agent')." : "; $data[0] .= get_agentmodule_agent_name ($sla['id_agent_module'])."
"; $data[0] .= ''.__('Module')." : "; @@ -239,14 +263,21 @@ foreach ($contents as $content) { break; case 4: case 'event_report': - $table->colspan[0][0] = 2; $id_agent = dame_agente_id ($agent_name); $data = array (); $data[0] = "

".__('Event report')."

"; $data[1] = "

".human_time_description ($content['period'])."

"; array_push ($table->data, $data); - $table->colspan[1][0] = 3; + // Put description at the end of the module (if exists) + if ($content["description"] != ""){ + $table->colspan[1][0] = 3; + $data_desc = array(); + $data_desc[0] = $content["description"]; + array_push ($table->data, $data_desc); + } + + $table->colspan[2][0] = 3; $data = array (); $table_report = event_reporting ($report['id_group'], $content['period'], $datetime, true); $table_report->class = 'databox'; @@ -263,8 +294,16 @@ foreach ($contents as $content) { $data[2] = "

".human_time_description ($content['period'])."

"; array_push ($table->data, $data); + // Put description at the end of the module (if exists) + if ($content["description"] != ""){ + $table->colspan[1][0] = 3; + $data_desc = array(); + $data_desc[0] = $content["description"]; + array_push ($table->data, $data_desc); + } + $data = array (); - $table->colspan[1][0] = 3; + $table->colspan[2][0] = 3; $data[0] = alert_reporting ($report['id_group'], $content['period'], $datetime, true); array_push ($table->data, $data); @@ -277,6 +316,14 @@ foreach ($contents as $content) { $data[2] = "

".human_time_description ($content['period'])."

"; array_push ($table->data, $data); + // Put description at the end of the module (if exists) + if ($content["description"] != ""){ + $table->colspan[1][0] = 3; + $data_desc = array(); + $data_desc[0] = $content["description"]; + array_push ($table->data, $data_desc); + } + $data = array (); $monitor_value = format_numeric (get_agent_module_sla ($content['id_agent_module'], $content['period'], 1, 1, $datetime)); $data[0] = '

'; @@ -295,8 +342,16 @@ foreach ($contents as $content) { $data[2] = "

".human_time_description ($content['period'])."

"; array_push ($table->data, $data); + // Put description at the end of the module (if exists) + if ($content["description"] != ""){ + $table->colspan[1][0] = 3; + $data_desc = array(); + $data_desc[0] = $content["description"]; + array_push ($table->data, $data_desc); + } + $data = array (); - $table->colspan[1][0] = 2; + $table->colspan[2][0] = 3; $value = format_numeric (get_agentmodule_data_average ($content['id_agent_module'], $content['period'], $datetime)); $data[0] = '

'.$value.'

'; array_push ($table->data, $data); @@ -310,8 +365,16 @@ foreach ($contents as $content) { $data[2] = "

".human_time_description ($content['period'])."

"; array_push ($table->data, $data); + // Put description at the end of the module (if exists) + if ($content["description"] != ""){ + $table->colspan[1][0] = 3; + $data_desc = array(); + $data_desc[0] = $content["description"]; + array_push ($table->data, $data_desc); + } + $data = array (); - $table->colspan[1][0] = 2; + $table->colspan[2][0] = 3; $value = format_numeric (get_agentmodule_data_max ($content['id_agent_module'], $content['period'], $datetime)); $data[0] = '

'.$value.'

'; array_push ($table->data, $data); @@ -325,6 +388,14 @@ foreach ($contents as $content) { $data[2] = "

".human_time_description ($content['period'])."

"; array_push ($table->data, $data); + // Put description at the end of the module (if exists) + if ($content["description"] != ""){ + $table->colspan[0][0] = 2; + $data_desc = array(); + $data_desc[0] = $content["description"]; + array_push ($table->data, $data_desc); + } + $data = array (); $table->colspan[1][0] = 2; $value = format_numeric (get_agentmodule_data_min ($content['id_agent_module'], $content['period'], $datetime)); @@ -340,6 +411,14 @@ foreach ($contents as $content) { $data[2] = "

".human_time_description ($content['period'])."

"; array_push ($table->data, $data); + // Put description at the end of the module (if exists) + if ($content["description"] != ""){ + $table->colspan[0][0] = 2; + $data_desc = array(); + $data_desc[0] = $content["description"]; + array_push ($table->data, $data_desc); + } + $data = array (); $table->colspan[1][0] = 2; $value = format_numeric (get_agentmodule_data_sum ($content['id_agent_module'], $content['period'], $datetime)); @@ -354,6 +433,14 @@ foreach ($contents as $content) { $data[1] = "

$group_name

"; array_push ($table->data, $data); + // Put description at the end of the module (if exists) + if ($content["description"] != ""){ + $table->colspan[0][0] = 2; + $data_desc = array(); + $data_desc[0] = $content["description"]; + array_push ($table->data, $data_desc); + } + $data = array (); $table->colspan[1][0] = 2; $data[0] = general_group_reporting ($report['id_group'], true); @@ -368,6 +455,14 @@ foreach ($contents as $content) { $data[2] = "

".human_time_description ($content['period'])."

"; array_push ($table->data, $data); + // Put description at the end of the module (if exists) + if ($content["description"] != ""){ + $table->colspan[0][0] = 4; + $data_desc = array(); + $data_desc[0] = $content["description"]; + array_push ($table->data, $data_desc); + } + $data = array (); $table->colspan[1][0] = 4; $data[0] = monitor_health_reporting ($report['id_group'], $content['period'], $datetime, true); @@ -380,15 +475,44 @@ foreach ($contents as $content) { $data[0] = "

".__('Agents detailed view')."

"; $data[1] = "

$group_name

"; array_push ($table->data, $data); - $table->colspan[0][0] = 2; + // Put description at the end of the module (if exists) + if ($content["description"] != ""){ + $table->colspan[0][0] = 2; + $data_desc = array(); + $data_desc[0] = $content["description"]; + array_push ($table->data, $data_desc); + } + + $table->colspan[0][0] = 2; $data = array (); $table->colspan[1][0] = 3; $data[0] = get_agents_detailed_reporting ($report['id_group'], $content['period'], $datetime, true); array_push ($table->data, $data); + break; + + case 'agent_detailed_event': + $data = array (); + $data[0] = "

".__('Agent detailed event')."

"; + $data[1] = "

".get_agent_name($content['id_agent'])."

"; + array_push ($table->data, $data); + // Put description at the end of the module (if exists) + if ($content["description"] != ""){ + $table->colspan[1][0] = 3; + $data_desc = array(); + $data_desc[0] = $content["description"]; + array_push ($table->data, $data_desc); + } + + $data = array (); + $table->colspan[2][0] = 3; + $data[0] = get_agents_detailed_event_reporting ($content['id_agent'], $content['period'], $datetime); + array_push ($table->data, $data); break; } + + print_table ($table); flush (); } diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 2aad030eff..447894e96d 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -698,9 +698,11 @@ CREATE TABLE IF NOT EXISTS `treport_content` ( `id_report` INTEGER UNSIGNED NOT NULL default 0, `id_gs` INTEGER UNSIGNED NULL default NULL, `id_agent_module` bigint(14) unsigned NULL default NULL, - `type` enum ('simple_graph', 'custom_graph', 'SLA', 'event_report', 'alert_report', 'monitor_report', 'avg_value', 'max_value', 'min_value', 'sumatory', 'general_group_report', 'monitor_health', 'agents_detailed') default 'simple_graph', + `type` varchar(30) default 'simple_graph', `period` int(11) NOT NULL default 0, `order` int (11) NOT NULL default 0, + `description` mediumtext, + `id_agent` int(10) unsigned NOT NULL default 0, PRIMARY KEY(`id_rc`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; @@ -759,6 +761,7 @@ CREATE TABLE IF NOT EXISTS tplugin ( `net_port_opt` varchar(50) default '', `user_opt` varchar(50) default '', `pass_opt` varchar(50) default '', + `plugin_type` int(2) UNSIGNED NOT NULL default 0, PRIMARY KEY(`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; @@ -817,7 +820,6 @@ CREATE TABLE IF NOT EXISTS `tplanned_downtime_agents` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -- tlocal_component is a repository of local modules for -- physical agents on Windows / Unix physical agents CREATE TABLE IF NOT EXISTS `tlocal_component` ( diff --git a/pandora_console/pandoradb_migrate_20_to_21.sql b/pandora_console/pandoradb_migrate_20_to_21.sql index 608c6e2aea..5aa0730a08 100644 --- a/pandora_console/pandoradb_migrate_20_to_21.sql +++ b/pandora_console/pandoradb_migrate_20_to_21.sql @@ -242,3 +242,30 @@ CREATE TABLE IF NOT EXISTS `talert_compound_actions` ( FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `tlocal_component` ( + `id` int(10) unsigned NOT NULL auto_increment, + `name` varchar(80) NOT NULL, + `data` mediumtext NOT NULL, + `description` varchar(250) default NULL, + `id_os` int(10) unsigned default '0', + `os_version` varchar(100) default '', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +CREATE TABLE IF NOT EXISTS `tlocal_component_group` ( + `id` int(10) unsigned NOT NULL auto_increment, + `name` varchar(200) NOT NULL default '', + `parent` mediumint(8) unsigned NOT NULL default '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +--Changes added 16 February 2009 + +ALTER TABLE tplugin ADD `plugin_type` int(2) UNSIGNED NOT NULL default 0; +ALTER TABLE treport_content ADD `description` mediumtext; + +ALTER TABLE treport_content MODIFY `type` varchar(30) default 'simple_graph'; +ALTER TABLE treport_content ADD `id_agent` int(10) unsigned NOT NULL default 0; + diff --git a/pandora_console/reporting/fgraph.php b/pandora_console/reporting/fgraph.php index c32fe0501b..88301b59ca 100644 --- a/pandora_console/reporting/fgraph.php +++ b/pandora_console/reporting/fgraph.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 @@ -1263,7 +1263,7 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "") { $legend = array(); $loop = 0; - $badstrings = array (";", "SELECT ", "DELETE ", "UPDATE ", "INSERT "); + $badstrings = array (";", "SELECT ", "DELETE ", "UPDATE ", "INSERT ", "EXEC"); $url = str_ireplace ($badstrings,"",$url); //remove bad strings from the query so queries like ; DELETE FROM don't pass //This will give the distinct id_agente, give the id_grupo that goes @@ -1284,9 +1284,9 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "") { $legend[5] = __('Other')." (".$data[5].")"; } else { if ($row["id_agente"] == 0) { - $legend = __('SYSTEM')." (".$row["count"].")"; + $legend[0] = __('SYSTEM')." (".$row["count"].")"; } else { - $legend[] = mb_substr (get_agent_name ($row["id_agente"], "lower"), 0, 14)." (".$row["count"].")"; + $legend[] = mb_substr (get_agent_name ($row["id_agente"], "lower"), 0, 14)." (".$row["count"].")"; } $data[] = $row["count"]; }