diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 9c7d251ed8..53001802a4 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2011-08-13 Sancho lerena + + * pandoradb_data.sql: Added default action "Pandora FMS event". + + * godmode/alerts/alert_actions.php: Fixed bug when update an action + and name is the same. + + * godmode/snmpconsole/snmp_alert.php: Fixed witdh of field1. + 2011-08-12 Sergio Martin * include/functions_tags.php: Fixed false value in foreach diff --git a/pandora_console/godmode/alerts/alert_actions.php b/pandora_console/godmode/alerts/alert_actions.php index 077ec16bb8..fff89b787a 100644 --- a/pandora_console/godmode/alerts/alert_actions.php +++ b/pandora_console/godmode/alerts/alert_actions.php @@ -113,7 +113,7 @@ if ($create_action) { $field3 = (string) get_parameter ('field3'); $group = (string) get_parameter ('group'); $action_threshold = (int) get_parameter ('action_threshold'); - $name_check = db_get_value ('name', 'talert_actions', 'name', $name); + $name_check = db_get_value ('name', 'talert_actions', 'name', $name); if ($name_check) { $result = ''; @@ -180,10 +180,8 @@ if ($update_action) { $values['field3'] = $field3; $values['id_group'] = $group; $values['action_threshold'] = $action_threshold; - $name_check = db_get_value ('name', 'talert_actions', 'name', $name); - - if (!$name || $name_check) { + if (!$name) { $result = ''; } else { diff --git a/pandora_console/godmode/snmpconsole/snmp_alert.php b/pandora_console/godmode/snmpconsole/snmp_alert.php index 3fbad6f9de..8906ecd5f8 100644 --- a/pandora_console/godmode/snmpconsole/snmp_alert.php +++ b/pandora_console/godmode/snmpconsole/snmp_alert.php @@ -2,7 +2,7 @@ // Pandora FMS - http://pandorafms.com // ================================================== -// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas +// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas // Please see http://pandorafms.org for full contribution list // This program is free software; you can redistribute it and/or @@ -65,12 +65,8 @@ if (isset ($_GET["update_alert"]) && $_GET["update_alert"] == "-1") { 'max_alerts' => $max_alerts, 'min_alerts' => $min_alerts, 'priority' => $priority); - if (!$source_ip || !$oid) { - $result = ''; - } - else { + $result = db_process_sql_insert('talert_snmp', $values); - } if (!$result) { echo '

'.__('There was a problem creating the alert').'

'; @@ -80,19 +76,13 @@ if (isset ($_GET["update_alert"]) && $_GET["update_alert"] == "-1") { } } else { - - if (!$source_ip || !$oid) { - $result = ''; - } - else { - $sql = sprintf ("UPDATE talert_snmp SET + $sql = sprintf ("UPDATE talert_snmp SET priority = %d, id_alert = %d, al_field1 = '%s', al_field2 = '%s', al_field3 = '%s', description = '%s', agent = '%s', custom_oid = '%s', oid = '%s', time_threshold = %d, max_alerts = %d, min_alerts = %d WHERE id_as = %d", $priority, $alert_type, $al_field1, $al_field2, $al_field3, $description, $source_ip, $custom_value, $oid, $time_threshold, $max_alerts, $min_alerts, $id_as); - $result = db_process_sql ($sql); - } + $result = db_process_sql ($sql); if (!$result) { echo '

'.__('There was a problem updating the alert').'

'; @@ -210,11 +200,11 @@ if (isset ($_GET["update_alert"])) { // Alert fields echo ''.__('Field #1 (Alias, name)').''; - html_print_input_text ("al_field1", $al_field1, '', 30); + html_print_input_text ("al_field1", $al_field1, '', 50); echo ''; echo ''.__('Field #2 (Single Line)').''; - html_print_input_text ("al_field2", $al_field2, '', 30); + html_print_input_text ("al_field2", $al_field2, '', 50); echo ''; echo ''.__('Field #3 (Full Text)').''; diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index 2c231d4ea8..13c556da9a 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -400,6 +400,8 @@ INSERT INTO `talert_actions` VALUES (1,'Mail to XXX',1,'yourmail@domai INSERT INTO `talert_actions` VALUES (2,'Restart agent',10,'REFRESH AGENT','','',0,0); +INSERT INTO `talert_actions` VALUES (3,'Pandora FMS Event',3,'','','',0,0); + INSERT INTO `talert_templates` VALUES (1,'Critical condition','This is a generic alert template to fire on condition CRITICAL',1,'','','Hello, this is an automated email coming from Pandora FMS\r\n\r\nThis alert has been fired because a CRITICAL condition in one of your monitored items:\r\n\r\nAgent : _agent_\r\nModule: _module_\r\nModule description: _moduledescription_\r\nTimestamp _timestamp_\r\nCurrent value: _data_\r\n\r\nThanks for your time.\r\n\r\nBest regards\r\nPandora FMS\r\n','critical','',1,0.00,0.00,86400,1,0,'12:00:00','12:00:00',1,1,1,1,1,1,1,1,'[PANDORA] Alert RECOVERED for CRITICAL status on _agent_ / _module_','Hello, this is an automated email coming from Pandora FMS\r\n\r\nThis alert has been RECOVERED from a CRITICAL condition in one of your monitored items:\r\n\r\nAgent : _agent_\r\nModule: _module_\r\nModule description: _moduledescription_\r\nTimestamp _timestamp_\r\nCurrent value: _data_\r\n\r\nThanks for your time.\r\n\r\nBest regards\r\nPandora FMS\r\n',4,0); INSERT INTO `talert_templates` VALUES (2,'Manual alert','This is a template used to fire manual alerts, condition defined here never will be executed. Use this template to assign to your actions/commands used to do remote management (Agent restart, execute commands on server, etc).',NULL,'','','','max_min','',1,0.00,1.00,86400,1,0,'12:00:00','12:00:00',1,1,1,1,1,1,1,0,'','',1,0);