2010-02-25 Sancho Lerena <slerena@artica.es>

* 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.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2425 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2010-02-25 18:48:36 +00:00
parent 56d11dd57c
commit 70b343f9c3
6 changed files with 85 additions and 45 deletions

View File

@ -1,3 +1,18 @@
2010-02-25 Sancho Lerena <slerena@artica.es>
* 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 <miguel.dedios@artica.es> 2010-02-25 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/agent_manager.php: fix dinamic show icon when change * godmode/agentes/agent_manager.php: fix dinamic show icon when change

View File

@ -256,3 +256,5 @@ CREATE TABLE IF NOT EXISTS `tagente_datos_log4x` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE talert_templates MODIFY `type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical', 'onchange');

View File

@ -412,7 +412,10 @@ foreach ($simple_alerts as $alert) {
$data[3] = ' <a class="template_details" $data[3] = ' <a class="template_details"
href="ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$alert['id_alert_template'].'"> href="ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$alert['id_alert_template'].'">
<img id="template-details-'.$alert['id_alert_template'].'" class="img_help" src="images/zoom.png"/></a> '; <img id="template-details-'.$alert['id_alert_template'].'" class="img_help" src="images/zoom.png"/></a> ';
$data[3] .= "<a href='index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template&id=".$alert['id_alert_template']."'>";
$data[3] .= get_alert_template_name ($alert['id_alert_template']); $data[3] .= get_alert_template_name ($alert['id_alert_template']);
$data[3] .= "</a>";
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
$policyInfo = isAlertInPolicy($alert['id_agent_module'], $alert['id_alert_template'], false); $policyInfo = isAlertInPolicy($alert['id_agent_module'], $alert['id_alert_template'], false);
@ -428,6 +431,16 @@ foreach ($simple_alerts as $alert) {
} }
$actions = get_alert_agent_module_actions ($alert['id']); $actions = get_alert_agent_module_actions ($alert['id']);
if (empty($actions)){
// Get and show default actions for this alert
$default_action = get_db_sql ("SELECT id_alert_action FROM talert_templates WHERE id = ".$alert["id_alert_template"]);
if ($default_action != ""){
$data[5] = __("Default"). " : ".get_db_sql ("SELECT name FROM talert_actions WHERE id = $default_action");
}
} else {
$data[5] = '<ul class="action_list">'; $data[5] = '<ul class="action_list">';
foreach ($actions as $action_id => $action) { foreach ($actions as $action_id => $action) {
$data[5] .= '<li><div>'; $data[5] .= '<li><div>';
@ -463,6 +476,8 @@ foreach ($simple_alerts as $alert) {
$data[5] .= '</div></li>'; $data[5] .= '</div></li>';
} }
$data[5] .= '</ul>'; $data[5] .= '</ul>';
}
$data[5] .= '<a class="add_action" id="add-action-'.$alert['id'].'" href="#">'; $data[5] .= '<a class="add_action" id="add-action-'.$alert['id'].'" href="#">';
$data[5] .= print_image ('images/add.png', true); $data[5] .= print_image ('images/add.png', true);

View File

@ -199,6 +199,7 @@ function get_alert_templates_types () {
$types['not_equal'] = __('Not equal to'); $types['not_equal'] = __('Not equal to');
$types['warning'] = __('Warning status'); $types['warning'] = __('Warning status');
$types['critical'] = __('Critical status'); $types['critical'] = __('Critical status');
$types['onchange'] = __('On Change');
return $types; 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', return get_db_all_rows_filter ('tagente, tagente_modulo, talert_template_modules',
$filter, $fields); $filter, $fields);
} }
?> ?>

View File

@ -375,17 +375,22 @@ function format_alert_row ($alert, $compound = false, $agent = true, $url = '')
$data[$index['description']] .= $disabledHtmlStart . mb_substr (safe_input ($description), 0, 35) . $disabledHtmlEnd; $data[$index['description']] .= $disabledHtmlStart . mb_substr (safe_input ($description), 0, 35) . $disabledHtmlEnd;
$actions = get_alert_agent_module_actions ($alert['id'], false, $compound); $actions = get_alert_agent_module_actions ($alert['id'], false, $compound);
$actionText = '<ul>';
if (!empty($actions)){
$actionText = '<ul class="action_list">';
foreach ($actions as $action) { foreach ($actions as $action) {
$defaultTagIni = $defaultTagEnd = ''; $actionText .= '<li><div><span class="action_name">' . $action['name'];
if ($action['id'] == $actionDefault) { if ($action["fires_min"] != $action["fires_max"]){
$defaultTagIni = '<i>'; $actionText .= " (".$action["fires_min"] . " / ". $action["fires_max"] . ")";
$defaultTagEnd = ' (' . __('default') . ') </i>';
} }
$actionText .= '<li>' . $defaultTagIni . $action['name'] . $actionText .= '</li></span><br></div>';
$defaultTagEnd . '</li>'; }
$actionText .= '</div></ul>';
}
else {
if ($actionDefault != "")
$actionText = get_db_sql ("SELECT name FROM talert_actions WHERE id = $actionDefault"). " <i>(".__("Default") . ")</i>";
} }
$actionText .= '</ul>';
$data[$index['action']] = $actionText; $data[$index['action']] = $actionText;

View File

@ -247,7 +247,7 @@ CREATE TABLE IF NOT EXISTS `talert_templates` (
`field1` varchar(255) default '', `field1` varchar(255) default '',
`field2` varchar(255) default '', `field2` varchar(255) default '',
`field3` mediumtext NOT NULL, `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 '', `value` varchar(255) default '',
`matches_value` tinyint(1) default 0, `matches_value` tinyint(1) default 0,
`max_value` double(18,2) default NULL, `max_value` double(18,2) default NULL,
@ -628,7 +628,7 @@ CREATE TABLE IF NOT EXISTS `tserver` (
KEY `name` (`name`), KEY `name` (`name`),
KEY `keepalive` (`keepalive`), KEY `keepalive` (`keepalive`),
KEY `status` (`status`) KEY `status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- server types: -- server types:
-- 0 data -- 0 data