Revision 3805bfdd
Added by John Fleming about 20 years ago
usr/local/www/services_snmp.php | ||
---|---|---|
35 | 35 |
if (!is_array($config['snmpd'])) { |
36 | 36 |
$config['snmpd'] = array(); |
37 | 37 |
$config['snmpd']['rocommunity'] = "public"; |
38 |
$config['snmpd']['pollport'] = "161"; |
|
38 | 39 |
} |
39 | 40 |
|
41 |
if (!is_array($config['snmpd']['modules'])) { |
|
42 |
$config['snmpd']['modules'] = array(); |
|
43 |
$config['snmpd']['modules']['mibii'] = true; |
|
44 |
$config['snmpd']['modules']['netgraph'] = true; |
|
45 |
$config['snmpd']['modules']['pf'] = true; |
|
46 |
} |
|
40 | 47 |
$pconfig['enable'] = isset($config['snmpd']['enable']); |
48 |
$pconfig['pollport'] = $config['snmpd']['pollport']; |
|
41 | 49 |
$pconfig['syslocation'] = $config['snmpd']['syslocation']; |
42 | 50 |
$pconfig['syscontact'] = $config['snmpd']['syscontact']; |
43 | 51 |
$pconfig['rocommunity'] = $config['snmpd']['rocommunity']; |
... | ... | |
50 | 58 |
$pconfig['trapserverport'] = $config['snmpd']['trapserverport']; |
51 | 59 |
$pconfig['trapstring'] = $config['snmpd']['trapstring']; |
52 | 60 |
|
61 |
$pconfig['mibii'] = isset($config['snmpd']['modules']['mibii']); |
|
62 |
$pconfig['netgraph'] = isset($config['snmpd']['modules']['netgraph']); |
|
63 |
$pconfig['pf'] = isset($config['snmpd']['modules']['pf']); |
|
64 |
|
|
53 | 65 |
if ($_POST) { |
54 | 66 |
|
55 | 67 |
unset($input_errors); |
... | ... | |
59 | 71 |
if ($_POST['enable']) { |
60 | 72 |
$reqdfields = explode(" ", "rocommunity"); |
61 | 73 |
$reqdfieldsn = explode(",", "Community"); |
62 |
|
|
74 |
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); |
|
75 |
|
|
76 |
$reqdfields = explode(" ", "pollport"); |
|
77 |
$reqdfieldsn = explode(",", "Polling Port"); |
|
63 | 78 |
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); |
64 | 79 |
} |
65 | 80 |
|
... | ... | |
67 | 82 |
$reqdfields = explode(" ", "trapserver"); |
68 | 83 |
$reqdfieldsn = explode(",", "Trap server"); |
69 | 84 |
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); |
85 |
|
|
70 | 86 |
$reqdfields = explode(" ", "trapserverport"); |
71 | 87 |
$reqdfieldsn = explode(",", "Trap server port"); |
72 | 88 |
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors); |
89 |
|
|
73 | 90 |
$reqdfields = explode(" ", "trapstring"); |
74 | 91 |
$reqdfieldsn = explode(",", "Trap string"); |
75 | 92 |
do_input_validation($_POST, $reqdfields, $reqdfields, $reqdfieldsn, &$input_errors); |
... | ... | |
88 | 105 |
|
89 | 106 |
if (!$input_errors) { |
90 | 107 |
$config['snmpd']['enable'] = $_POST['enable'] ? true : false; |
108 |
$config['snmpd']['pollport'] = $_POST['pollport']; |
|
91 | 109 |
$config['snmpd']['syslocation'] = $_POST['syslocation']; |
92 | 110 |
$config['snmpd']['syscontact'] = $_POST['syscontact']; |
93 | 111 |
$config['snmpd']['rocommunity'] = $_POST['rocommunity']; |
... | ... | |
100 | 118 |
$config['snmpd']['trapserverport'] = $_POST['trapserverport']; |
101 | 119 |
$config['snmpd']['trapstring'] = $_POST['trapstring']; |
102 | 120 |
|
121 |
$config['snmpd']['modules']['mibii'] = $_POST['mibii'] ? true : false; |
|
122 |
$config['snmpd']['modules']['netgraph'] = $_POST['netgraph'] ? true : false; |
|
123 |
$config['snmpd']['modules']['pf'] = $_POST['pf'] ? true : false; |
|
103 | 124 |
|
104 | 125 |
write_config(); |
105 | 126 |
|
... | ... | |
153 | 174 |
|
154 | 175 |
if( document.iform.enable.checked == true ) |
155 | 176 |
{ |
177 |
document.iform.pollport.disabled = false; |
|
156 | 178 |
document.iform.syslocation.disabled = false; |
157 | 179 |
document.iform.syscontact.disabled = false; |
158 | 180 |
document.iform.rocommunity.disabled = false; |
... | ... | |
180 | 202 |
document.iform.trapserverport.disabled = true; |
181 | 203 |
document.iform.trapstring.disabled = true; |
182 | 204 |
} |
205 |
document.iform.mibii.disabled = false; |
|
206 |
document.iform.netgraph.disabled = false; |
|
207 |
document.iform.pf.disabled = false; |
|
183 | 208 |
} |
184 | 209 |
else |
185 | 210 |
{ |
211 |
document.iform.pollport.disabled = true; |
|
186 | 212 |
document.iform.syslocation.disabled = true; |
187 | 213 |
document.iform.syscontact.disabled = true; |
188 | 214 |
document.iform.rocommunity.disabled = true; |
... | ... | |
194 | 220 |
document.iform.trapserver.disabled = true; |
195 | 221 |
document.iform.trapserverport.disabled = true; |
196 | 222 |
document.iform.trapstring.disabled = true; |
223 |
|
|
224 |
document.iform.mibii.disabled = true; |
|
225 |
document.iform.netgraph.disabled = true; |
|
226 |
document.iform.pf.disabled = true; |
|
197 | 227 |
} |
198 | 228 |
} |
199 | 229 |
//--> |
... | ... | |
213 | 243 |
<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> |
214 | 244 |
</table></td> |
215 | 245 |
</tr> |
246 |
|
|
247 |
<tr> |
|
248 |
<td width="22%" valign="top" class="vncellreq">Polling Port </td> |
|
249 |
<td width="78%" class="vtable"> |
|
250 |
<input name="pollport" type="text" class="formfld" id="pollport" size="40" value="<?=$pconfig['pollport'] ? htmlspecialchars($pconfig['pollport']) : htmlspecialchars(161);?>"> |
|
251 |
<br>Enter the port to accept polling events on (default 161)</br> |
|
252 |
</td> |
|
253 |
</tr> |
|
254 |
|
|
216 | 255 |
<tr> |
217 | 256 |
<td width="22%" valign="top" class="vncell">System location</td> |
218 | 257 |
<td width="78%" class="vtable"> |
219 | 258 |
<input name="syslocation" type="text" class="formfld" id="syslocation" size="40" value="<?=htmlspecialchars($pconfig['syslocation']);?>"> |
220 | 259 |
</td> |
221 | 260 |
</tr> |
261 |
|
|
222 | 262 |
<tr> |
223 | 263 |
<td width="22%" valign="top" class="vncell">System contact</td> |
224 | 264 |
<td width="78%" class="vtable"> |
225 | 265 |
<input name="syscontact" type="text" class="formfld" id="syscontact" size="40" value="<?=htmlspecialchars($pconfig['syscontact']);?>"> |
226 | 266 |
</td> |
227 | 267 |
</tr> |
268 |
|
|
228 | 269 |
<tr> |
229 | 270 |
<td width="22%" valign="top" class="vncellreq">Read Community String</td> |
230 | 271 |
<td width="78%" class="vtable"> |
231 | 272 |
<input name="rocommunity" type="text" class="formfld" id="rocommunity" size="40" value="<?=htmlspecialchars($pconfig['rocommunity']);?>"> |
232 |
<br> |
|
233 |
In most cases, "public" is used here</td>
|
|
273 |
<br>In most cases, "public" is used here</br>
|
|
274 |
</td>
|
|
234 | 275 |
</tr> |
235 | 276 |
|
236 |
|
|
237 |
|
|
238 | 277 |
<?php |
239 | 278 |
/* disabled until some docs show up on what this does. |
240 | 279 |
<tr> |
241 | 280 |
<td width="22%" valign="top" class="vtable"> </td> |
242 | 281 |
<td width="78%" class="vtable"> |
243 | 282 |
<input name="rwenable" type="checkbox" value="yes" <?php if ($pconfig['rwenable']) echo "checked"; ?> onClick="enable_change(this)"> |
244 |
<strong>Enable Write Community String</strong></td> |
|
283 |
<strong>Enable Write Community String</strong> |
|
284 |
</td> |
|
245 | 285 |
</tr> |
246 | 286 |
|
247 | 287 |
<tr> |
248 | 288 |
<td width="22%" valign="top" class="vncellreq">Write community string</td> |
249 | 289 |
<td width="78%" class="vtable"> |
250 | 290 |
<input name="rwcommunity" type="text" class="formfld" id="rwcommunity" size="40" value="<?=htmlspecialchars($pconfig['rwcommunity']);?>"> |
251 |
<br> |
|
252 |
Please use something other then "private" here</td>
|
|
291 |
<br>Please use something other then "private" here</br>
|
|
292 |
</td>
|
|
253 | 293 |
</tr> |
254 | 294 |
*/ |
255 | 295 |
?> |
256 | 296 |
|
257 |
|
|
258 |
|
|
259 | 297 |
<tr> |
260 | 298 |
<td width="22%" valign="top" class="vtable"> </td> |
261 | 299 |
<td width="78%" class="vtable"> |
262 | 300 |
<input name="trapenable" type="checkbox" value="yes" <?php if ($pconfig['trapenable']) echo "checked"; ?> onClick="enable_change(this)"> |
263 |
<strong>Enable SNMP Traps</strong></td> |
|
301 |
<strong>Enable SNMP Traps</strong> |
|
302 |
</td> |
|
264 | 303 |
</tr> |
265 | 304 |
|
266 | 305 |
<tr> |
267 | 306 |
<td width="22%" valign="top" class="vncellreq">Trap server</td> |
268 | 307 |
<td width="78%" class="vtable"> |
269 | 308 |
<input name="trapserver" type="text" class="formfld" id="trapserver" size="40" value="<?=htmlspecialchars($pconfig['trapserver']);?>"> |
270 |
<br> |
|
271 |
Enter trap server name</td>
|
|
309 |
<br>Enter trap server name</br>
|
|
310 |
</td>
|
|
272 | 311 |
</tr> |
273 | 312 |
|
274 | 313 |
<tr> |
275 | 314 |
<td width="22%" valign="top" class="vncellreq">Trap server port </td> |
276 | 315 |
<td width="78%" class="vtable"> |
277 | 316 |
<input name="trapserverport" type="text" class="formfld" id="trapserverport" size="40" value="<?=$pconfig['trapserverport'] ? htmlspecialchars($pconfig['trapserverport']) : htmlspecialchars(162);?>"> |
278 |
<br> |
|
279 |
Enter the port to send the traps to (default 162)</td>
|
|
317 |
<br>Enter the port to send the traps to (default 162)</br>
|
|
318 |
</td>
|
|
280 | 319 |
</tr> |
320 |
|
|
281 | 321 |
<tr> |
282 | 322 |
<td width="22%" valign="top" class="vncellreq">Trap server port </td> |
283 | 323 |
<td width="78%" class="vtable"> |
284 | 324 |
<input name="trapstring" type="text" class="formfld" id="trapstring" size="40" value="<?=htmlspecialchars($pconfig['trapstring']);?>"> |
285 |
<br> |
|
286 |
Trap string</td>
|
|
325 |
<br>Trap string</br>
|
|
326 |
</td>
|
|
287 | 327 |
</tr> |
288 | 328 |
|
329 |
<tr> |
|
330 |
<td width="22%" valign="top" class="vncellreq">SNMP Modules</td> |
|
331 |
<td width="78%" class="vtable"> |
|
332 |
<input name="mibii" type="checkbox" id="mibii" value="yes" <?php if ($pconfig['mibii']) echo "checked"; ?> >MibII |
|
333 |
<input name="netgraph" type="checkbox" id="netgraph" value="yes" <?php if ($pconfig['netgraph']) echo "checked"; ?> >Netgraph |
|
334 |
<input name="pf" type="checkbox" id="pf" value="yes" <?php if ($pconfig['pf']) echo "checked"; ?> >PF |
|
335 |
</td> |
|
336 |
</tr> |
|
289 | 337 |
|
290 | 338 |
<tr> |
291 | 339 |
<td width="22%" valign="top"> </td> |
Also available in: Unified diff
Add polling port option
Add checkboxes for snmp modules