From 4f4d63d8ea2c75a10c33803deaa0f30134ec359c Mon Sep 17 00:00:00 2001 From: John Fleming Date: Fri, 3 Jun 2005 01:50:01 +0000 Subject: Add support for trap and snmp writes (currenly disabled). Make menu look more like some of the others. Add support for snmp trap server and snmp write strings. Write community strings are currently disabled. --- usr/local/www/services_snmp.php | 176 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 162 insertions(+), 14 deletions(-) (limited to 'usr/local/www') diff --git a/usr/local/www/services_snmp.php b/usr/local/www/services_snmp.php index 154f826..02ebd02 100755 --- a/usr/local/www/services_snmp.php +++ b/usr/local/www/services_snmp.php @@ -37,10 +37,17 @@ if (!is_array($config['snmpd'])) { $config['snmpd']['rocommunity'] = "public"; } +$pconfig['enable'] = isset($config['snmpd']['enable']); $pconfig['syslocation'] = $config['snmpd']['syslocation']; $pconfig['syscontact'] = $config['snmpd']['syscontact']; $pconfig['rocommunity'] = $config['snmpd']['rocommunity']; -$pconfig['enable'] = isset($config['snmpd']['enable']); +/* disabled until some docs show up on what this does. +$pconfig['rwenable'] = isset($config['snmpd']['rwenable']); +$pconfig['rwcommunity'] = $config['snmpd']['rwcommunity']; +*/ +$pconfig['trapenable'] = isset($config['snmpd']['trapenable']); +$pconfig['trapserver'] = $config['snmpd']['trapserver']; +$pconfig['trapserverport'] = $config['snmpd']['trapserverport']; if ($_POST) { @@ -55,11 +62,38 @@ if ($_POST) { do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); } + if ($_POST['trapenable']) { + $reqdfields = explode(" ", "trapserver"); + $reqdfieldsn = explode(",", "Trap server"); + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + $reqdfields = explode(" ", "trapserverport"); + $reqdfieldsn = explode(",", "Trap server port"); + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + } + +/* disabled until some docs show up on what this does. + if ($_POST['rwenable']) { + $reqdfields = explode(" ", "rwcommunity"); + $reqdfieldsn = explode(",", "Write community string"); + do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); + } +*/ + + + if (!$input_errors) { + $config['snmpd']['enable'] = $_POST['enable'] ? true : false; $config['snmpd']['syslocation'] = $_POST['syslocation']; $config['snmpd']['syscontact'] = $_POST['syscontact']; $config['snmpd']['rocommunity'] = $_POST['rocommunity']; - $config['snmpd']['enable'] = $_POST['enable'] ? true : false; + /* disabled until some docs show up on what this does. + $config['snmpd']['rwenable'] = $_POST['rwenable'] ? true : false; + $config['snmpd']['rwcommunity'] = $_POST['rwcommunity']; + */ + $config['snmpd']['trapenable'] = $_POST['trapenable'] ? true : false; + $config['snmpd']['trapserver'] = $_POST['trapserver']; + $config['snmpd']['trapserverport'] = $_POST['trapserverport']; + write_config(); @@ -81,12 +115,77 @@ if ($_POST) { @@ -99,11 +198,13 @@ function enable_change(enable_change) {
+ - - + @@ -118,12 +219,59 @@ function enable_change(enable_change) { - + + + + + + + + + + + + + + */ +?> + + + + + + + + + + + + + + + + + +
  - onClick="enable_change(false)"> - Enable SNMP agent + + + +
SNMP Daemon onClick="enable_change(this)"> Enable
System location
CommunityRead Community String
In most cases, "public" is used here
  + onClick="enable_change(this)"> + Enable Write Community String
Write community string + +
+ Please use something other then "private" here
  + onClick="enable_change(this)"> + Enable SNMP Traps
Trap server + +
+ Enter trap server name
Trap server port + +
+ Enter the port to send the traps to (default 162)
  @@ -134,7 +282,7 @@ function enable_change(enable_change) { -- cgit v1.1