Added new fields to alert macros (snmp as well). Ticket #233

This commit is contained in:
Arturo Gonzalez 2017-02-07 10:41:48 +01:00
parent 3e0b0f231b
commit 1f1023db92
11 changed files with 269 additions and 19 deletions

View File

@ -76,6 +76,24 @@ ALTER TABLE talert_templates ADD COLUMN `field13_recovery` TEXT NOT NULL DEFAULT
ALTER TABLE talert_templates ADD COLUMN `field14_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT "";
-- ---------------------------------------------------------------------
-- Table `talert_snmp`
-- ---------------------------------------------------------------------
ALTER TABLE talert_snmp ADD COLUMN `al_field11` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN `al_field12` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN `al_field13` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN `al_field14` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN `al_field15` TEXT NOT NULL DEFAULT "";
-- ---------------------------------------------------------------------
-- Table `talert_snmp_action`
-- ---------------------------------------------------------------------
ALTER TABLE talert_snmp_action ADD COLUMN `al_field11` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN `al_field12` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN `al_field13` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN `al_field14` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN `al_field15` TEXT NOT NULL DEFAULT "";
-- ----------------------------------------------------------------------
-- Table `tserver`
-- ----------------------------------------------------------------------
@ -99,6 +117,16 @@ UPDATE talert_actions SET `field4` = 'integria',
`field9` = 'admin',
`field10` = '_alert_description_'
WHERE `id` = 4 AND `id_alert_command` = 11;
ALTER TABLE talert_actions ADD COLUMN `field11` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN `field12` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN `field13` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN `field14` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN `field15` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN `field11_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN `field12_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN `field13_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN `field14_recovery` TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT "";
-- ---------------------------------------------------------------------
-- Table `talert_commands`

View File

@ -14,6 +14,24 @@ ALTER TABLE talert_templates ADD COLUMN field13_recovery CLOB DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN field14_recovery CLOB DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN field15_recovery CLOB DEFAULT "";
-- ---------------------------------------------------------------------
-- Table `talert_snmp`
-- ---------------------------------------------------------------------
ALTER TABLE talert_snmp ADD COLUMN al_field11 CLOB DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN al_field12 CLOB DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN al_field13 CLOB DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN al_field14 CLOB DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN al_field15 CLOB DEFAULT "";
-- ---------------------------------------------------------------------
-- Table `talert_snmp_action`
-- ---------------------------------------------------------------------
ALTER TABLE talert_snmp_action ADD COLUMN al_field11 CLOB DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN al_field12 CLOB DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN al_field13 CLOB DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN al_field14 CLOB DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN al_field15 CLOB DEFAULT "";
-- ----------------------------------------------------------------------
-- Table `tserver`
-- ----------------------------------------------------------------------
@ -38,6 +56,16 @@ UPDATE talert_actions SET field4 = 'integria',
field9 = 'admin',
field10 = '_alert_description_'
WHERE id = 4 AND id_alert_command = 11;
ALTER TABLE talert_actions ADD COLUMN field11 CLOB DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field12 CLOB DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field13 CLOB DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field14 CLOB DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field15 CLOB DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field11_recovery CLOB DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field12_recovery CLOB DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field13_recovery CLOB DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field14_recovery CLOB DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field15_recovery CLOB DEFAULT "";
-- ---------------------------------------------------------------------
-- Table `talert_commands`

View File

@ -54,3 +54,35 @@ ALTER TABLE talert_templates ADD COLUMN field12_recovery TEXT NOT NULL DEFAULT "
ALTER TABLE talert_templates ADD COLUMN field13_recovery TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN field14_recovery TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_templates ADD COLUMN field15_recovery TEXT NOT NULL DEFAULT "";
-- ---------------------------------------------------------------------
-- Table `talert_snmp`
-- ---------------------------------------------------------------------
ALTER TABLE talert_snmp ADD COLUMN al_field11 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN al_field12 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN al_field13 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN al_field14 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp ADD COLUMN al_field15 TEXT NOT NULL DEFAULT "";
-- ---------------------------------------------------------------------
-- Table `talert_snmp_action`
-- ---------------------------------------------------------------------
ALTER TABLE talert_snmp_action ADD COLUMN al_field11 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN al_field12 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN al_field13 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN al_field14 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_snmp_action ADD COLUMN al_field15 TEXT NOT NULL DEFAULT "";
-- ---------------------------------------------------------------------
-- Table `talert_actions`
-- ---------------------------------------------------------------------
ALTER TABLE talert_actions ADD COLUMN field11 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field12 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field13 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field14 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field15 TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field11_recovery TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field12_recovery TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field13_recovery TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field14_recovery TEXT NOT NULL DEFAULT "";
ALTER TABLE talert_actions ADD COLUMN field15_recovery TEXT NOT NULL DEFAULT "";

