2010-08-12 Ramon Novoa <rnovoa@artica.es>
* include/functions_alerts.php, godmode/alerts/configure_alert_template.php: Added support for unknown status alerts. * pandoradb.sql, godmode/menu.php, extras/pandoradb_migrate_v3.1_to_v3.2.sql: Added support for SNMP filters. * godmode/snmpconsole/snmp_filters.php: Added to repository. SNMP filter editor. * operation/snmpconsole/snmp_view.php: Fixed header placement. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3132 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
ca81d757cc
commit
1e1c97f2b2
|
@ -1,3 +1,18 @@
|
|||
2010-08-12 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* include/functions_alerts.php,
|
||||
godmode/alerts/configure_alert_template.php: Added support for
|
||||
unknown status alerts.
|
||||
|
||||
* pandoradb.sql, godmode/menu.php,
|
||||
extras/pandoradb_migrate_v3.1_to_v3.2.sql: Added support for SNMP
|
||||
filters.
|
||||
|
||||
* godmode/snmpconsole/snmp_filters.php: Added to repository. SNMP
|
||||
filter editor.
|
||||
|
||||
* operation/snmpconsole/snmp_view.php: Fixed header placement.
|
||||
|
||||
2010-08-12 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_html.php: Added the function html2rgb for
|
||||
|
|
|
@ -73,3 +73,21 @@ ALTER TABLE `tagente_modulo` ADD COLUMN `id_policy_module` INTEGER UNSIGNED NOT
|
|||
-- Table `talert_template_modules`
|
||||
-- -----------------------------------------------------
|
||||
ALTER TABLE `talert_template_modules` ADD COLUMN `id_policy_alerts` int(10) unsigned NOT NULL default '0';
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tsnmp_filter`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tsnmp_filter` (
|
||||
`id_snmp_filter` int(10) unsigned NOT NULL auto_increment,
|
||||
`description` varchar(255) default '',
|
||||
`filter` varchar(255) default '',
|
||||
PRIMARY KEY (`id_snmp_filter`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `talert_templates`
|
||||
-- -----------------------------------------------------
|
||||
ALTER TABLE `talert_templates` MODIFY COLUMN `type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critica
|
||||
l', 'onchange', 'unknown');
|
||||
|
||||
|
|
|
@ -530,6 +530,7 @@ var warning = "<?php echo __('The alert would fire when the module is in warning
|
|||
var critical = "<?php echo __('The alert would fire when the module is in critical status');?>";
|
||||
var onchange = "<?php echo __('The alert would fire when the module value changes');?>";
|
||||
var onchange_not = "<?php echo __('The alert would fire when the module value does not change');?>";
|
||||
var unknown = "<?php echo __('The alert would fire when the module is in unknown status');?>";
|
||||
|
||||
function check_regex () {
|
||||
if ($("#type").attr ('value') != 'regex') {
|
||||
|
@ -656,6 +657,13 @@ $(document).ready (function () {
|
|||
else
|
||||
$("span#example").empty ().append (onchange_not);
|
||||
break;
|
||||
case "unknown":
|
||||
$("#template-value, #template-max, span#matches_value, #template-min").hide ();
|
||||
$("#template-example").show ();
|
||||
|
||||
/* Show example */
|
||||
$("span#example").empty ().append (unknown);
|
||||
break;
|
||||
default:
|
||||
$("#template-value, #template-max, #template-min, #template-example, span#matches_value").hide ();
|
||||
break;
|
||||
|
|
|
@ -102,6 +102,7 @@ if (give_acl($config['id_user'], 0, "LW")) {
|
|||
|
||||
$sub = array ();
|
||||
//$sub["godmode/snmpconsole/snmp_alert"]["text"] = __('Component groups');
|
||||
$sub['godmode/snmpconsole/snmp_filters']['text'] = __('SNMP filters');
|
||||
|
||||
enterprise_hook ('snmpconsole_submenu');
|
||||
|
||||
|
|
|
@ -0,0 +1,146 @@
|
|||
<?php
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
|
||||
// Check ACL
|
||||
if (! give_acl ($config['id_user'], 0, "LW")) {
|
||||
audit_db ($config['id_user'], $_SERVER['REMOTE_ADDR'], "ACL Violation",
|
||||
"Trying to access SNMP Filter Management");
|
||||
require ("general/noaccess.php");
|
||||
return;
|
||||
}
|
||||
|
||||
// Global variables
|
||||
$edit_filter = (int) get_parameter ('edit_filter', -2);
|
||||
$update_filter = (int) get_parameter ('update_filter', -2);
|
||||
$delete_filter = (int) get_parameter ('delete_filter', -1);
|
||||
$description = (string) get_parameter ('description', '');
|
||||
$filter = (string) get_parameter ('filter', '');
|
||||
|
||||
// Create/update header
|
||||
if ($edit_filter > -2) {
|
||||
if ($edit_filter > -1) {
|
||||
print_page_header (__('SNMP Console')." » ".__('Update filter'), "images/computer_error.png", false, "", true);
|
||||
} else {
|
||||
print_page_header (__('SNMP Console')." » ".__('Create filter'), "images/computer_error.png", false, "", true);
|
||||
}
|
||||
// Overview header
|
||||
} else {
|
||||
print_page_header (__('SNMP Console')." » ".__('Filter overview'), "images/computer_error.png", false, "", true);
|
||||
}
|
||||
|
||||
// Create/update filter
|
||||
if ($update_filter > -2) {
|
||||
if ($update_filter > -1) {
|
||||
$sql = sprintf ("UPDATE tsnmp_filter SET description = '%s', filter = '%s' WHERE id_snmp_filter = %d", $description, $filter, $update_filter);
|
||||
if (process_sql ($sql) === false) {
|
||||
print_error_message (__('There was a problem updating the filter'));
|
||||
} else {
|
||||
print_success_message (__('Successfully updated'));
|
||||
}
|
||||
} else {
|
||||
$sql = sprintf ("INSERT INTO tsnmp_filter (description, filter) VALUES ('%s', '%s')", $description, $filter);
|
||||
if (process_sql ($sql) === false) {
|
||||
print_error_message (__('There was a problem creating the filter'));
|
||||
} else {
|
||||
print_success_message (__('Successfully created'));
|
||||
}
|
||||
}
|
||||
// Delete
|
||||
} else if ($delete_filter > -1) {
|
||||
$sql = sprintf ("DELETE FROM tsnmp_filter WHERE id_snmp_filter = %d", $delete_filter);
|
||||
if (process_sql ($sql) === false) {
|
||||
print_error_message (__('There was a problem deleting the filter'));
|
||||
} else {
|
||||
print_success_message (__('Successfully deleted'));
|
||||
}
|
||||
}
|
||||
|
||||
// Read filter data from the database
|
||||
if ($edit_filter > -1) {
|
||||
$filter = get_db_row ('tsnmp_filter', 'id_snmp_filter', $edit_filter);
|
||||
if ($filter !== false) {
|
||||
$description = $filter['description'];
|
||||
$filter = $filter['filter'];
|
||||
}
|
||||
}
|
||||
|
||||
// Create/update form
|
||||
if ($edit_filter > -2) {
|
||||
$table->data = array ();
|
||||
$table->width = '90%';
|
||||
$table->data[0][0] = __('Description');
|
||||
$table->data[0][1] = print_input_text ('description', $description, '', 60, 100, true);
|
||||
$table->data[1][0] = __('Filter');
|
||||
$table->data[1][1] = print_input_text ('filter', $filter, '', 60, 100, true);
|
||||
|
||||
echo '<form action="index.php?sec=gsnmpconsole&sec2=godmode/snmpconsole/snmp_filters" method="post">';
|
||||
print_input_hidden ('update_filter', $edit_filter);
|
||||
print_table ($table);
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
if ($edit_filter > -1) {
|
||||
print_submit_button (__('Update'), 'submit_button', false, 'class="sub upd"');
|
||||
} else {
|
||||
print_submit_button (__('Create'), 'submit_button', false, 'class="sub upd"');
|
||||
}
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
// Overview
|
||||
} else {
|
||||
$result = get_db_all_rows_in_table ("tsnmp_filter");
|
||||
if ($result === false) {
|
||||
$result = array ();
|
||||
echo "<div class='nf'>".__('There are no SNMP filters')."</div>";
|
||||
}
|
||||
|
||||
$table->data = array ();
|
||||
$table->head = array ();
|
||||
$table->size = array ();
|
||||
$table->cellpadding = 4;
|
||||
$table->cellspacing = 4;
|
||||
$table->width = 750;
|
||||
$table->class= "databox";
|
||||
$table->align = array ();
|
||||
|
||||
$table->head[0] = __('Description');
|
||||
$table->head[1] = __('Filter');
|
||||
$table->head[2] = __('Action');
|
||||
$table->size[2] = 50;
|
||||
$table->align[2] = 'right';
|
||||
|
||||
foreach ($result as $row) {
|
||||
$data = array ();
|
||||
$data[0] = $row['description'];
|
||||
$data[1] = $row['filter'];
|
||||
$data[2] = '<a href="index.php?sec=gsnmpconsole&sec2=godmode/snmpconsole/snmp_filters&delete_filter='.$row['id_snmp_filter'].'">
|
||||
<img src="images/cross.png" border="0" alt="'.__('Delete').'"></a>
|
||||
<a href="index.php?sec=gsnmpconsole&sec2=godmode/snmpconsole/snmp_filters&edit_filter='.$row['id_snmp_filter'].'">
|
||||
<img src="images/config.png" border="0" alt="'.__('Update').'"></a>';
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
|
||||
if (!empty ($table->data)) {
|
||||
print_table ($table);
|
||||
}
|
||||
|
||||
unset ($table);
|
||||
|
||||
echo '<div style="text-align:right; width:740px">';
|
||||
echo '<form name="agente" method="post" action="index.php?sec=gsnmpconsole&sec2=godmode/snmpconsole/snmp_filters&edit_filter=-1">';
|
||||
print_submit_button (__('Create'), 'submit_button', false, 'class="sub next"');
|
||||
echo '</form></div>';
|
||||
}
|
||||
|
||||
?>
|
|
@ -215,7 +215,8 @@ function get_alert_templates_types () {
|
|||
$types['not_equal'] = __('Not equal to');
|
||||
$types['warning'] = __('Warning status');
|
||||
$types['critical'] = __('Critical status');
|
||||
$types['onchange'] = __('On Change');
|
||||
$types['unknown'] = __('Unknown status');
|
||||
$types['onchange'] = __('On Change');
|
||||
|
||||
return $types;
|
||||
}
|
||||
|
|
|
@ -39,6 +39,16 @@ $pagination = (int) get_parameter ("pagination", $config["block_size"]);
|
|||
$offset = (int) get_parameter ('offset',0);
|
||||
$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."&pagination=".$pagination."&offset=".$offset;
|
||||
|
||||
if ($config["pure"]) {
|
||||
$link = '<a target="_top" href="'.$url.'&pure=0&refr=30"><img src="images/normalscreen.png" title="'.__('Normal screen').'" /></a>';
|
||||
} else {
|
||||
// Fullscreen
|
||||
$link = '<a target="_top" href="'.$url.'&pure=1&refr=0"><img src="images/fullscreen.png" title="'.__('Full screen').'"/></a>';
|
||||
}
|
||||
|
||||
// Header
|
||||
print_page_header (__("SNMP Console"), "images/computer_error.png", false, "", false, $link);
|
||||
|
||||
// OPERATIONS
|
||||
|
||||
// Delete SNMP Trap entry Event (only incident management access).
|
||||
|
@ -99,17 +109,6 @@ if (isset ($_POST["updatebt"])) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($config["pure"]) {
|
||||
$link = '<a target="_top" href="'.$url.'&pure=0&refr=30"><img src="images/normalscreen.png" title="'.__('Normal screen').'" /></a>';
|
||||
} else {
|
||||
// Fullscreen
|
||||
$link = '<a target="_top" href="'.$url.'&pure=1&refr=0"><img src="images/fullscreen.png" title="'.__('Full screen').'"/></a>';
|
||||
}
|
||||
|
||||
// Header
|
||||
print_page_header (__("SNMP Console"), "images/computer_error.png", false, "", false, $link);
|
||||
|
||||
|
||||
$sql = sprintf ("SELECT * FROM ttrap ORDER BY timestamp DESC LIMIT %d,%d",$offset,$config['block_size']);
|
||||
$traps = get_db_all_rows_sql ($sql);
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ CREATE TABLE IF NOT EXISTS `talert_templates` (
|
|||
`field1` varchar(255) default '',
|
||||
`field2` varchar(255) default '',
|
||||
`field3` mediumtext NOT NULL,
|
||||
`type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical', 'onchange'),
|
||||
`type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal', 'warning', 'critical', 'onchange', 'unknown'),
|
||||
`value` varchar(255) default '',
|
||||
`matches_value` tinyint(1) default 0,
|
||||
`max_value` double(18,2) default NULL,
|
||||
|
@ -1126,4 +1126,14 @@ CREATE TABLE IF NOT EXISTS `tnetwork_map` (
|
|||
PRIMARY KEY (`id_networkmap`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `tsnmp_filter`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `tsnmp_filter` (
|
||||
`id_snmp_filter` int(10) unsigned NOT NULL auto_increment,
|
||||
`description` varchar(255) default '',
|
||||
`filter` varchar(255) default '',
|
||||
PRIMARY KEY (`id_snmp_filter`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
|
Loading…
Reference in New Issue