2012-02-02 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/help/en/help_snmp_alert_custom.php include/help/es/help_snmp_alert_custom.php operation/snmpconsole/snmp_view.php godmode/snmpconsole/snmp_alert.php: Added eight new fields for snmp alerts and a filter in trap search. pandoradb.sql pandoradb.postgreSQL.sql pandoradb.oracle.sql extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql: Added _snmp_f1_ ... _snmp_f6_, trap_type and single_value fields to talert_snmp table. * general/shortcut_bar.php: Fixed shorcut style. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5466 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
999008a5da
commit
f179b20ade
|
@ -102,3 +102,10 @@ ON DELETE CASCADE;
|
|||
|
||||
ALTER TABLE `tevento` ADD COLUMN (`source` tinytext NOT NULL DEFAULT '',
|
||||
`unique_id` tinytext NOT NULL DEFAULT '', `id_extra` tinytext NOT NULL DEFAULT '');
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `talert_snmp`
|
||||
-- -----------------------------------------------------
|
||||
ALTER TABLE `talert_snmp` ADD COLUMN (`_snmp_f1_` text DEFAULT '', `_snmp_f2_` text DEFAULT '', `_snmp_f3_` text DEFAULT '',
|
||||
`_snmp_f4_` text DEFAULT '', `_snmp_f5_` text DEFAULT '', `_snmp_f6_` text DEFAULT '', `trap_type` int(11) NOT NULL default '-1',
|
||||
`single_value` varchar(255) DEFAULT '');
|
||||
|
|
|
@ -110,4 +110,15 @@ alter table tevento add (source VARCHAR2(100) default '' NOT NULL);
|
|||
alter table tevento add (unique_id VARCHAR2(100) default '' NOT NULL);
|
||||
alter table tevento add (id_extra VARCHAR2(100) default '' NOT NULL);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `talert_snmp`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
ALTER TABLE talert_snmp add (_snmp_f1_ CLOB default '');
|
||||
ALTER TABLE talert_snmp add (_snmp_f2_ CLOB default '');
|
||||
ALTER TABLE talert_snmp add (_snmp_f3_ CLOB default '');
|
||||
ALTER TABLE talert_snmp add (_snmp_f4_ CLOB default '');
|
||||
ALTER TABLE talert_snmp add (_snmp_f5_ CLOB default '');
|
||||
ALTER TABLE talert_snmp add (_snmp_f6_ CLOB default '');
|
||||
ALTER TABLE talert_snmp add (trap_type NUMBER(10, 0) DEFAULT -1 NOT NULL);
|
||||
ALTER TABLE talert_snmp add (single_value VARCHAR2(255) DEFAULT '');
|
||||
|
|
|
@ -94,3 +94,16 @@ REFERENCES "tplanned_downtime"("id");
|
|||
ALTER TABLE "tevento" ADD COLUMN "source" text NULL default '';
|
||||
ALTER TABLE "tevento" ADD COLUMN "unique_id" text NULL default '';
|
||||
ALTER TABLE "tevento" ADD COLUMN "id_extra" text NULL default '';
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- 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 '';
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
|
||||
echo " ";
|
||||
echo "<a href='index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=120&filter=fired&free_search=&filter_button=Filter'>";
|
||||
html_print_image("images/bell.png", false, array("title" => __("Alerts fired")));
|
||||
html_print_image("images/bell.png", false, array("title" => __("Alerts fired"), "style" => "margin-bottom: -5px;"));
|
||||
echo " ";
|
||||
|
||||
// Calculate alerts fired
|
||||
|
@ -110,7 +110,7 @@
|
|||
echo "</a>";
|
||||
echo " ";
|
||||
echo "<a href='index.php?sec=eventos&sec2=operation/events/events&status=3&severity=4&event_view_hr=8&ev_group=0&group_rep=1&filter_only_alert=-1'>";
|
||||
html_print_image("images/lightning_go.png", false, array("title" => __("Critical events")));
|
||||
html_print_image("images/lightning_go.png", false, array("title" => __("Critical events"), "style" => "margin-bottom: -5px;"));
|
||||
echo " ";
|
||||
|
||||
// Calculate critical events (not validated)
|
||||
|
@ -139,7 +139,7 @@
|
|||
// Calculate opened incidents (id integria incidents are not enabled)
|
||||
if ($config['integria_enabled'] == 0){
|
||||
echo "<a href='index.php?sec=incidencias&sec2=operation/incidents/incident&estado=0'>";
|
||||
html_print_image("images/book_edit.png", false, array("title" => __("Incidents opened")));
|
||||
html_print_image("images/book_edit.png", false, array("title" => __("Incidents opened"), "style" => "margin-bottom: -5px;"));
|
||||
echo " ";
|
||||
// Select only opened incidents
|
||||
$sql = "SELECT count(*) total_incidents FROM tincidencia WHERE
|
||||
|
@ -165,13 +165,13 @@
|
|||
echo " ";
|
||||
|
||||
echo "<a href='index.php?sec=reporting&sec2=operation/reporting/custom_reporting'>";
|
||||
html_print_image("images/reporting.png", false, array("title" => __("View reports")));
|
||||
html_print_image("images/reporting.png", false, array("title" => __("View reports"), "style" => "margin-bottom: -5px;"));
|
||||
echo "</a>";
|
||||
|
||||
echo " ";
|
||||
|
||||
echo "<a href='index.php?sec=messages&sec2=operation/messages/message'>";
|
||||
html_print_image("images/email.png", false, array("title" => __("Create new message")));
|
||||
html_print_image("images/email.png", false, array("title" => __("Create new message"), "style" => "margin-bottom: -5px;"));
|
||||
echo "</a>";
|
||||
|
||||
// Login in Console and shortcut bar is disabled
|
||||
|
|
|
@ -46,6 +46,14 @@ if (isset ($_GET["update_alert"]) && $_GET["update_alert"] == "-1") {
|
|||
$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);
|
||||
$custom_oid_data_1 = (string) get_parameter ("custom_oid_data_1");
|
||||
$custom_oid_data_2 = (string) get_parameter ("custom_oid_data_2");
|
||||
$custom_oid_data_3 = (string) get_parameter ("custom_oid_data_3");
|
||||
$custom_oid_data_4 = (string) get_parameter ("custom_oid_data_4");
|
||||
$custom_oid_data_5 = (string) get_parameter ("custom_oid_data_5");
|
||||
$custom_oid_data_6 = (string) get_parameter ("custom_oid_data_6");
|
||||
$trap_type = (int) get_parameter ("trap_type", -1);
|
||||
$single_value = (string) get_parameter ("single_value");
|
||||
|
||||
if ($time_threshold == -1) {
|
||||
$time_threshold = $time_other;
|
||||
|
@ -64,7 +72,15 @@ if (isset ($_GET["update_alert"]) && $_GET["update_alert"] == "-1") {
|
|||
'time_threshold' => $time_threshold,
|
||||
'max_alerts' => $max_alerts,
|
||||
'min_alerts' => $min_alerts,
|
||||
'priority' => $priority);
|
||||
'priority' => $priority,
|
||||
'_snmp_f1_' => $custom_oid_data_1,
|
||||
'_snmp_f2_' => $custom_oid_data_2,
|
||||
'_snmp_f3_' => $custom_oid_data_3,
|
||||
'_snmp_f4_' => $custom_oid_data_4,
|
||||
'_snmp_f5_' => $custom_oid_data_5,
|
||||
'_snmp_f6_' => $custom_oid_data_6,
|
||||
'trap_type' => $trap_type,
|
||||
'single_value' => $single_value);
|
||||
|
||||
$result = db_process_sql_insert('talert_snmp', $values);
|
||||
|
||||
|
@ -78,9 +94,12 @@ if (isset ($_GET["update_alert"]) && $_GET["update_alert"] == "-1") {
|
|||
} else {
|
||||
$sql = sprintf ("UPDATE talert_snmp SET
|
||||
priority = %d, id_alert = %d, al_field1 = '%s', al_field2 = '%s', al_field3 = '%s', description = '%s', agent = '%s', custom_oid = '%s',
|
||||
oid = '%s', time_threshold = %d, max_alerts = %d, min_alerts = %d WHERE id_as = %d",
|
||||
oid = '%s', time_threshold = %d, max_alerts = %d, min_alerts = %d, _snmp_f1_ = '%s', _snmp_f2_ = '%s', _snmp_f3_ = '%s', _snmp_f4_ = '%s',
|
||||
_snmp_f5_ = '%s', _snmp_f6_ = '%s', trap_type = %d, single_value = '%s'
|
||||
WHERE id_as = %d",
|
||||
$priority, $alert_type, $al_field1, $al_field2, $al_field3, $description, $source_ip, $custom_value,
|
||||
$oid, $time_threshold, $max_alerts, $min_alerts, $id_as);
|
||||
$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, $custom_oid_data_6, $trap_type, $single_value, $id_as);
|
||||
|
||||
$result = db_process_sql ($sql);
|
||||
|
||||
|
@ -113,6 +132,14 @@ if ((isset ($_GET["update_alert"])) && ($_GET["update_alert"] != -1)) {
|
|||
$max_alerts = $alert["max_alerts"];
|
||||
$min_alerts = $alert["min_alerts"];
|
||||
$priority = $alert["priority"];
|
||||
$custom_oid_data_1 = $alert["_snmp_f1_"];
|
||||
$custom_oid_data_2 = $alert["_snmp_f2_"];
|
||||
$custom_oid_data_3 = $alert["_snmp_f3_"];
|
||||
$custom_oid_data_4 = $alert["_snmp_f4_"];
|
||||
$custom_oid_data_5 = $alert["_snmp_f5_"];
|
||||
$custom_oid_data_6 = $alert["_snmp_f6_"];
|
||||
$trap_type = $alert["trap_type"];
|
||||
$single_value = $alert["single_value"];
|
||||
} elseif (isset ($_GET["update_alert"])) {
|
||||
// Variable init
|
||||
$id_as = -1;
|
||||
|
@ -128,6 +155,14 @@ if ((isset ($_GET["update_alert"])) && ($_GET["update_alert"] != -1)) {
|
|||
$max_alerts = 1;
|
||||
$min_alerts = 0;
|
||||
$priority = 0;
|
||||
$custom_oid_data_1 = '';
|
||||
$custom_oid_data_2 = '';
|
||||
$custom_oid_data_3 = '';
|
||||
$custom_oid_data_4 = '';
|
||||
$custom_oid_data_5 = '';
|
||||
$custom_oid_data_6 = '';
|
||||
$trap_type = -1;
|
||||
$single_value = '';
|
||||
}
|
||||
|
||||
// Header
|
||||
|
@ -189,13 +224,61 @@ if (isset ($_GET["update_alert"])) {
|
|||
echo '</td></tr>';
|
||||
|
||||
// Custom
|
||||
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom data');
|
||||
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Global match');
|
||||
echo ui_print_help_icon ("snmp_alert_custom", true);
|
||||
|
||||
echo '</td><td class="datos">';
|
||||
html_print_textarea ("custom_value", $custom_value, 2, $custom_value, 'style="width:400px;"');
|
||||
|
||||
echo '</td></tr>';
|
||||
|
||||
// Custom OID/Data #1
|
||||
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data #1');
|
||||
//echo ui_print_help_icon ("snmp_alert_custom", true);
|
||||
|
||||
echo '</td><td class="datos">';
|
||||
html_print_input_text ("custom_oid_data_1", $custom_oid_data_1, '', 60);
|
||||
echo '</td></tr>';
|
||||
|
||||
// Custom OID/Data #2
|
||||
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data #2');
|
||||
//echo ui_print_help_icon ("snmp_alert_custom", true);
|
||||
|
||||
echo '</td><td class="datos">';
|
||||
html_print_input_text ("custom_oid_data_2", $custom_oid_data_2, '', 60);
|
||||
echo '</td></tr>';
|
||||
|
||||
// Custom OID/Data #3
|
||||
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data #3');
|
||||
//echo ui_print_help_icon ("snmp_alert_custom", true);
|
||||
|
||||
echo '</td><td class="datos">';
|
||||
html_print_input_text ("custom_oid_data_3", $custom_oid_data_3, '', 60);
|
||||
echo '</td></tr>';
|
||||
|
||||
// Custom OID/Data #4
|
||||
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data #4');
|
||||
//echo ui_print_help_icon ("snmp_alert_custom", true);
|
||||
|
||||
echo '</td><td class="datos">';
|
||||
html_print_input_text ("custom_oid_data_4", $custom_oid_data_4, '', 60);
|
||||
echo '</td></tr>';
|
||||
|
||||
// Custom OID/Data #5
|
||||
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data #5');
|
||||
//echo ui_print_help_icon ("snmp_alert_custom", true);
|
||||
|
||||
echo '</td><td class="datos">';
|
||||
html_print_input_text ("custom_oid_data_5", $custom_oid_data_5, '', 60);
|
||||
echo '</td></tr>';
|
||||
|
||||
// Custom OID/Data #6
|
||||
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data #6');
|
||||
//echo ui_print_help_icon ("snmp_alert_custom", true);
|
||||
|
||||
echo '</td><td class="datos">';
|
||||
html_print_input_text ("custom_oid_data_6", $custom_oid_data_6, '', 60);
|
||||
echo '</td></tr>';
|
||||
|
||||
// SNMP Agent
|
||||
echo '<tr id="tr-source_ip"><td class="datos2">'.__('SNMP Agent').' (IP)</td><td class="datos2">';
|
||||
|
@ -252,6 +335,17 @@ if (isset ($_GET["update_alert"])) {
|
|||
echo html_print_select (get_priorities (), "priority", $priority, '', '', '0', false, false, false);
|
||||
echo '</td></tr>';
|
||||
|
||||
// Trap type
|
||||
echo '<tr><td class="datos">'.__('Trap type').'</td><td class="datos">';
|
||||
$trap_types = array(0 => 'Cold start (0)', 1 => 'Warm start (1)', 2 => 'Link down (2)', 3 => 'Link up (3)', 4 => 'Authentication failure (4)', -1 => 'Other');
|
||||
echo html_print_select ($trap_types, 'trap_type', $trap_type, '', '', '', false, false, false);
|
||||
echo '</td></tr>';
|
||||
|
||||
// Single value
|
||||
echo '<tr><td class="datos">'.__('Single value').'</td><td class="datos">';
|
||||
html_print_input_text ("single_value", $single_value, '', 20);
|
||||
echo '</td></tr>';
|
||||
|
||||
//Button
|
||||
echo '<tr><td></td><td align="right">';
|
||||
if ($id_as > 0) {
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
*/
|
||||
?>
|
||||
|
||||
<h1>Custom data</h1>
|
||||
<h1>Global match</h1>
|
||||
|
||||
<p>This search in the trap "Value" fields, and also in the fields "Custom OID" and "Custom Value", that is, in the rest of the TRAP fields.</p>
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
*/
|
||||
?>
|
||||
|
||||
<h1>Custom data</h1>
|
||||
<h1>Global match</h1>
|
||||
|
||||
<p>Campos personalizados enviados en el trap. Pueden ser datos muy complejos, que tengan una lógica específica en función del dispositivo que envía el trap. Un trap puede enviar varios datos en este campo.</p>
|
||||
|
|
|
@ -40,8 +40,9 @@ $search_string = (string) get_parameter ("search_string", '');
|
|||
$free_search_string = (string) get_parameter ("free_search_string", '');
|
||||
$pagination = (int) get_parameter ("pagination", $config["block_size"]);
|
||||
$offset = (int) get_parameter ('offset',0);
|
||||
$trap_type = (int) get_parameter ('trap_type', -1);
|
||||
|
||||
$url = "index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&filter_agent=".$filter_agent."&filter_oid=".$filter_oid."&filter_severity=".$filter_severity."&filter_fired=".$filter_fired."&search_string=".$search_string."&free_search_string=".$free_search_string."&pagination=".$pagination."&offset=".$offset;
|
||||
$url = "index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&filter_agent=".$filter_agent."&filter_oid=".$filter_oid."&filter_severity=".$filter_severity."&filter_fired=".$filter_fired."&search_string=".$search_string."&free_search_string=".$free_search_string."&pagination=".$pagination."&offset=".$offset . "&trap_type=" . $trap_type;
|
||||
|
||||
|
||||
if ($config["pure"]) {
|
||||
|
@ -277,7 +278,14 @@ if ($filter_severity != -1) {
|
|||
}
|
||||
if ($filter_status != -1)
|
||||
$whereSubquery .= ' AND status = ' . $filter_status;
|
||||
|
||||
|
||||
if ($trap_type == -1) {
|
||||
$whereSubquery .= ' AND type NOT IN (0, 1, 2, 3, 4)';
|
||||
}
|
||||
else {
|
||||
$whereSubquery .= ' AND type = ' . $trap_type;
|
||||
}
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = sprintf($sql, $whereSubquery, $offset, $pagination);
|
||||
|
@ -341,6 +349,11 @@ $table->data[3][1] = html_print_select ($status, 'filter_status', $filter_status
|
|||
$table->data[3][3] = '<strong>'.__('Free search').'</strong>' . ui_print_help_tip(__('Search by any alphanumeric field in the trap'), true);
|
||||
$table->data[3][4] = html_print_input_text ('free_search_string', $free_search_string, '', 40, 0, true);
|
||||
|
||||
// Type filter (ColdStart, WarmStart, LinkDown, LinkUp, authenticationFailure, Other)
|
||||
$table->data[4][1] = '<strong>'.__('Type').'</strong>' . ui_print_help_tip(__('Search by trap type'), true);
|
||||
$trap_types = array(0 => 'Cold start (0)', 1 => 'Warm start (1)', 2 => 'Link down (2)', 3 => 'Link up (3)', 4 => 'Authentication failure (4)', -1 => 'Other');
|
||||
$table->data[4][2] = html_print_select ($trap_types, 'trap_type', $trap_type, 'this.form.submit();', '', '', true, false, false);
|
||||
|
||||
$filter = '<form method="POST" action="index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_view&refr='.$config["refr"].'&pure='.$config["pure"].'">';
|
||||
$filter .= html_print_table($table, true);
|
||||
$filter .= '<div style="width: ' . $table->width . '; text-align: right;">';
|
||||
|
|
|
@ -243,7 +243,15 @@ CREATE TABLE talert_snmp (
|
|||
max_alerts NUMBER(10, 0) default 1 NOT NULL,
|
||||
min_alerts NUMBER(10, 0) default 1 NOT NULL,
|
||||
internal_counter NUMBER(10, 0) default 0 NOT NULL,
|
||||
priority NUMBER(10, 0) default 0
|
||||
priority NUMBER(10, 0) default 0,
|
||||
_snmp_f1_ CLOB default '',
|
||||
_snmp_f2_ CLOB default '',
|
||||
_snmp_f3_ CLOB default '',
|
||||
_snmp_f4_ CLOB default '',
|
||||
_snmp_f5_ CLOB default '',
|
||||
_snmp_f6_ CLOB default '',
|
||||
trap_type NUMBER(10, 0) DEFAULT -1 NOT NULL,
|
||||
single_value VARCHAR2(255) DEFAULT ''
|
||||
);
|
||||
|
||||
CREATE SEQUENCE talert_snmp_s INCREMENT BY 1 START WITH 1;
|
||||
|
|
|
@ -217,7 +217,15 @@ CREATE TABLE "talert_snmp" (
|
|||
"max_alerts" INTEGER NOT NULL default 1,
|
||||
"min_alerts" INTEGER NOT NULL default 1,
|
||||
"internal_counter" INTEGER NOT NULL default 0,
|
||||
"priority" INTEGER default 0
|
||||
"priority" INTEGER default 0,
|
||||
"_snmp_f1_" text DEFAULT '',
|
||||
"_snmp_f2_" text DEFAULT '',
|
||||
"_snmp_f3_" text DEFAULT '',
|
||||
"_snmp_f4_" text DEFAULT '',
|
||||
"_snmp_f5_" text DEFAULT '',
|
||||
"_snmp_f6_" text DEFAULT '',
|
||||
"trap_type" INTEGER NOT NULL DEFAULT '-1',
|
||||
"single_value" varchar(255) DEFAULT ''
|
||||
);
|
||||
|
||||
CREATE TABLE "talert_commands" (
|
||||
|
|
|
@ -225,6 +225,14 @@ CREATE TABLE IF NOT EXISTS `talert_snmp` (
|
|||
`min_alerts` int(11) NOT NULL default '1',
|
||||
`internal_counter` int(2) unsigned NOT NULL default '0',
|
||||
`priority` tinyint(4) default '0',
|
||||
`_snmp_f1_` text DEFAULT '',
|
||||
`_snmp_f2_` text DEFAULT '',
|
||||
`_snmp_f3_` text DEFAULT '',
|
||||
`_snmp_f4_` text DEFAULT '',
|
||||
`_snmp_f5_` text DEFAULT '',
|
||||
`_snmp_f6_` text DEFAULT '',
|
||||
`trap_type` int(11) NOT NULL default '-1',
|
||||
`single_value` varchar(255) default '',
|
||||
PRIMARY KEY (`id_as`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
|
Loading…
Reference in New Issue