View File

@ -149,7 +149,7 @@ if ($create_action) {
$fields_values = array();
$info_fields = '';
$values = array();
for($i=1;$i<=10;$i++) {
for($i=1;$i<=$config['max_macro_fields'];$i++) {
$values['field'.$i] = (string) get_parameter ('field'.$i.'_value');
$info_fields .= ' Field'.$i.': ' . $values['field'.$i];
$values['field'.$i.'_recovery'] = (string) get_parameter ('field'.$i.'_recovery_value');
@ -228,7 +228,7 @@ if ($update_action) {
$info_fields = '';
$values = array();
for ($i = 1; $i <= 10; $i++) {
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$values['field'.$i] = (string) get_parameter ('field'.$i.'_value');
$info_fields .= ' Field1: ' . $values['field'.$i];
$values['field'.$i.'_recovery'] = (string) get_parameter ('field'.$i.'_recovery_value');

View File

@ -89,7 +89,7 @@ if (is_ajax ()) {
}
$fields_rows = array();
for ($i = 1; $i <= 10; $i++) {
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
if (($i == 5) && ($command['id'] == 3)){
continue;
@ -260,7 +260,7 @@ if ($create_command) {
$fields_values = array();
$info_fields = '';
$values = array();
for ($i=1;$i<=10;$i++) {
for ($i=1;$i<=$config['max_macro_fields'];$i++) {
$fields_descriptions[] = (string) get_parameter ('field'.$i.'_description');
$fields_values[] = (string) get_parameter ('field'.$i.'_values');
$info_fields .= ' Field'.$i.': ' . $fields_values[$i - 1];

View File

@ -157,7 +157,7 @@ $table->data[5][2] = html_print_textarea ('command_recovery_preview', 5, 30, '',
'disabled="disabled"', true);
$row = 6;
for ($i = 1; $i <= 10; $i++) {
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
$table->data['field' . $i][0] = html_print_image(
'images/spinner.gif', true);
$table->data['field' . $i][1] = html_print_image(
@ -273,8 +273,8 @@ $(document).ready (function () {
command_description = js_html_entity_decode (data["description"]);
render_command_description(command_description);
for (i = 1; i <= 10; i++) {
var max_fields = parseInt('<?php echo $config["max_macro_fields"]; ?>');
for (i = 1; i <= max_fields; i++) {
var old_value = '';
var old_recovery_value = '';
var field_row = data["fields_rows"][i];

View File

@ -58,6 +58,11 @@ if ($add_action) {
$values[db_escape_key_identifier('al_field8')] = get_parameter('field8_value');
$values[db_escape_key_identifier('al_field9')] = get_parameter('field9_value');
$values[db_escape_key_identifier('al_field10')] = get_parameter('field10_value');
$values[db_escape_key_identifier('al_field11')] = get_parameter('field11_value');
$values[db_escape_key_identifier('al_field12')] = get_parameter('field12_value');
$values[db_escape_key_identifier('al_field13')] = get_parameter('field13_value');
$values[db_escape_key_identifier('al_field14')] = get_parameter('field14_value');
$values[db_escape_key_identifier('al_field15')] = get_parameter('field15_value');
$result = db_process_sql_insert('talert_snmp_action', $values);
}
@ -102,6 +107,11 @@ if ($save_alert || $modify_alert) {
$al_field8 = (string) get_parameter_post ("field8_value");
$al_field9 = (string) get_parameter_post ("field9_value");
$al_field10 = (string) get_parameter_post ("al_field10");
$al_field11 = (string) get_parameter_post ("field11_value");
$al_field12 = (string) get_parameter_post ("field12_value");
$al_field13 = (string) get_parameter_post ("field13_value");
$al_field14 = (string) get_parameter_post ("field14_value");
$al_field15 = (string) get_parameter_post ("field15_value");
$max_alerts = (int) get_parameter_post ("max_alerts", 1);
$min_alerts = (int) get_parameter_post ("min_alerts", 0);
$priority = (int) get_parameter_post ("priority", 0);
@ -168,6 +178,11 @@ if ($save_alert || $modify_alert) {
'al_field8' => $al_field8,
'al_field9' => $al_field9,
'al_field10' => $al_field10,
'al_field11' => $al_field11,
'al_field12' => $al_field12,
'al_field13' => $al_field13,
'al_field14' => $al_field14,
'al_field15' => $al_field15,
'description' => $description,
'agent' => $source_ip,
'custom_oid' => $custom_value,
@ -239,6 +254,8 @@ if ($save_alert || $modify_alert) {
al_field2 = '%s', al_field3 = '%s', al_field4 = '%s',
al_field5 = '%s', al_field6 = '%s',al_field7 = '%s',
al_field8 = '%s', al_field9 = '%s',al_field10 = '%s',
al_field11 = '%s', al_field12 = '%s', al_field13 = '%s',
al_field14 = '%s', al_field15 = '%s',
description = '%s',
agent = '%s', custom_oid = '%s', oid = '%s',
time_threshold = %d, max_alerts = %d, min_alerts = %d,
@ -274,7 +291,8 @@ if ($save_alert || $modify_alert) {
WHERE id_as = %d",
$priority, $alert_type, $al_field1, $al_field2, $al_field3,
$al_field4, $al_field5, $al_field6, $al_field7, $al_field8,
$al_field9, $al_field10,
$al_field9, $al_field10, $al_field11, $al_field12, $al_field13,
$al_field14, $al_field15,
$description, $source_ip, $custom_value, $oid, $time_threshold,
$max_alerts, $min_alerts, $custom_oid_data_1, $custom_oid_data_2,
$custom_oid_data_3, $custom_oid_data_4, $custom_oid_data_5,
@ -329,6 +347,11 @@ if ($update_alert || $duplicate_alert) {
$al_field8 = $alert["al_field8"];
$al_field9 = $alert["al_field9"];
$al_field10 = $alert["al_field10"];
$al_field11 = $alert["al_field11"];
$al_field12 = $alert["al_field12"];
$al_field13 = $alert["al_field13"];
$al_field14 = $alert["al_field14"];
$al_field15 = $alert["al_field15"];
$max_alerts = $alert["max_alerts"];
$min_alerts = $alert["min_alerts"];
$priority = $alert["priority"];
@ -396,6 +419,11 @@ elseif ($create_alert) {
$al_field8 = "";
$al_field9 = "";
$al_field10 = "";
$al_field11 = "";
$al_field12 = "";
$al_field13 = "";
$al_field14 = "";
$al_field15 = "";
$max_alerts = 1;
$min_alerts = 0;
$priority = 0;
@ -450,8 +478,9 @@ if($duplicate_alert){
$sql = sprintf ("insert into talert_snmp (
id_alert, al_field1, al_field2, al_field3,
al_field4, al_field5, al_field6, al_field7,
al_field8, al_field9, al_field10, description,
agent, custom_oid, oid, time_threshold,
al_field8, al_field9, al_field10, al_field11,
al_field12, al_field13, al_field14, al_field15,
description, agent, custom_oid, oid, time_threshold,
times_fired, last_fired, max_alerts, min_alerts,
internal_counter, priority,
".db_escape_key_identifier('_snmp_f1_') .",
@ -486,6 +515,7 @@ if($duplicate_alert){
'%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')",
$id_alert, $al_field1, $al_field2, $al_field3, $al_field4, $al_field5,
$al_field6, $al_field7, $al_field8, $al_field9, $al_field10,
$al_field11, $al_field12, $al_field13, $al_field14, $al_field15,
$description, $source_ip, $custom_value, $oid, $time_threshold,
$times_fired, $last_fired, $max_alerts, $min_alerts, $internal_counter,
$priority, $custom_oid_data_1, $custom_oid_data_2, $custom_oid_data_3,
@ -860,12 +890,17 @@ if ($create_alert || $update_alert) {
'al_field7' => $al_field7,
'al_field8' => $al_field8,
'al_field9' => $al_field9,
'al_field10' => $al_field10);
'al_field10' => $al_field10,
'al_field11' => $al_field11,
'al_field12' => $al_field12,
'al_field13' => $al_field13,
'al_field14' => $al_field14,
'al_field15' => $al_field15);
// Hidden div with help hint to fill with javascript
html_print_div(array('id' => 'help_snmp_alert_hint', 'content' => ui_print_help_icon ("snmp_alert_field1", true), 'hidden' => true));
for ($i = 1; $i <= 10; $i++) {
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
echo '<tr id="table_macros-field'.$i.'"><td class="datos" valign="top">'.html_print_image('images/spinner.gif',true);
echo '<td class="datos">' . html_print_image('images/spinner.gif',true);
html_print_input_hidden('field'.$i.'_value', isset($al['al_field'.$i]) ? $al['al_field'.$i] : '');
@ -1260,9 +1295,14 @@ else {
'al_field7' => $al_field7,
'al_field8' => $al_field8,
'al_field9' => $al_field9,
'al_field10' => $al_field10);
'al_field10' => $al_field10,
'al_field11' => $al_field11,
'al_field12' => $al_field12,
'al_field13' => $al_field13,
'al_field14' => $al_field14,
'al_field15' => $al_field15);
for ($i = 1; $i <= 10; $i++) {
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
echo '<tr id="table_macros-field'.$i.'"><td class="datos" valign="top">'.html_print_image('images/spinner.gif',true);
echo '<td class="datos">' . html_print_image('images/spinner.gif',true);
html_print_input_hidden('field'.$i.'_value', isset($al['al_field'.$i]) ? $al['al_field'.$i] : '');
@ -1360,9 +1400,11 @@ $(document).ready (function () {
?>,
values,
function (data, status) {
var max_fields = parseInt('<?php echo $config["max_macro_fields"]; ?>');
original_command = js_html_entity_decode (data["command"]);
command_description = js_html_entity_decode (data["description"]);
for (i = 1; i <= 10; i++) {
for (i = 1; i <= max_fields; i++) {
var old_value = '';
// Only keep the value if is provided from hidden (first time)

View File

@ -330,6 +330,11 @@ CREATE TABLE talert_snmp (
al_field8 CLOB DEFAULT '',
al_field9 CLOB DEFAULT '',
al_field10 CLOB DEFAULT '',
al_field11 CLOB DEFAULT '',
al_field12 CLOB DEFAULT '',
al_field13 CLOB DEFAULT '',
al_field14 CLOB DEFAULT '',
al_field15 CLOB DEFAULT '',
description VARCHAR2(255) DEFAULT '',
alert_type NUMBER(5, 0) DEFAULT 0,
agent VARCHAR2(100) DEFAULT '',
@ -424,6 +429,11 @@ CREATE TABLE talert_actions (
field8 CLOB DEFAULT '',
field9 CLOB DEFAULT '',
field10 CLOB DEFAULT '',
field11 CLOB DEFAULT '',
field12 CLOB DEFAULT '',
field13 CLOB DEFAULT '',
field14 CLOB DEFAULT '',
field15 CLOB DEFAULT '',
id_group NUMBER(19, 0) DEFAULT 0,
action_threshold NUMBER(19, 0) DEFAULT 0,
field1_recovery CLOB DEFAULT '',
@ -435,7 +445,12 @@ CREATE TABLE talert_actions (
field7_recovery CLOB DEFAULT '',
field8_recovery CLOB DEFAULT '',
field9_recovery CLOB DEFAULT '',
field10_recovery CLOB DEFAULT ''
field10_recovery CLOB DEFAULT '',
field11_recovery CLOB DEFAULT '',
field12_recovery CLOB DEFAULT '',
field13_recovery CLOB DEFAULT '',
field14_recovery CLOB DEFAULT '',
field15_recovery CLOB DEFAULT '',
);
CREATE SEQUENCE talert_actions_s INCREMENT BY 1 START WITH 1;
@ -2069,7 +2084,12 @@ CREATE TABLE talert_snmp_action (
al_field7 CLOB DEFAULT '',
al_field8 CLOB DEFAULT '',
al_field9 CLOB DEFAULT '',
al_field10 CLOB DEFAULT ''
al_field10 CLOB DEFAULT '',
al_field11 CLOB DEFAULT '',
al_field12 CLOB DEFAULT '',
al_field13 CLOB DEFAULT '',
al_field14 CLOB DEFAULT '',
al_field15 CLOB DEFAULT ''
);
CREATE SEQUENCE talert_snmp_action_s INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER talert_snmp_action_inc BEFORE INSERT ON talert_snmp_action REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT talert_snmp_action_s.nextval INTO :NEW.id FROM dual; END;;

View File

@ -280,6 +280,11 @@ CREATE TABLE "talert_snmp" (
"al_field8" text NOT NULL default '',
"al_field9" text NOT NULL default '',
"al_field10" text NOT NULL default '',
"al_field11" text NOT NULL default '',
"al_field12" text NOT NULL default '',
"al_field13" text NOT NULL default '',
"al_field14" text NOT NULL default '',
"al_field15" text NOT NULL default '',
"description" varchar(255) default '',
"alert_type" SMALLINT NOT NULL default 0,
"agent" varchar(100) default '',
@ -362,6 +367,11 @@ CREATE TABLE "talert_actions" (
"field8" text NOT NULL default '',
"field9" text NOT NULL default '',
"field10" text NOT NULL default '',
"field11" text NOT NULL default '',
"field12" text NOT NULL default '',
"field13" text NOT NULL default '',
"field14" text NOT NULL default '',
"field15" text NOT NULL default '',
"id_group" BIGINT NOT NULL default 0,
"action_threshold" BIGINT NOT NULL default 0,
"field1_recovery" text NOT NULL default '',
@ -373,7 +383,12 @@ CREATE TABLE "talert_actions" (
"field7_recovery" text NOT NULL default '',
"field8_recovery" text NOT NULL default '',
"field9_recovery" text NOT NULL default '',
"field10_recovery" text NOT NULL default ''
"field10_recovery" text NOT NULL default '',
"field11_recovery" text NOT NULL default '',
"field12_recovery" text NOT NULL default '',
"field13_recovery" text NOT NULL default '',
"field14_recovery" text NOT NULL default '',
"field15_recovery" text NOT NULL default '',
);
CREATE TYPE type_talert_templates_alert_template AS ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical', 'onchange', 'unknown', 'always');
@ -1735,7 +1750,12 @@ CREATE TABLE "talert_snmp_action" (
"al_field7" TEXT default '',
"al_field8" TEXT default '',
"al_field9" TEXT default '',
"al_field10" TEXT default ''
"al_field10" TEXT default '',
"al_field11" TEXT default '',
"al_field12" TEXT default '',
"al_field13" TEXT default '',
"al_field14" TEXT default '',
"al_field15" TEXT default '',
);
-- ---------------------------------------------------------------------

View File

@ -290,6 +290,11 @@ CREATE TABLE IF NOT EXISTS `talert_snmp` (
`al_field8` text NOT NULL,
`al_field9` text NOT NULL,
`al_field10` text NOT NULL,
`al_field11` text NOT NULL,
`al_field12` text NOT NULL,
`al_field13` text NOT NULL,
`al_field14` text NOT NULL,
`al_field15` text NOT NULL,
`description` varchar(255) default '',
`alert_type` int(2) unsigned NOT NULL default '0',
`agent` varchar(100) default '',
@ -380,6 +385,11 @@ CREATE TABLE IF NOT EXISTS `talert_actions` (
`field8` text NOT NULL,
`field9` text NOT NULL,
`field10` text NOT NULL,
`field11` text NOT NULL,
`field12` text NOT NULL,
`field13` text NOT NULL,
`field14` text NOT NULL,
`field15` text NOT NULL,
`id_group` mediumint(8) unsigned NULL default 0,
`action_threshold` int(10) NOT NULL default '0',
`field1_recovery` text NOT NULL,
@ -392,6 +402,11 @@ CREATE TABLE IF NOT EXISTS `talert_actions` (
`field8_recovery` text NOT NULL,
`field9_recovery` text NOT NULL,
`field10_recovery` text NOT NULL,
`field11_recovery` text NOT NULL,
`field12_recovery` text NOT NULL,
`field13_recovery` text NOT NULL,
`field14_recovery` text NOT NULL,
`field15_recovery` text NOT NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (`id_alert_command`) REFERENCES talert_commands(`id`)
ON DELETE CASCADE ON UPDATE CASCADE
@ -1845,6 +1860,11 @@ CREATE TABLE IF NOT EXISTS `talert_snmp_action` (
`al_field8` text NOT NULL,
`al_field9` text NOT NULL,
`al_field10` text NOT NULL,
`al_field11` text NOT NULL,
`al_field12` text NOT NULL,
`al_field13` text NOT NULL,
`al_field14` text NOT NULL,
`al_field15` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -837,6 +837,11 @@ sub pandora_execute_action ($$$$$$$$$;$) {
$field8 = $action->{'field8'} ? $action->{'field8'} : $alert->{'field8'};
$field9 = $action->{'field9'} ? $action->{'field9'} : $alert->{'field9'};
$field10 = $action->{'field10'} ? $action->{'field10'} : $alert->{'field10'};
$field11 = $action->{'field11'} ? $action->{'field11'} : $alert->{'field11'};
$field12 = $action->{'field12'} ? $action->{'field12'} : $alert->{'field12'};
$field13 = $action->{'field13'} ? $action->{'field13'} : $alert->{'field13'};
$field14 = $action->{'field14'} ? $action->{'field14'} : $alert->{'field14'};
$field15 = $action->{'field15'} ? $action->{'field15'} : $alert->{'field15'};
}
else {
$field1 = $alert->{'field1'} ? $alert->{'field1'} : $action->{'field1'};
@ -849,6 +854,11 @@ sub pandora_execute_action ($$$$$$$$$;$) {
$field8 = $action->{'field8'} ? $action->{'field8'} : $alert->{'field8'};
$field9 = $action->{'field9'} ? $action->{'field9'} : $alert->{'field9'};
$field10 = $action->{'field10'} ? $action->{'field10'} : $alert->{'field10'};
$field10 = $action->{'field11'} ? $action->{'field11'} : $alert->{'field11'};
$field10 = $action->{'field12'} ? $action->{'field12'} : $alert->{'field12'};
$field10 = $action->{'field13'} ? $action->{'field13'} : $alert->{'field13'};
$field10 = $action->{'field14'} ? $action->{'field14'} : $alert->{'field14'};
$field10 = $action->{'field15'} ? $action->{'field15'} : $alert->{'field15'};
}
# Recovery fields, thanks to Kato Atsushi
@ -892,6 +902,26 @@ sub pandora_execute_action ($$$$$$$$$;$) {
$field10 = $field10 ? "[RECOVER]" . $field10 : "";
$field10 = $alert->{'field10_recovery'} ? $alert->{'field10_recovery'} : $field10;
$field10 = $action->{'field10_recovery'} ? $action->{'field10_recovery'} : $field10;
$field11 = $field11 ? "[RECOVER]" . $field11 : "";
$field11 = $alert->{'field11_recovery'} ? $alert->{'field11_recovery'} : $field11;
$field11 = $action->{'field11_recovery'} ? $action->{'field11_recovery'} : $field11;
$field12 = $field12 ? "[RECOVER]" . $field12 : "";
$field12 = $alert->{'field12_recovery'} ? $alert->{'field12_recovery'} : $field12;
$field12 = $action->{'field12_recovery'} ? $action->{'field12_recovery'} : $field12;
$field13 = $field13 ? "[RECOVER]" . $field13 : "";
$field13 = $alert->{'field13_recovery'} ? $alert->{'field13_recovery'} : $field13;
$field13 = $action->{'field13_recovery'} ? $action->{'field13_recovery'} : $field13;
$field14 = $field14 ? "[RECOVER]" . $field14 : "";
$field14 = $alert->{'field14_recovery'} ? $alert->{'field14_recovery'} : $field14;
$field14 = $action->{'field14_recovery'} ? $action->{'field14_recovery'} : $field14;
$field15 = $field15 ? "[RECOVER]" . $field15 : "";
$field15 = $alert->{'field15_recovery'} ? $alert->{'field15_recovery'} : $field15;
$field15 = $action->{'field15_recovery'} ? $action->{'field15_recovery'} : $field15;
}
$field1 = $field1 ? decode_entities($field1) : "";
@ -904,6 +934,11 @@ sub pandora_execute_action ($$$$$$$$$;$) {
$field8 = $field8 ? decode_entities($field8) : "";
$field9 = $field9 ? decode_entities($field9) : "";
$field10 = $field10 ? decode_entities($field10) : "";
$field11 = $field11 ? decode_entities($field11) : "";
$field12 = $field12 ? decode_entities($field12) : "";
$field13 = $field13 ? decode_entities($field13) : "";
$field14 = $field14 ? decode_entities($field14) : "";
$field15 = $field15 ? decode_entities($field15) : "";
# Get group info
my $group = undef;
@ -926,6 +961,11 @@ sub pandora_execute_action ($$$$$$$$$;$) {
_field8_ => $field8,
_field9_ => $field9,
_field10_ => $field10,
_field11_ => $field11,
_field12_ => $field12,
_field13_ => $field13,
_field14_ => $field14,
_field15_ => $field15,
_agent_ => (defined ($agent)) ? $agent->{'nombre'} : '',
_agentcustomid_ => (defined ($agent)) ? $agent->{'custom_id'} : '',
'_agentcustomfield_\d+_' => undef,
@ -989,6 +1029,11 @@ sub pandora_execute_action ($$$$$$$$$;$) {
$macros{_field8_} = subst_alert_macros ($field8, \%macros, $pa_config, $dbh, $agent, $module);
$macros{_field9_} = subst_alert_macros ($field9, \%macros, $pa_config, $dbh, $agent, $module);
$macros{_field10_} = subst_alert_macros ($field10, \%macros, $pa_config, $dbh, $agent, $module);
$macros{_field11_} = subst_alert_macros ($field11, \%macros, $pa_config, $dbh, $agent, $module);
$macros{_field12_} = subst_alert_macros ($field12, \%macros, $pa_config, $dbh, $agent, $module);
$macros{_field13_} = subst_alert_macros ($field13, \%macros, $pa_config, $dbh, $agent, $module);
$macros{_field14_} = subst_alert_macros ($field14, \%macros, $pa_config, $dbh, $agent, $module);
$macros{_field15_} = subst_alert_macros ($field15, \%macros, $pa_config, $dbh, $agent, $module);
my @command_args = ();
# divide command into words based on quotes and whitespaces
@ -3307,6 +3352,11 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) {
$alert->{'al_field8'} = subst_alert_macros ($alert->{'al_field8'}, \%macros);
$alert->{'al_field9'} = subst_alert_macros ($alert->{'al_field9'}, \%macros);
$alert->{'al_field10'} = subst_alert_macros ($alert->{'al_field10'}, \%macros);
$alert->{'al_field11'} = subst_alert_macros ($alert->{'al_field11'}, \%macros);
$alert->{'al_field12'} = subst_alert_macros ($alert->{'al_field12'}, \%macros);
$alert->{'al_field13'} = subst_alert_macros ($alert->{'al_field13'}, \%macros);
$alert->{'al_field14'} = subst_alert_macros ($alert->{'al_field14'}, \%macros);
$alert->{'al_field15'} = subst_alert_macros ($alert->{'al_field15'}, \%macros);
# Check time threshold
$alert->{'last_fired'} = '1970-01-01 00:00:00' unless defined ($alert->{'last_fired'});
@ -3341,6 +3391,11 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) {
'field8' => $alert->{'al_field8'},
'field9' => $alert->{'al_field9'},
'field10' => $alert->{'al_field10'},
'field11' => $alert->{'al_field11'},
'field12' => $alert->{'al_field12'},
'field13' => $alert->{'al_field13'},
'field14' => $alert->{'al_field14'},
'field15' => $alert->{'al_field15'},
'description' => $alert->{'description'},
'times_fired' => $times_fired,
'time_threshold' => 0,
@ -3419,6 +3474,11 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) {
'field8' => $other_action->{'al_field8'},
'field9' => $other_alert->{'al_field9'},
'field10' => $other_alert->{'al_field10'},
'field11' => $other_alert->{'al_field11'},
'field12' => $other_alert->{'al_field12'},
'field13' => $other_alert->{'al_field13'},
'field14' => $other_alert->{'al_field14'},
'field15' => $other_alert->{'al_field15'},
'description' => '',
'times_fired' => $times_fired,
'time_threshold' => 0,