Added more fields to alert macro fields. Ticket #233
This commit is contained in:
parent
de0a318dc9
commit
3e0b0f231b
|
@ -65,6 +65,16 @@ CREATE TABLE IF NOT EXISTS `trel_item` (
|
|||
-- Table `talert_templates`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE talert_templates ADD COLUMN `min_alerts_reset_counter` tinyint(1) DEFAULT 0;
|
||||
ALTER TABLE talert_templates ADD COLUMN `field11` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_templates ADD COLUMN `field12` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_templates ADD COLUMN `field13` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_templates ADD COLUMN `field14` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_templates ADD COLUMN `field15` TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_templates ADD COLUMN `field11_recovery` TEXT NOT NULL DEFAULT "";
|
||||
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 `tserver`
|
||||
|
|
|
@ -3,6 +3,16 @@
|
|||
-- ---------------------------------------------------------------------
|
||||
|
||||
ALTER TABLE talert_templates ADD COLUMN min_alerts_reset_counter NUMBER(5, 0) DEFAULT 0;
|
||||
ALTER TABLE talert_templates ADD COLUMN field11 CLOB DEFAULT "";
|
||||
ALTER TABLE talert_templates ADD COLUMN field12 CLOB DEFAULT "";
|
||||
ALTER TABLE talert_templates ADD COLUMN field13 CLOB DEFAULT "";
|
||||
ALTER TABLE talert_templates ADD COLUMN field14 CLOB DEFAULT "";
|
||||
ALTER TABLE talert_templates ADD COLUMN field15 CLOB DEFAULT "";
|
||||
ALTER TABLE talert_templates ADD COLUMN field11_recovery CLOB DEFAULT "";
|
||||
ALTER TABLE talert_templates ADD COLUMN field12_recovery CLOB DEFAULT "";
|
||||
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 `tserver`
|
||||
|
|
|
@ -40,3 +40,17 @@ ALTER TABLE tlayout ADD COLUMN background_color varchar(50) NOT NULL default '#F
|
|||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tlayout_data ADD COLUMN type_graph varchar(50) NOT NULL default 'area';
|
||||
ALTER TABLE tlayout_data ADD COLUMN label_position varchar(50) NOT NULL default 'down';
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `talert_templates`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE talert_templates ADD COLUMN field11 TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_templates ADD COLUMN field12 TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_templates ADD COLUMN field13 TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_templates ADD COLUMN field14 TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_templates ADD COLUMN field15 TEXT NOT NULL DEFAULT "";
|
||||
ALTER TABLE talert_templates ADD COLUMN field11_recovery TEXT NOT NULL DEFAULT "";
|
||||
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 "";
|
||||
|
|
|
@ -59,7 +59,7 @@ if ($update_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];
|
||||
|
@ -155,7 +155,7 @@ $table->colspan[2][1] = 3;
|
|||
$table->data[2][0] = __('Description');
|
||||
$table->data[2][1] = html_print_textarea ('description', 10, 30, $description, '', true);
|
||||
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
||||
|
||||
$table->data['field'.$i][0] = sprintf(__('Field %s description'), $i);
|
||||
|
||||
|
|
|
@ -304,7 +304,7 @@ function update_template ($step) {
|
|||
}
|
||||
elseif ($step == 3) {
|
||||
$recovery_notify = (bool) get_parameter ('recovery_notify');
|
||||
for($i=1;$i<=10;$i++) {
|
||||
for($i=1;$i<=$config['max_macro_fields'];$i++) {
|
||||
$values['field'.$i] = (string) get_parameter ('field'.$i);
|
||||
$values['field'.$i.'_recovery'] = $recovery_notify ? (string) get_parameter ('field'.$i.'_recovery') : '';
|
||||
}
|
||||
|
@ -354,10 +354,10 @@ $sunday = true;
|
|||
$special_day = false;
|
||||
$default_action = 0;
|
||||
$fields = array();
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
||||
$fields[$i] = '';
|
||||
}
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
||||
$fields_recovery[$i] = '';
|
||||
}
|
||||
$priority = 1;
|
||||
|
@ -473,13 +473,13 @@ if ($id && ! $create_template) {
|
|||
$min_alerts_reset_counter = $template['min_alerts_reset_counter'];
|
||||
$threshold = $template['time_threshold'];
|
||||
$fields = array();
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
||||
$fields[$i] = $template['field'.$i];
|
||||
}
|
||||
$recovery_notify = $template['recovery_notify'];
|
||||
|
||||
$fields_recovery = array();
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
||||
$fields_recovery[$i] = $template['field'.$i.'_recovery'];
|
||||
}
|
||||
|
||||
|
@ -643,6 +643,10 @@ else if ($step == 3) {
|
|||
/* Alert recover */
|
||||
if (! $recovery_notify) {
|
||||
$table->cellstyle['label_fields'][2] = 'display:none;';
|
||||
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
||||
$table->cellstyle['field' . $i][2] = 'display:none;';
|
||||
}
|
||||
/*
|
||||
$table->cellstyle['field1'][2] = 'display:none;';
|
||||
$table->cellstyle['field2'][2] = 'display:none;';
|
||||
$table->cellstyle['field3'][2] = 'display:none;';
|
||||
|
@ -653,6 +657,7 @@ else if ($step == 3) {
|
|||
$table->cellstyle['field8'][2] = 'display:none;';
|
||||
$table->cellstyle['field9'][2] = 'display:none;';
|
||||
$table->cellstyle['field10'][2] = 'display:none;';
|
||||
*/
|
||||
}
|
||||
$table->data[0][0] = __('Alert recovery');
|
||||
$values = array (false => __('Disabled'), true => __('Enabled'));
|
||||
|
@ -665,7 +670,7 @@ else if ($step == 3) {
|
|||
$table->data['label_fields'][1] = __('Firing fields');
|
||||
$table->data['label_fields'][2] = __('Recovery fields');
|
||||
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
|
||||
if (isset($template[$name])) {
|
||||
$value = $template[$name];
|
||||
}
|
||||
|
@ -1090,11 +1095,21 @@ if ($step == 2) {
|
|||
elseif ($step == 3) {
|
||||
?>
|
||||
$("#recovery_notify").change (function () {
|
||||
var max_fields = parseInt('<?php echo $config["max_macro_fields"]; ?>');
|
||||
|
||||
if (this.value == 1) {
|
||||
$("#template-label_fields-2, #template-field1-2, #template-field2-2, #template-field3-2, #template-field4-2, #template-field5-2, #template-field6-2, #template-field7-2, #template-field8-2, #template-field9-2, #template-field10-2").show ();
|
||||
$("#template-label_fields-2").show();
|
||||
for (i = 1; i <= max_fields; i++) {
|
||||
$("#template-field" + i + "-2").show();
|
||||
}
|
||||
//$("#template-label_fields-2, #template-field1-2, #template-field2-2, #template-field3-2, #template-field4-2, #template-field5-2, #template-field6-2, #template-field7-2, #template-field8-2, #template-field9-2, #template-field10-2").show ();
|
||||
}
|
||||
else {
|
||||
$("#template-label_fields-2, #template-field1-2, #template-field2-2, #template-field3-2, #template-field4-2, #template-field5-2, #template-field6-2, #template-field7-2, #template-field8-2, #template-field9-2, #template-field10-2").hide ();
|
||||
$("#template-label_fields-2").hide();
|
||||
for (i = 1; i <= max_fields; i++) {
|
||||
$("#template-field" + i + "-2").hide();
|
||||
}
|
||||
//$("#template-label_fields-2, #template-field1-2, #template-field2-2, #template-field3-2, #template-field4-2, #template-field5-2, #template-field6-2, #template-field7-2, #template-field8-2, #template-field9-2, #template-field10-2").hide ();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -76,9 +76,12 @@ $table->data[9][1] = html_print_input_text ('days_autodisable_deletion', $config
|
|||
$table->data[10][0] = __('Retention period of past special days') . ui_print_help_tip(__('This number is days to keep past special days. 0 means never remove.'), true);
|
||||
$table->data[10][1] = html_print_input_text ('num_past_special_days', $config["num_past_special_days"], '', 5, 5, true);
|
||||
|
||||
$table->data[11][0] = __('Max. macro data fields') . ui_print_help_tip(__('Number of macro fields in alerts and templates between 1 and 50'), true);
|
||||
$table->data[11][1] = html_print_input_text ('max_macro_fields', $config["max_macro_fields"], '', 5, 5, true, false, false, "onChange=\"change_macro_fields()\"");
|
||||
|
||||
if (enterprise_installed ()) {
|
||||
$table->data[11][0] = __('Max. days before delete inventory data');
|
||||
$table->data[11][1] = html_print_input_text ('inventory_purge', $config["inventory_purge"], '', 5, 5, true);
|
||||
$table->data[12][0] = __('Max. days before delete inventory data');
|
||||
$table->data[12][1] = html_print_input_text ('inventory_purge', $config["inventory_purge"], '', 5, 5, true);
|
||||
}
|
||||
|
||||
$table_other = new stdClass();
|
||||
|
@ -153,4 +156,17 @@ echo '</div>';
|
|||
echo '</form>';
|
||||
?>
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
|
||||
function change_macro_fields() {
|
||||
var value = $("#text-max_macro_fields").val();
|
||||
console.log(value);
|
||||
if (value <= 0) {
|
||||
$("#text-max_macro_fields").val(1);
|
||||
}
|
||||
else if (value > 15) {
|
||||
$("#text-max_macro_fields").val(15);
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
@ -407,6 +407,8 @@ function config_update_config () {
|
|||
$error_update[] = __('Small Operation Step to purge old data');
|
||||
if (!config_update_value ('num_past_special_days', get_parameter ('num_past_special_days')))
|
||||
$error_update[] = __('Retention period of past special days');
|
||||
if (!config_update_value ('max_macro_fields', get_parameter ('max_macro_fields')))
|
||||
$error_update[] = __('Max. macro data fields');
|
||||
if (isset($config['enterprise_installed']) && $config['enterprise_installed'] == 1) {
|
||||
if (!config_update_value ('inventory_purge', get_parameter ('inventory_purge')))
|
||||
$error_update[] = __('Max. days before delete inventory data');
|
||||
|
@ -876,6 +878,10 @@ function config_process_config () {
|
|||
}
|
||||
}
|
||||
|
||||
if (!isset($config['max_macro_fields'])) {
|
||||
config_update_value ('max_macro_fields', 10);
|
||||
}
|
||||
|
||||
if (!isset ($config["event_purge"])) {
|
||||
config_update_value ('event_purge', 15);
|
||||
}
|
||||
|
|
|
@ -464,6 +464,11 @@ CREATE TABLE talert_templates (
|
|||
field8 CLOB DEFAULT '',
|
||||
field9 CLOB DEFAULT '',
|
||||
field10 CLOB DEFAULT '',
|
||||
field11 CLOB DEFAULT '',
|
||||
field12 CLOB DEFAULT '',
|
||||
field13 CLOB DEFAULT '',
|
||||
field14 CLOB DEFAULT '',
|
||||
field15 CLOB DEFAULT '',
|
||||
type VARCHAR2(50),
|
||||
value VARCHAR2(255) DEFAULT '',
|
||||
matches_value NUMBER(5, 0) DEFAULT 0,
|
||||
|
@ -492,6 +497,11 @@ CREATE TABLE talert_templates (
|
|||
field8_recovery CLOB DEFAULT '',
|
||||
field9_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 '',
|
||||
priority NUMBER(10, 0) DEFAULT 0,
|
||||
id_group NUMBER(10, 0) DEFAULT 0,
|
||||
special_day NUMBER(5, 0) DEFAULT 0,
|
||||
|
|
|
@ -393,6 +393,11 @@ CREATE TABLE "talert_templates" (
|
|||
"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 '',
|
||||
"type" type_talert_templates_alert_template,
|
||||
"value" varchar(255) default '',
|
||||
"matches_value" SMALLINT default 0,
|
||||
|
@ -421,6 +426,11 @@ CREATE TABLE "talert_templates" (
|
|||
"field8_recovery" text NOT NULL default '',
|
||||
"field9_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 '',
|
||||
"priority" INTEGER NOT NULL default 0,
|
||||
"id_group" INTEGER NOT NULL default 0,
|
||||
"special_day" SMALLINT default 0,
|
||||
|
|
|
@ -415,6 +415,11 @@ CREATE TABLE IF NOT EXISTS `talert_templates` (
|
|||
`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,
|
||||
`type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical', 'onchange', 'unknown', 'always'),
|
||||
`value` varchar(255) default '',
|
||||
`matches_value` tinyint(1) default 0,
|
||||
|
@ -443,6 +448,11 @@ CREATE TABLE IF NOT EXISTS `talert_templates` (
|
|||
`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,
|
||||
`priority` tinyint(4) default '0',
|
||||
`id_group` mediumint(8) unsigned NULL default 0,
|
||||
`special_day` tinyint(1) default 0,
|
||||
|
|
Loading…
Reference in New Issue