summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorJohn Fleming <strgout@pfsense.org>2005-06-03 01:50:01 +0000
committerJohn Fleming <strgout@pfsense.org>2005-06-03 01:50:01 +0000
commit4f4d63d8ea2c75a10c33803deaa0f30134ec359c (patch)
tree65528ba98fa6ef68d53258e35807ec05ddea795b /usr
parent142da8f7c9267319cf5b0f380ea9664b2304e06d (diff)
downloadpfsense-4f4d63d8ea2c75a10c33803deaa0f30134ec359c.zip
pfsense-4f4d63d8ea2c75a10c33803deaa0f30134ec359c.tar.gz
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.
Diffstat (limited to 'usr')
-rwxr-xr-xusr/local/www/services_snmp.php176
1 files changed, 162 insertions, 14 deletions
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) {
<link href="gui.css" rel="stylesheet" type="text/css">
<script language="JavaScript">
<!--
-function enable_change(enable_change) {
- var endis;
- endis = !(document.iform.enable.checked || enable_change);
- document.iform.syslocation.disabled = endis;
- document.iform.syscontact.disabled = endis;
- document.iform.rocommunity.disabled = endis;
+function enable_change(whichone) {
+
+ if( whichone.name == "trapenable" )
+ {
+ if( whichone.checked == true )
+ {
+ document.iform.trapserver.disabled = false;
+ document.iform.trapserverport.disabled = false;
+ }
+ else
+ {
+ document.iform.trapserver.disabled = true;
+ document.iform.trapserverport.disabled = true;
+ }
+ }
+
+ /* disabled until some docs show up on what this does.
+ if( whichone.name == "rwenable" )
+ {
+ if( whichone.checked == true )
+ {
+ document.iform.rwcommunity.disabled = false;
+ }
+ else
+ {
+ document.iform.rwcommunity.disabled = true;
+ }
+ }
+ */
+
+ if( document.iform.enable.checked == true )
+ {
+ document.iform.syslocation.disabled = false;
+ document.iform.syscontact.disabled = false;
+ document.iform.rocommunity.disabled = false;
+ document.iform.trapenable.disabled = false;
+ /* disabled until some docs show up on what this does.
+ document.iform.rwenable.disabled = false;
+ if( document.iform.rwenable.checked == true )
+ {
+ document.iform.rwcommunity.disabled = false;
+ }
+ else
+ {
+ document.iform.rwcommunity.disabled = true;
+ }
+ */
+ if( document.iform.trapenable.checked == true )
+ {
+ document.iform.trapserver.disabled = false;
+ document.iform.trapserverport.disabled = false;
+ }
+ else
+ {
+ document.iform.trapserver.disabled = true;
+ document.iform.trapserverport.disabled = true;
+ }
+ }
+ else
+ {
+ document.iform.syslocation.disabled = true;
+ document.iform.syscontact.disabled = true;
+ document.iform.rocommunity.disabled = true;
+ /*
+ document.iform.rwenable.disabled = true;
+ document.iform.rwcommunity.disabled = true;
+ */
+ document.iform.trapenable.disabled = true;
+ document.iform.trapserver.disabled = true;
+ document.iform.trapserverport.disabled = true;
+ }
}
//-->
</script>
@@ -99,11 +198,13 @@ function enable_change(enable_change) {
<?php if ($savemsg) print_info_box($savemsg); ?>
<form action="services_snmp.php" method="post" name="iform" id="iform">
<table width="100%" border="0" cellpadding="6" cellspacing="0">
+
<tr>
- <td width="22%" valign="top" class="vtable">&nbsp;</td>
- <td width="78%" class="vtable">
-<input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)">
- <strong>Enable SNMP agent</strong></td>
+ <td colspan="2" valign="top" class="optsect_t">
+ <table border="0" cellspacing="0" cellpadding="0" width="100%">
+ <tr><td class="optsect_s"><strong>SNMP Daemon</strong></td>
+ <td align="right" class="optsect_s"><input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(this)"> <strong>Enable</strong></td></tr>
+ </table></td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell">System location</td>
@@ -118,12 +219,59 @@ function enable_change(enable_change) {
</td>
</tr>
<tr>
- <td width="22%" valign="top" class="vncellreq">Community</td>
+ <td width="22%" valign="top" class="vncellreq">Read Community String</td>
<td width="78%" class="vtable">
<input name="rocommunity" type="text" class="formfld" id="rocommunity" size="40" value="<?=htmlspecialchars($pconfig['rocommunity']);?>">
<br>
In most cases, &quot;public&quot; is used here</td>
</tr>
+
+
+
+<?php
+ /* disabled until some docs show up on what this does.
+ <tr>
+ <td width="22%" valign="top" class="vtable">&nbsp;</td>
+ <td width="78%" class="vtable">
+ <input name="rwenable" type="checkbox" value="yes" <?php if ($pconfig['rwenable']) echo "checked"; ?> onClick="enable_change(this)">
+ <strong>Enable Write Community String</strong></td>
+ </tr>
+
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Write community string</td>
+ <td width="78%" class="vtable">
+ <input name="rwcommunity" type="text" class="formfld" id="rwcommunity" size="40" value="<?=htmlspecialchars($pconfig['rwcommunity']);?>">
+ <br>
+ Please use something other then &quot;private&quot; here</td>
+ </tr>
+ */
+?>
+
+
+
+ <tr>
+ <td width="22%" valign="top" class="vtable">&nbsp;</td>
+ <td width="78%" class="vtable">
+ <input name="trapenable" type="checkbox" value="yes" <?php if ($pconfig['trapenable']) echo "checked"; ?> onClick="enable_change(this)">
+ <strong>Enable SNMP Traps</strong></td>
+ </tr>
+
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Trap server</td>
+ <td width="78%" class="vtable">
+ <input name="trapserver" type="text" class="formfld" id="trapserver" size="40" value="<?=htmlspecialchars($pconfig['trapserver']);?>">
+ <br>
+ Enter trap server name</td>
+ </tr>
+
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Trap server port </td>
+ <td width="78%" class="vtable">
+ <input name="trapserverport" type="text" class="formfld" id="trapserverport" size="40" value="<?=$pconfig['trapserverport'] ? htmlspecialchars($pconfig['trapserverport']) : htmlspecialchars(162);?>">
+ <br>
+ Enter the port to send the traps to (default 162)</td>
+ </tr>
+
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
@@ -134,7 +282,7 @@ function enable_change(enable_change) {
</form>
<script language="JavaScript">
<!--
-enable_change(false);
+enable_change(this);
//-->
</script>
<?php include("fend.inc"); ?>
OpenPOWER on IntegriCloud