2013-07-10 Ramon Novoa <rnovoa@artica.es>

* extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
	  extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
	  extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
	  godmode/snmpconsole/snmp_alert.php,
	  pandoradb.sql,
	  pandoradb.postgreSQL.sql,
	  pandoradb.oracle.sql,
	  operation/snmpconsole/snmp_view.php: Added support to filter 10
	  binding vars. Added binding var automatic translation and other
	  small improvements.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8511 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
ramonn 2013-07-10 16:49:05 +00:00
parent 5cd2e75710
commit 454db840e5
9 changed files with 105 additions and 11 deletions

View File

@ -1,3 +1,16 @@
2013-07-10 Ramon Novoa <rnovoa@artica.es>
* extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
godmode/snmpconsole/snmp_alert.php,
pandoradb.sql,
pandoradb.postgreSQL.sql,
pandoradb.oracle.sql,
operation/snmpconsole/snmp_view.php: Added support to filter 10
binding vars. Added binding var automatic translation and other
small improvements.
2013-07-10 Miguel de Dios <miguel.dedios@artica.es>
* mobile/operation/agents.php: fixed lost semicolon.

View File

@ -151,7 +151,9 @@ ALTER TABLE `tgrupo` ADD COLUMN `other` text;
-- Table `talert_snmp`
-- ----------------------------------------------------------------------
ALTER TABLE `talert_snmp` ADD COLUMN (`_snmp_f1_` text, `_snmp_f2_` text, `_snmp_f3_` text,
`_snmp_f4_` text, `_snmp_f5_` text, `_snmp_f6_` text, `trap_type` int(11) NOT NULL default '-1',
`_snmp_f4_` text, `_snmp_f5_` text, `_snmp_f6_` text,
`_snmp_f7_` text, `_snmp_f8_` text, `_snmp_f9_` text,
`_snmp_f10_` text, `trap_type` int(11) NOT NULL default '-1',
`single_value` varchar(255) DEFAULT '');
ALTER TABLE `talert_snmp` ADD COLUMN `al_field4` text NOT NULL;
ALTER TABLE `talert_snmp` ADD COLUMN `al_field5` text NOT NULL;
@ -160,6 +162,10 @@ 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;
ALTER TABLE `talert_snmp` ADD COLUMN `_snmp_f7_` text NOT NULL;
ALTER TABLE `talert_snmp` ADD COLUMN `_snmp_f8_` text NOT NULL;
ALTER TABLE `talert_snmp` ADD COLUMN `_snmp_f9_` text NOT NULL;
ALTER TABLE `talert_snmp` ADD COLUMN `_snmp_f10_` text NOT NULL;
-- ----------------------------------------------------------------------
-- Table `tagente_modulo`
@ -1108,6 +1114,8 @@ ALTER TABLE tevento ADD INDEX `idx_utimestamp` USING BTREE (`utimestamp`);
ALTER TABLE tserver DROP INDEX keepalive;
ALTER TABLE tserver DROP INDEX status;
ALTER TABLE ttrap ADD INDEX `source` USING BTREE (`source`);
-- ---------------------------------------------------------------------
-- Adapt the talert commands to new macro system
-- ---------------------------------------------------------------------

View File

@ -184,6 +184,10 @@ 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 (_snmp_f7_ CLOB default '');
ALTER TABLE talert_snmp ADD (_snmp_f8_ CLOB default '');
ALTER TABLE talert_snmp ADD (_snmp_f9_ CLOB default '');
ALTER TABLE talert_snmp ADD (_snmp_f10_ 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 '');
ALTER TABLE talert_snmp ADD (al_field4 CLOB default '');
@ -193,6 +197,7 @@ ALTER TABLE talert_snmp ADD (al_field7 CLOB default '');
ALTER TABLE talert_snmp ADD (al_field8 CLOB default '');
ALTER TABLE talert_snmp ADD (al_field9 CLOB default '');
ALTER TABLE talert_snmp ADD (al_field10 CLOB default '');
ALTER TABLE talert_snmp ADD (al_field10 CLOB default '');
-- ---------------------------------------------------------------------
-- Table tevent_filter

View File

