diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 9baa55c945..f08fce3adf 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,18 @@ +2010-02-25 Sancho Lerena + + * include/functions_ui.php: Alert information now show the default + actions properly,and the action conditions (max/min). + + * include/functions_alerts.php: Added support on get_alert_templates_types + for new alert type "onchange". + + * pandoradb.sql + * extras/pandoradb_migrate_v3.0_to_v3.1.sql: Added new support for alert + type "onchange". + + * godmode/alerts/alert_list.php: Alert information now shows the default + action (if exist) and have a link to edit the template directly from here. + 2010-02-25 Miguel de Dios * godmode/agentes/agent_manager.php: fix dinamic show icon when change diff --git a/pandora_console/extras/pandoradb_migrate_v3.0_to_v3.1.sql b/pandora_console/extras/pandoradb_migrate_v3.0_to_v3.1.sql index 63a5d24b5e..7550f62532 100644 --- a/pandora_console/extras/pandoradb_migrate_v3.0_to_v3.1.sql +++ b/pandora_console/extras/pandoradb_migrate_v3.0_to_v3.1.sql @@ -256,3 +256,5 @@ CREATE TABLE IF NOT EXISTS `tagente_datos_log4x` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +ALTER TABLE talert_templates MODIFY `type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical', 'onchange'); diff --git a/pandora_console/godmode/alerts/alert_list.php b/pandora_console/godmode/alerts/alert_list.php index 2bf07f5ae6..3811b4a7d2 100644 --- a/pandora_console/godmode/alerts/alert_list.php +++ b/pandora_console/godmode/alerts/alert_list.php @@ -412,7 +412,10 @@ foreach ($simple_alerts as $alert) { $data[3] = ' '; + + $data[3] .= ""; $data[3] .= get_alert_template_name ($alert['id_alert_template']); + $data[3] .= ""; if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { $policyInfo = isAlertInPolicy($alert['id_agent_module'], $alert['id_alert_template'], false); @@ -428,41 +431,53 @@ foreach ($simple_alerts as $alert) { } $actions = get_alert_agent_module_actions ($alert['id']); - $data[5] = ''; } - $data[5] .= ''; + $data[5] .= ''; $data[5] .= print_image ('images/add.png', true); diff --git a/pandora_console/include/functions_alerts.php b/pandora_console/include/functions_alerts.php index ce89d3994d..cbbf8e9dff 100644 --- a/pandora_console/include/functions_alerts.php +++ b/pandora_console/include/functions_alerts.php @@ -199,7 +199,8 @@ function get_alert_templates_types () { $types['not_equal'] = __('Not equal to'); $types['warning'] = __('Warning status'); $types['critical'] = __('Critical status'); - + $types['onchange'] = __('On Change'); + return $types; } @@ -834,4 +835,6 @@ function get_agents_with_alert_template ($id_alert_template, $id_group, $filter return get_db_all_rows_filter ('tagente, tagente_modulo, talert_template_modules', $filter, $fields); } + + ?> diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index d0cc05467d..c0e0942563 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -375,18 +375,23 @@ function format_alert_row ($alert, $compound = false, $agent = true, $url = '') $data[$index['description']] .= $disabledHtmlStart . mb_substr (safe_input ($description), 0, 35) . $disabledHtmlEnd; $actions = get_alert_agent_module_actions ($alert['id'], false, $compound); - $actionText = '
    '; - foreach ($actions as $action) { - $defaultTagIni = $defaultTagEnd = ''; - if ($action['id'] == $actionDefault) { - $defaultTagIni = ''; - $defaultTagEnd = ' (' . __('default') . ') '; + + if (!empty($actions)){ + $actionText = '
      '; + foreach ($actions as $action) { + $actionText .= '
    • ' . $action['name']; + if ($action["fires_min"] != $action["fires_max"]){ + $actionText .= " (".$action["fires_min"] . " / ". $action["fires_max"] . ")"; + } + $actionText .= '

    • '; } - $actionText .= '
    • ' . $defaultTagIni . $action['name'] . - $defaultTagEnd . '
    • '; + $actionText .= '
    '; } - $actionText .= '
'; - + else { + if ($actionDefault != "") + $actionText = get_db_sql ("SELECT name FROM talert_actions WHERE id = $actionDefault"). " (".__("Default") . ")"; + } + $data[$index['action']] = $actionText; $data[$index['last_fired']] = $disabledHtmlStart . print_timestamp ($alert["last_fired"], true) . $disabledHtmlEnd; diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 202b0fe8d0..91cac05cfb 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -247,7 +247,7 @@ CREATE TABLE IF NOT EXISTS `talert_templates` ( `field1` varchar(255) default '', `field2` varchar(255) default '', `field3` mediumtext NOT NULL, - `type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical'), + `type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical', 'onchange'), `value` varchar(255) default '', `matches_value` tinyint(1) default 0, `max_value` double(18,2) default NULL, @@ -628,7 +628,7 @@ CREATE TABLE IF NOT EXISTS `tserver` ( KEY `name` (`name`), KEY `keepalive` (`keepalive`), KEY `status` (`status`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- server types: -- 0 data