2013-03-05 Sergio Martin <sergio.martin@artica.es>
* include/functions_reporting.php: Fix little bug of agents statistics * include/help/en/help_field_match_snmp.php include/help/en/help_snmp_alert_field1.php include/help/es/help_field_match_snmp.php include/help/es/help_snmp_alert_field1.php pandoradb.sql pandoradb.postgreSQL.sql pandoradb.oracle.sql extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql godmode/alerts/configure_alert_action.php godmode/alerts/alert_commands.php godmode/snmpconsole/snmp_alert.php: Adapt snmp alert editor to new alerts macro system. Now there are 10 fields and are dinamically charged from javascript. Bug 3605775 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7783 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
58d5760423
commit
0a1d100cda
|
@ -1,3 +1,24 @@
|
|||
2013-03-05 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_reporting.php: Fix little
|
||||
bug of agents statistics
|
||||
|
||||
* include/help/en/help_field_match_snmp.php
|
||||
include/help/en/help_snmp_alert_field1.php
|
||||
include/help/es/help_field_match_snmp.php
|
||||
include/help/es/help_snmp_alert_field1.php
|
||||
pandoradb.sql
|
||||
pandoradb.postgreSQL.sql
|
||||
pandoradb.oracle.sql
|
||||
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql
|
||||
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql
|
||||
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql
|
||||
godmode/alerts/configure_alert_action.php
|
||||
godmode/alerts/alert_commands.php
|
||||
godmode/snmpconsole/snmp_alert.php: Adapt snmp alert
|
||||
editor to new alerts macro system. Now there are 10 fields
|
||||
and are dinamically charged from javascript. Bug 3605775
|
||||
|
||||
2013-03-05 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* operation/gis_maps/render_view.php,
|
||||
|
|
|
@ -438,11 +438,26 @@ ALTER TABLE `tusuario_perfil` ADD COLUMN `tags` TEXT NOT NULL;
|
|||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE `ttag` ADD COLUMN `email` text NULL;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Add more fields in snmp alerts (05/03/13)
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE `talert_snmp` ADD COLUMN `al_field4` text NOT NULL;
|
||||
ALTER TABLE `talert_snmp` ADD COLUMN `al_field5` text NOT NULL;
|
||||
ALTER TABLE `talert_snmp` ADD COLUMN `al_field6` text NOT NULL;
|
||||
ALTER TABLE `talert_snmp` ADD COLUMN `al_field7` text NOT NULL;
|
||||
ALTER TABLE `talert_snmp` ADD COLUMN `al_field8` text NOT NULL;
|
||||
ALTER TABLE `talert_snmp` ADD COLUMN `al_field9` text NOT NULL;
|
||||
ALTER TABLE `talert_snmp` ADD COLUMN `al_field10` text NOT NULL;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- ---------------------------------------------------------------------
|
||||
-- DATA
|
||||
-- ---------------------------------------------------------------------
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Adding new network_component
|
||||
-- ----------------------------------------------------------------------
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `wizard_level`) VALUES ('Free RAM','Available RAM memory in bytes',16,1,0,0,300,0,'','','','SELECT AvailableBytes from Win32_PerfRawData_PerfOS_Memory',4,6,0,'','','10',0,1,0.00,0.00,NULL,0.00,0.00,NULL,0,NULL,NULL,NULL,0,0,0.0000000000000,'basic');
|
||||
INSERT INTO `tnetwork_component` (`name`, `description`, `id_group`, `type`, `max`, `min`, `module_interval`, `tcp_port`, `tcp_send`, `tcp_rcv`, `snmp_community`, `snmp_oid`, `id_module_group`, `id_modulo`, `id_plugin`, `plugin_user`, `plugin_pass`, `plugin_parameter`, `max_timeout`, `history_data`, `min_warning`, `max_warning`, `str_warning`, `min_critical`, `max_critical`, `str_critical`, `min_ff_event`, `custom_string_1`, `custom_string_2`, `custom_string_3`, `custom_integer_1`, `custom_integer_2`, `post_process`, `wizard_level`) VALUES ('Hostname','The hostname of the machine.',16,3,0,0,300,0,'','','','ServerName FROM Win32_WindowsProductActivation',1,6,0,'','','10',0,1,0.00,0.00,NULL,0.00,0.00,NULL,0,NULL,NULL,NULL,0,0,0.0000000000000,'basic');
|
||||
|
|
|
@ -468,6 +468,23 @@ ALTER TABLE tusuario_perfil ADD (tags CLOB NOT NULL default '');
|
|||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE ttag ADD (email CLOB NULL);
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Add more fields in snmp alerts (05/03/13)
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE talert_snmp ADD COLUMN (al_field5 CLOB NOT NULL default '');
|
||||
ALTER TABLE talert_snmp ADD COLUMN (al_field5 CLOB NOT NULL default '');
|
||||
ALTER TABLE talert_snmp ADD COLUMN (al_field6 CLOB NOT NULL default '');
|
||||
ALTER TABLE talert_snmp ADD COLUMN (al_field7 CLOB NOT NULL default '');
|
||||
ALTER TABLE talert_snmp ADD COLUMN (al_field8 CLOB NOT NULL default '');
|
||||
ALTER TABLE talert_snmp ADD COLUMN (al_field9 CLOB NOT NULL default '');
|
||||
ALTER TABLE talert_snmp ADD COLUMN (al_field10 CLOB NOT NULL default '');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- ---------------------------------------------------------------------
|
||||
-- DATA
|
||||
-- ---------------------------------------------------------------------
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Adding new network_component
|
||||
-- ---------------------------------------------------------------------
|
||||
|
|
|
@ -163,17 +163,17 @@ ALTER TABLE "tgrupo" ADD COLUMN "contact" text;
|
|||
ALTER TABLE "tgrupo" ADD COLUMN "other" text;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table "talert_snmp"
|
||||
-- Table ""talert_snmp""
|
||||
-- -----------------------------------------------------
|
||||
|
||||
ALTER TABLE "talert_snmp" ADD COLUMN "_snmp_f1_" text DEFAULT '';
|
||||
ALTER TABLE "talert_snmp" ADD COLUMN "_snmp_f2_" text DEFAULT '';
|
||||
ALTER TABLE "talert_snmp" ADD COLUMN "_snmp_f3_" text DEFAULT '';
|
||||
ALTER TABLE "talert_snmp" ADD COLUMN "_snmp_f4_" text DEFAULT '';
|
||||
ALTER TABLE "talert_snmp" ADD COLUMN "_snmp_f5_" text DEFAULT '';
|
||||
ALTER TABLE "talert_snmp" ADD COLUMN "_snmp_f6_" text DEFAULT '';
|
||||
ALTER TABLE "talert_snmp" ADD COLUMN "trap_type" INTEGER NOT NULL DEFAULT '-1';
|
||||
ALTER TABLE "talert_snmp" ADD COLUMN "single_value" varchar(255) DEFAULT '';
|
||||
ALTER TABLE ""talert_snmp"" ADD COLUMN "_snmp_f1_" text DEFAULT '';
|
||||
ALTER TABLE ""talert_snmp"" ADD COLUMN "_snmp_f2_" text DEFAULT '';
|
||||
ALTER TABLE ""talert_snmp"" ADD COLUMN "_snmp_f3_" text DEFAULT '';
|
||||
ALTER TABLE ""talert_snmp"" ADD COLUMN "_snmp_f4_" text DEFAULT '';
|
||||
ALTER TABLE ""talert_snmp"" ADD COLUMN "_snmp_f5_" text DEFAULT '';
|
||||
ALTER TABLE ""talert_snmp"" ADD COLUMN "_snmp_f6_" text DEFAULT '';
|
||||
ALTER TABLE ""talert_snmp"" ADD COLUMN "trap_type" INTEGER NOT NULL DEFAULT '-1';
|
||||
ALTER TABLE ""talert_snmp"" ADD COLUMN "single_value" varchar(255) DEFAULT '';
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table "tagente_modulo"
|
||||
|
@ -459,10 +459,26 @@ ALTER TABLE "tusuario_perfil" ADD COLUMN "tags" text default '';
|
|||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE "ttag" ADD COLUMN "email" TEXT NULL;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Add more fields in snmp alerts (05/03/13)
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE "talert_snmp" ADD COLUMN "al_field4" TEXT NULL;
|
||||
ALTER TABLE "talert_snmp" ADD COLUMN "al_field5" TEXT NULL;
|
||||
ALTER TABLE "talert_snmp" ADD COLUMN "al_field6" TEXT NULL;
|
||||
ALTER TABLE "talert_snmp" ADD COLUMN "al_field7" TEXT NULL;
|
||||
ALTER TABLE "talert_snmp" ADD COLUMN "al_field8" TEXT NULL;
|
||||
ALTER TABLE "talert_snmp" ADD COLUMN "al_field9" TEXT NULL;
|
||||
ALTER TABLE "talert_snmp" ADD COLUMN "al_field10" TEXT NULL;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- ---------------------------------------------------------------------
|
||||
-- DATA
|
||||
-- ---------------------------------------------------------------------
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Adding new network_component
|
||||
-- ----------------------------------------------------------------------
|
||||
|
||||
|
||||
INSERT INTO "tnetwork_component" ("name", "description", "id_group", "type", "max", "min", "module_interval", "tcp_port", "tcp_send", "tcp_rcv", "snmp_community", "snmp_oid", "id_module_group", "id_modulo", "id_plugin", "plugin_user", "plugin_pass", "plugin_parameter", "max_timeout", "history_data", "min_warning", "max_warning", "str_warning", "min_critical", "max_critical", "str_critical", "min_ff_event", "custom_string_1", "custom_string_2", "custom_string_3", "custom_integer_1", "custom_integer_2", "post_process", "wizard_level") VALUES ('Free RAM','Available RAM memory in bytes',16,1,0,0,300,0,'','','','SELECT AvailableBytes from Win32_PerfRawData_PerfOS_Memory',4,6,0,'','','10',0,1,0.00,0.00,NULL,0.00,0.00,NULL,0,NULL,NULL,NULL,0,0,0.0000000000000,'basic');
|
||||
INSERT INTO "tnetwork_component" ("name", "description", "id_group", "type", "max", "min", "module_interval", "tcp_port", "tcp_send", "tcp_rcv", "snmp_community", "snmp_oid", "id_module_group", "id_modulo", "id_plugin", "plugin_user", "plugin_pass", "plugin_parameter", "max_timeout", "history_data", "min_warning", "max_warning", "str_warning", "min_critical", "max_critical", "str_critical", "min_ff_event", "custom_string_1", "custom_string_2", "custom_string_3", "custom_integer_1", "custom_integer_2", "post_process", "wizard_level") VALUES ('Hostname','The hostname of the machine.',16,3,0,0,300,0,'','','','ServerName FROM Win32_WindowsProductActivation',1,6,0,'','','10',0,1,0.00,0.00,NULL,0.00,0.00,NULL,0,NULL,NULL,NULL,0,0,0.0000000000000,'basic');
|
||||
|
|
|
@ -39,7 +39,14 @@ $pure = get_parameter('pure', 0);
|
|||
if (is_ajax ()) {
|
||||
$get_alert_command = (bool) get_parameter ('get_alert_command');
|
||||
if ($get_alert_command) {
|
||||
$id = (int) get_parameter ('id');
|
||||
$id = (int) get_parameter ('id', 0);
|
||||
|
||||
// If command ID is not provided, check for action id
|
||||
if($id == 0) {
|
||||
$id_action = (int) get_parameter ('id_action');
|
||||
$id = alerts_get_alert_action_alert_command_id($id_action);
|
||||
}
|
||||
|
||||
$command = alerts_get_alert_command ($id);
|
||||
|
||||
// If is setted a description, we change the carriage return by <br> tags
|
||||
|
|
|
@ -192,7 +192,7 @@ $(document).ready (function () {
|
|||
value: "1"});
|
||||
values.push ({name: "id",
|
||||
value: this.value});
|
||||
jQuery.get (<?php echo "'" . ui_get_full_url(false, false, false, false) . "'"; ?> + "ajax.php",
|
||||
jQuery.get (<?php echo "'" . ui_get_full_url("ajax.php", false, false, false) . "'"; ?>,
|
||||
values,
|
||||
function (data, status) {
|
||||
original_command = js_html_entity_decode (data["command"]);
|
||||
|
@ -227,7 +227,7 @@ $(document).ready (function () {
|
|||
);
|
||||
});
|
||||
|
||||
// Charge the fields of the
|
||||
// Charge the fields of the command
|
||||
$("#id_command").trigger('change');
|
||||
});
|
||||
|
||||
|
|
|
@ -45,9 +45,16 @@ else if (isset ($_GET["submit"])) {
|
|||
$custom_value = (string) get_parameter_post ("custom_value");
|
||||
$time_threshold = (int) get_parameter_post ("time_threshold", SECONDS_5MINUTES);
|
||||
$time_other = (int) get_parameter_post ("time_other", -1);
|
||||
$al_field1 = (string) get_parameter_post ("al_field1");
|
||||
$al_field2 = (string) get_parameter_post ("al_field2");
|
||||
$al_field3 = (string) get_parameter_post ("al_field3");
|
||||
$al_field1 = (string) get_parameter_post ("field1_value");
|
||||
$al_field2 = (string) get_parameter_post ("field2_value");
|
||||
$al_field3 = (string) get_parameter_post ("field3_value");
|
||||
$al_field4 = (string) get_parameter_post ("field4_value");
|
||||
$al_field5 = (string) get_parameter_post ("field5_value");
|
||||
$al_field6 = (string) get_parameter_post ("field6_value");
|
||||
$al_field7 = (string) get_parameter_post ("field7_value");
|
||||
$al_field8 = (string) get_parameter_post ("field8_value");
|
||||
$al_field9 = (string) get_parameter_post ("field9_value");
|
||||
$al_field10 = (string) get_parameter_post ("al_field10");
|
||||
$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);
|
||||
|
@ -70,6 +77,13 @@ else if (isset ($_GET["submit"])) {
|
|||
'al_field1' => $al_field1,
|
||||
'al_field2' => $al_field2,
|
||||
'al_field3' => $al_field3,
|
||||
'al_field4' => $al_field4,
|
||||
'al_field5' => $al_field5,
|
||||
'al_field6' => $al_field6,
|
||||
'al_field7' => $al_field7,
|
||||
'al_field8' => $al_field8,
|
||||
'al_field9' => $al_field9,
|
||||
'al_field10' => $al_field10,
|
||||
'description' => $description,
|
||||
'agent' => $source_ip,
|
||||
'custom_oid' => $custom_value,
|
||||
|
@ -102,7 +116,10 @@ else if (isset ($_GET["submit"])) {
|
|||
else {
|
||||
$sql = sprintf ("UPDATE talert_snmp SET
|
||||
priority = %d, id_alert = %d, al_field1 = '%s',
|
||||
al_field2 = '%s', al_field3 = '%s', description = '%s',
|
||||
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',
|
||||
description = '%s',
|
||||
agent = '%s', custom_oid = '%s', oid = '%s',
|
||||
time_threshold = %d, max_alerts = %d, min_alerts = %d,
|
||||
_snmp_f1_ = '%s', _snmp_f2_ = '%s', _snmp_f3_ = '%s',
|
||||
|
@ -110,6 +127,8 @@ else if (isset ($_GET["submit"])) {
|
|||
trap_type = %d, single_value = '%s'
|
||||
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,
|
||||
$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,
|
||||
|
@ -146,6 +165,13 @@ if ((isset ($_GET["update_alert"])) && ($_GET["update_alert"] != -1)) {
|
|||
$al_field1 = $alert["al_field1"];
|
||||
$al_field2 = $alert["al_field2"];
|
||||
$al_field3 = $alert["al_field3"];
|
||||
$al_field4 = $alert["al_field4"];
|
||||
$al_field5 = $alert["al_field5"];
|
||||
$al_field6 = $alert["al_field6"];
|
||||
$al_field7 = $alert["al_field7"];
|
||||
$al_field8 = $alert["al_field8"];
|
||||
$al_field9 = $alert["al_field9"];
|
||||
$al_field10 = $alert["al_field10"];
|
||||
$max_alerts = $alert["max_alerts"];
|
||||
$min_alerts = $alert["min_alerts"];
|
||||
$priority = $alert["priority"];
|
||||
|
@ -170,6 +196,13 @@ elseif (isset ($_GET["update_alert"])) {
|
|||
$al_field1 = "";
|
||||
$al_field2 = "";
|
||||
$al_field3 = "";
|
||||
$al_field4 = "";
|
||||
$al_field5 = "";
|
||||
$al_field6 = "";
|
||||
$al_field7 = "";
|
||||
$al_field8 = "";
|
||||
$al_field9 = "";
|
||||
$al_field10 = "";
|
||||
$max_alerts = 1;
|
||||
$min_alerts = 0;
|
||||
$priority = 0;
|
||||
|
@ -208,15 +241,13 @@ if (isset ($_GET["update_alert"])) {
|
|||
|
||||
/* SNMP alert filters */
|
||||
|
||||
echo '<table cellpadding="4" cellspacing="4" width="98%" class="databox_color">';
|
||||
echo '<table cellpadding="4" cellspacing="4" width="98%" class="databox" style="font-weight: bold">';
|
||||
|
||||
// Description
|
||||
echo '<tr><td class="datos">'.__('Description').'</td><td class="datos">';
|
||||
html_print_input_text ("description", $description, '', 60);
|
||||
echo '</td></tr>';
|
||||
|
||||
|
||||
|
||||
//echo '<tr><td class="datos"><b>' . __('Alert filters') . ui_print_help_icon("snmp_alert_filters", true) . '</b></td></tr>';
|
||||
|
||||
// OID
|
||||
|
@ -310,19 +341,21 @@ if (isset ($_GET["update_alert"])) {
|
|||
//echo '<tr><td class="datos"><b>' . __('Alert configuration') . ui_print_help_icon("snmp_alert_configuration", true) . '</b></td></tr>';
|
||||
|
||||
// Alert fields
|
||||
echo '<tr><td class="datos">'.__('Field #1 (Alias, name)');
|
||||
echo ui_print_help_icon ("snmp_alert_field1", true);
|
||||
echo '</td><td class="datos">';
|
||||
html_print_input_text ("al_field1", $al_field1, '', 60);
|
||||
echo '</td></tr>';
|
||||
|
||||
echo '<tr><td class="datos2">'.__('Field #2 (Single Line)').'</td><td class="datos2">';
|
||||
html_print_input_text ("al_field2", $al_field2, '', 60);
|
||||
echo '</td></tr>';
|
||||
$al = array('al_field1' => $al_field1, 'al_field2' => $al_field2, 'al_field3' => $al_field3,
|
||||
'al_field4' => $al_field4, 'al_field5' => $al_field5, 'al_field6' => $al_field6,
|
||||
'al_field7' => $al_field7, 'al_field8' => $al_field8, 'al_field9' => $al_field9,
|
||||
'al_field10' => $al_field10);
|
||||
|
||||
echo '<tr><td class="datos" valign="top">'.__('Field #3 (Full Text)').'<td class="datos">';
|
||||
html_print_textarea ("al_field3", $al_field3, 4, $al_field3, 'style="width:400px"');
|
||||
echo '</td></tr>';
|
||||
// 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++) {
|
||||
echo '<tr id="table1-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] : '');
|
||||
echo '</td></tr>';
|
||||
}
|
||||
|
||||
// Max / Min alerts
|
||||
echo '<tr><td class="datos2">'.__('Min. number of alerts').'</td><td class="datos2">';
|
||||
|
@ -397,6 +430,7 @@ if (isset ($_GET["update_alert"])) {
|
|||
}
|
||||
echo '</td></tr></table>';
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
}
|
||||
else {
|
||||
require_once ('include/functions_alerts.php');
|
||||
|
@ -504,5 +538,53 @@ function time_changed () {
|
|||
|
||||
$(document).ready (function () {
|
||||
$('#time_threshold').change (time_changed);
|
||||
|
||||
$("#alert_type").change (function () {
|
||||
values = Array ();
|
||||
values.push ({name: "page",
|
||||
value: "godmode/alerts/alert_commands"});
|
||||
values.push ({name: "get_alert_command",
|
||||
value: "1"});
|
||||
values.push ({name: "id_action",
|
||||
value: this.value});
|
||||
jQuery.get (<?php echo "'" . ui_get_full_url("ajax.php", false, false, false) . "'"; ?>,
|
||||
values,
|
||||
function (data, status) {
|
||||
original_command = js_html_entity_decode (data["command"]);
|
||||
command_description = js_html_entity_decode (data["description"]);
|
||||
for (i=1; i<=10; i++) {
|
||||
var old_value = '';
|
||||
// Only keep the value if is provided from hidden (first time)
|
||||
if ($("[name=field"+i+"_value]").attr('id') == "hidden-field" + i + "_value") {
|
||||
old_value = $("[name=field"+i+"_value]").val();
|
||||
}
|
||||
|
||||
// If the row is empty, hide de row
|
||||
if(data["fields_rows"][i] == '') {
|
||||
$('#table1-field'+i).hide();
|
||||
}
|
||||
else {
|
||||
$('#table1-field'+i).replaceWith(data["fields_rows"][i]);
|
||||
|
||||
// The row provided has a predefined class. We delete it
|
||||
$('#table1-field'+i).removeAttr('class');
|
||||
|
||||
// Add help hint only in first field
|
||||
if(i == 1) {
|
||||
var td_content = $('#table1-field'+i).find('td').eq(0);
|
||||
td_content.html(td_content.html() + $('#help_snmp_alert_hint').html());
|
||||
}
|
||||
|
||||
$("[name=field"+i+"_value]").val(old_value);
|
||||
$('#table1-field').show();
|
||||
}
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
});
|
||||
|
||||
// Charge the fields of the action
|
||||
$("#alert_type").trigger('change');
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -6648,7 +6648,8 @@ function reporting_tiny_stats ($counts_info, $return = false, $type = 'agent') {
|
|||
$stats = array();
|
||||
|
||||
if(isset($counts_info['total_count'])) {
|
||||
$total_count = $counts_info['total_count'];
|
||||
$not_init = isset($counts_info['notinit_count']) ? $counts_info['notinit_count'] : 0;
|
||||
$total_count = $counts_info['total_count'] - $not_init;
|
||||
$stats[] = array('name' => 'total_count', 'count' => $total_count, 'title' => sprintf($template_title['total_count'], $total_count));
|
||||
}
|
||||
|
||||
|
@ -6697,7 +6698,7 @@ function reporting_tiny_stats ($counts_info, $return = false, $type = 'agent') {
|
|||
$out .= ' : <span class="orange forced_title" id="fired_count_' . $uniq_id . '">' . $fired_count . '</span>';
|
||||
if (isset($critical_count) && $critical_count > 0)
|
||||
$out .= ' : <span class="red forced_title" id="critical_count_' . $uniq_id . '">' . $critical_count . '</span>';
|
||||
if (isset($warning_counts) && $warning_count > 0)
|
||||
if (isset($warning_count) && $warning_count > 0)
|
||||
$out .= ' : <span class="yellow forced_title" id="warning_count_' . $uniq_id . '">' . $warning_count . '</span>';
|
||||
if (isset($unknown_count) && $unknown_count > 0)
|
||||
$out .= ' : <span class="grey forced_title" id="unknown_count_' . $uniq_id . '">' . $unknown_count . '</span>';
|
||||
|
|
|
@ -6,4 +6,4 @@
|
|||
|
||||
<h1>Custom OID/Data #1-6</h1>
|
||||
|
||||
<p>There are regular expressions. It is possible to use selectors in order to select a part of the regular expression that will be load in _snmp_fx_ macro. You can use these macros in Field #1 (Alias, name), Field #2 (Single Line) and Field #3 (Full Text).</p>
|
||||
<p>There are regular expressions. It is possible to use selectors in order to select a part of the regular expression that will be load in _snmp_fX_ macro. You can use these macros in FieldsX (1-10).</p>
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
<h1>SNMP Trap - Alert field macros</h1>
|
||||
<p>
|
||||
|
||||
Once we've got the data fields, we must use them in the alert. With this purpose, the special macros _snmp_f1_, _snmp_f2_ and _snmp_f3_ are used. Using these macros doesn't have any sense out of SNMP trap alerts.
|
||||
|
||||
Once we've got the data fields, we must use them in the alert. With this purpose, the special macros _snmp_fX_ are used. Using these macros doesn't have any sense out of SNMP trap alerts.
|
||||
<br><br>
|
||||
To build the message, we would use the following string in Field1.
|
||||
|
||||
Chassis Alert: _snmp_f2_ in device _snmp_f1_
|
||||
|
||||
You can use these macros in field1, field2 and field3
|
||||
<br><br>
|
||||
Chassis Alert: _snmp_f2_ in device _snmp_f1_
|
||||
<br><br>
|
||||
You can use these macros in FieldX (1-10) of any alert
|
||||
</p>
|
||||
|
|
|
@ -6,4 +6,4 @@
|
|||
|
||||
<h1>Custom OID/Data #1-6</h1>
|
||||
|
||||
<p>Son expresiones regulares. Es posible usar selectores para seleccionar parte de la expresión regular que se cargará en la macro _snmp_fx_. Puedes usar estas macros en los campos Field #1 (Alias, name), Field #2 (Single Line) y Field #3 (Full Text).</p>
|
||||
<p>Son expresiones regulares. Es posible usar selectores para seleccionar parte de la expresión regular que se cargará en la macro _snmp_fX_. Puedes usar estas macros en los campos FieldX (1-10).</p>
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
<h1>SNMP Trap - Macros de datos para las alertas </h1>
|
||||
<p>
|
||||
|
||||
Una vez que ha parseado los campos de datos mediante regexp, puede usar esos campos de datos, para sustituir sus valores en las alertas. Para ello, se pueden usar las macros especiales _snmp_f1_, _snmp_f2_ y _snmp_f3_. Estas macros no tienen valor o sentido fuera del contexto de las alertas de traps SNMP.
|
||||
|
||||
Una vez que ha parseado los campos de datos mediante regexp, puede usar esos campos de datos, para sustituir sus valores en las alertas. Para ello, se pueden usar las macros especiales _snmp_fX_. Estas macros no tienen valor o sentido fuera del contexto de las alertas de traps SNMP.
|
||||
<br><br>
|
||||
Para contruir un mensaje, podríamos usar la siguiente cadena en el "campo1":
|
||||
|
||||
Alerta de Chasis: _snmp_f2_ en dispositivo _snmp_f1_
|
||||
|
||||
Puede usar esas macros en el campo1, campo2 y campo3 de cualquier alerta.
|
||||
<br><br>
|
||||
Alerta de Chasis: _snmp_f2_ en dispositivo _snmp_f1_
|
||||
<br><br>
|
||||
Puede usar esas macros en los campos FieldX (1-10) de cualquier alerta.
|
||||
</p>
|
||||
|
|
|
@ -271,6 +271,13 @@ CREATE TABLE talert_snmp (
|
|||
al_field1 CLOB default '',
|
||||
al_field2 CLOB default '',
|
||||
al_field3 CLOB default '',
|
||||
al_field4 CLOB default '',
|
||||
al_field5 CLOB default '',
|
||||
al_field6 CLOB default '',
|
||||
al_field7 CLOB default '',
|
||||
al_field8 CLOB default '',
|
||||
al_field9 CLOB default '',
|
||||
al_field10 CLOB default '',
|
||||
description VARCHAR2(255) default '',
|
||||
alert_type NUMBER(5, 0) default 0 NOT NULL,
|
||||
agent VARCHAR2(100) default '',
|
||||
|
|
|
@ -255,6 +255,13 @@ CREATE TABLE "talert_snmp" (
|
|||
"al_field1" text NOT NULL default '',
|
||||
"al_field2" text NOT NULL default '',
|
||||
"al_field3" text NOT NULL default '',
|
||||
"al_field4" text NOT NULL default '',
|
||||
"al_field5" text NOT NULL default '',
|
||||
"al_field6" text NOT NULL default '',
|
||||
"al_field7" text NOT NULL default '',
|
||||
"al_field8" text NOT NULL default '',
|
||||
"al_field9" text NOT NULL default '',
|
||||
"al_field10" text NOT NULL default '',
|
||||
"description" varchar(255) default '',
|
||||
"alert_type" SMALLINT NOT NULL default 0,
|
||||
"agent" varchar(100) default '',
|
||||
|
|
|
@ -262,6 +262,13 @@ CREATE TABLE IF NOT EXISTS `talert_snmp` (
|
|||
`al_field1` text NOT NULL,
|
||||
`al_field2` text NOT NULL,
|
||||
`al_field3` text NOT NULL,
|
||||
`al_field4` text NOT NULL,
|
||||
`al_field5` text NOT NULL,
|
||||
`al_field6` text NOT NULL,
|
||||
`al_field7` text NOT NULL,
|
||||
`al_field8` text NOT NULL,
|
||||
`al_field9` text NOT NULL,
|
||||
`al_field10` text NOT NULL,
|
||||
`description` varchar(255) default '',
|
||||
`alert_type` int(2) unsigned NOT NULL default '0',
|
||||
`agent` varchar(100) default '',
|
||||
|
|
Loading…
Reference in New Issue