@ -176,6 +176,10 @@ 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 "_snmp_f7_" text DEFAULT '';
ALTER TABLE "talert_snmp" ADD COLUMN "_snmp_f8_" text DEFAULT '';
ALTER TABLE "talert_snmp" ADD COLUMN "_snmp_f9_" text DEFAULT '';
ALTER TABLE "talert_snmp" ADD COLUMN "_snmp_f10_" 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 "al_field4" text NOT NULL default '';

View File

@ -64,6 +64,10 @@ else if (isset ($_GET["submit"])) {
$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");
$custom_oid_data_7 = (string) get_parameter ("custom_oid_data_7");
$custom_oid_data_8 = (string) get_parameter ("custom_oid_data_8");
$custom_oid_data_9 = (string) get_parameter ("custom_oid_data_9");
$custom_oid_data_10 = (string) get_parameter ("custom_oid_data_10");
$trap_type = (int) get_parameter ("trap_type", -1);
$single_value = (string) get_parameter ("single_value");
@ -98,6 +102,10 @@ else if (isset ($_GET["submit"])) {
'_snmp_f4_' => $custom_oid_data_4,
'_snmp_f5_' => $custom_oid_data_5,
'_snmp_f6_' => $custom_oid_data_6,
'_snmp_f7_' => $custom_oid_data_7,
'_snmp_f8_' => $custom_oid_data_8,
'_snmp_f9_' => $custom_oid_data_9,
'_snmp_f10_' => $custom_oid_data_10,
'trap_type' => $trap_type,
'single_value' => $single_value);
@ -124,7 +132,8 @@ else if (isset ($_GET["submit"])) {
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'
_snmp_f7_ = '%s', _snmp_f8_ = '%s', _snmp_f9_ = '%s',
_snmp_f10_ = '%s', 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,
@ -132,7 +141,8 @@ else if (isset ($_GET["submit"])) {
$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,
$custom_oid_data_6, $trap_type, $single_value, $id_as);
$custom_oid_data_6, $custom_oid_data_7, $custom_oid_data_8,
$custom_oid_data_9, $custom_oid_data_10, $trap_type, $single_value, $id_as);
$result = db_process_sql ($sql);
@ -181,6 +191,10 @@ if ((isset ($_GET["update_alert"])) && ($_GET["update_alert"] != -1)) {
$custom_oid_data_4 = $alert["_snmp_f4_"];
$custom_oid_data_5 = $alert["_snmp_f5_"];
$custom_oid_data_6 = $alert["_snmp_f6_"];
$custom_oid_data_7 = $alert["_snmp_f7_"];
$custom_oid_data_8 = $alert["_snmp_f8_"];
$custom_oid_data_9 = $alert["_snmp_f9_"];
$custom_oid_data_10 = $alert["_snmp_f10_"];
$trap_type = $alert["trap_type"];
$single_value = $alert["single_value"];
}
@ -212,6 +226,10 @@ elseif (isset ($_GET["update_alert"])) {
$custom_oid_data_4 = '';
$custom_oid_data_5 = '';
$custom_oid_data_6 = '';
$custom_oid_data_7 = '';
$custom_oid_data_8 = '';
$custom_oid_data_9 = '';
$custom_oid_data_10 = '';
$trap_type = -1;
$single_value = '';
}
@ -327,7 +345,31 @@ if (isset ($_GET["update_alert"])) {
echo '</td><td class="datos">';
html_print_input_text ("custom_oid_data_6", $custom_oid_data_6, '', 60);
echo '</td></tr>';
// Custom OID/Data #7
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data #7');
echo '</td><td class="datos">';
html_print_input_text ("custom_oid_data_7", $custom_oid_data_7, '', 60);
echo '</td></tr>';
// Custom OID/Data #8
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data #8');
echo '</td><td class="datos">';
html_print_input_text ("custom_oid_data_8", $custom_oid_data_8, '', 60);
echo '</td></tr>';
// Custom OID/Data #9
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data #9');
echo '</td><td class="datos">';
html_print_input_text ("custom_oid_data_9", $custom_oid_data_9, '', 60);
echo '</td></tr>';
// Custom OID/Data #10
echo '<tr id="tr-custom_value"><td class="datos" valign="top">'.__('Custom OID/Data #10');
echo '</td><td class="datos">';
html_print_input_text ("custom_oid_data_10", $custom_oid_data_10, '', 60);
echo '</td></tr>';
//Button
//echo '<tr><td></td><td align="right">';

View File

@ -150,7 +150,7 @@ switch ($config["dbtype"]) {
}
$traps = db_get_all_rows_sql ($sql);
// All traps
$all_traps = db_get_all_rows_sql ("SELECT * FROM ttrap");
$all_traps = db_get_all_rows_sql ("SELECT DISTINCT source FROM ttrap");
if (($config['dbtype'] == 'oracle') && ($traps !== false)) {
for ($i=0; $i < count($traps); $i++) {
@ -364,10 +364,11 @@ $table->data[2][3] = html_print_select ($severities, 'filter_severity', $filter_
// Status
$table->data[3][0] = '<strong>'.__('Status').'</strong>';
$status[-1] = __('All');
$status[0] = __('Not validated');
$status[1] = __('Validated');
$table->data[3][1] = html_print_select ($status, 'filter_status', $filter_status, 'this.form.submit();', '', '', true);
$status_array[-1] = __('All');
$status_array[0] = __('Not validated');
$status_array[1] = __('Validated');
$table->data[3][1] = html_print_select ($status_array, 'filter_status', $filter_status, 'this.form.submit();', '', '', true);
// Free search (search by all alphanumeric fields)
$table->data[3][3] = '<strong>'.__('Free search').'</strong>' . ui_print_help_tip(__('Search by any alphanumeric field in the trap'), true);
@ -572,7 +573,15 @@ if ($traps !== false) {
$string = '<table style="border:solid 1px #D3D3D3;" width="90%" class="toggle">
<tr>
<td align="left" valign="top" width="15%" ><b>' . __('Custom data:') . '</b></td>
<td align="left" >' . $trap['oid_custom'] . '</td>
<td align="left" >';
// Print binding vars separately
$binding_vars = explode ("\t", $trap['oid_custom']);
foreach ($binding_vars as $var) {
$string .= $var . "<br/>";
}
$string .= '</td>
</tr>
<tr>
<td align="left" valign="top">' . '<b>' . __('OID:') . '</td>

View File

@ -297,6 +297,10 @@ CREATE TABLE talert_snmp (
_snmp_f4_ CLOB default '',
_snmp_f5_ CLOB default '',
_snmp_f6_ CLOB default '',
_snmp_f7_ CLOB default '',
_snmp_f8_ CLOB default '',
_snmp_f9_ CLOB default '',
_snmp_f10_ CLOB default '',
trap_type NUMBER(10, 0) DEFAULT -1 NOT NULL,
single_value VARCHAR2(255) DEFAULT ''
);

View File

@ -281,6 +281,10 @@ CREATE TABLE "talert_snmp" (
"_snmp_f4_" text DEFAULT '',
"_snmp_f5_" text DEFAULT '',
"_snmp_f6_" text DEFAULT '',
"_snmp_f7_" text DEFAULT '',
"_snmp_f8_" text DEFAULT '',
"_snmp_f9_" text DEFAULT '',
"_snmp_f10_" text DEFAULT '',
"trap_type" INTEGER NOT NULL DEFAULT '-1',
"single_value" varchar(255) DEFAULT ''
);

View File

@ -287,6 +287,10 @@ CREATE TABLE IF NOT EXISTS `talert_snmp` (
`_snmp_f4_` text,
`_snmp_f5_` text,
`_snmp_f6_` text,
`_snmp_f7_` text,
`_snmp_f8_` text,
`_snmp_f9_` text,
`_snmp_f10_` text,
`trap_type` int(11) NOT NULL default '-1',
`single_value` varchar(255) default '',
PRIMARY KEY (`id_as`)
@ -862,7 +866,8 @@ CREATE TABLE IF NOT EXISTS `ttrap` (
`severity` tinyint(4) unsigned NOT NULL default '2',
PRIMARY KEY (`id_trap`),
INDEX timestamp (`timestamp`),
INDEX status (`status`)
INDEX status (`status`),
INDEX source (`source`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------------------------------------------------