From: <abe...@us...> - 2013-05-15 18:32:20
|
Revision: 6086 http://sourceforge.net/p/astlinux/code/6086 Author: abelbeck Date: 2013-05-15 18:32:17 +0000 (Wed, 15 May 2013) Log Message: ----------- web interface, add SNMP Agent Server support by editing files in /mnt/kd/snmp/ Modified Paths: -------------- branches/1.0/package/webinterface/altweb/admin/edit.php branches/1.0/package/webinterface/altweb/admin/network.php branches/1.0/package/webinterface/altweb/admin/system.php Modified: branches/1.0/package/webinterface/altweb/admin/edit.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/edit.php 2013-05-15 16:30:47 UTC (rev 6085) +++ branches/1.0/package/webinterface/altweb/admin/edit.php 2013-05-15 18:32:17 UTC (rev 6086) @@ -28,6 +28,7 @@ 'openvpnclient' => 'Restart OpenVPN Client', 'racoon' => 'Restart IPsec VPN', 'pptpd' => 'Restart PPTP VPN Server', + 'snmpd' => 'Restart SNMP Server', 'stunnel' => 'Restart Stunnel Proxy', 'miniupnpd' => 'Restart Univ. Plug\'n\'Play', 'apcupsd' => 'Restart UPS Daemon', @@ -217,6 +218,8 @@ $result = restartPROCESS($process, 37, $result, 'init'); } elseif ($process === 'prosody') { $result = restartPROCESS($process, 38, $result, 'init'); + } elseif ($process === 'snmpd') { + $result = restartPROCESS($process, 39, $result, 'init'); } elseif ($process === 'cron') { $result = updateCRON('root', 30, $result); } @@ -256,6 +259,7 @@ $dir === '/mnt/kd/openvpn/ccd' || $dir === '/mnt/kd/rc.conf.d' || $dir === '/mnt/kd/crontabs' || + $dir === '/mnt/kd/snmp' || $dir === '/mnt/kd/apcupsd' || $dir === '/mnt/kd/prosody' || $dir === '/mnt/kd/docs' || @@ -330,6 +334,8 @@ putHtml('<p style="color: green;">Stunnel Proxy has Restarted.</p>'); } elseif ($result == 38) { putHtml('<p style="color: green;">XMPP Server has Restarted.</p>'); + } elseif ($result == 39) { + putHtml('<p style="color: green;">SNMP Server has Restarted.</p>'); } elseif ($result == 99) { putHtml('<p style="color: red;">Action Failed.</p>'); } elseif ($result == 999) { @@ -475,6 +481,14 @@ $sel = ($file === $openfile) ? ' selected="selected"' : ''; putHtml('<option value="'.$file.'"'.$sel.'>prosody/'.basename($file).' - XMPP Shared Groups</option>'); } + if (is_writable($file = '/mnt/kd/snmp/snmpd.conf')) { + $sel = ($file === $openfile) ? ' selected="selected"' : ''; + putHtml('<option value="'.$file.'"'.$sel.'>snmp/'.basename($file).' - SNMP Agent Server Config</option>'); + } + if (is_writable($file = '/mnt/kd/snmp/snmp.conf')) { + $sel = ($file === $openfile) ? ' selected="selected"' : ''; + putHtml('<option value="'.$file.'"'.$sel.'>snmp/'.basename($file).' - SNMP Applications Config</option>'); + } putHtml('</optgroup>'); if (is_dir('/mnt/kd/openvpn/ccd') && count($globfiles = glob('/mnt/kd/openvpn/ccd/*')) > 0) { putHtml('<optgroup label="———— OpenVPN Client Configs ————">'); Modified: branches/1.0/package/webinterface/altweb/admin/network.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/network.php 2013-05-15 16:30:47 UTC (rev 6085) +++ branches/1.0/package/webinterface/altweb/admin/network.php 2013-05-15 18:32:17 UTC (rev 6086) @@ -785,6 +785,12 @@ $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); header('Location: /admin/xmpp.php'); exit; + } elseif (isset($_POST['submit_snmp_agent'])) { + $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); + if (is_writable($file = '/mnt/kd/snmp/snmpd.conf')) { + header('Location: /admin/edit.php?file='.$file); + exit; + } } elseif (isset($_POST['submit_zabbix'])) { $result = saveNETWORKsettings($NETCONFDIR, $NETCONFFILE); header('Location: /admin/zabbix.php'); @@ -890,6 +896,8 @@ $result = restartPROCESS($process, 37, $result, 'init'); } elseif ($process === 'prosody') { $result = restartPROCESS($process, 38, $result, 'init'); + } elseif ($process === 'snmpd') { + $result = restartPROCESS($process, 39, $result, 'init'); } } else { $result = 2; @@ -964,6 +972,8 @@ putHtml('<p style="color: green;">Stunnel Proxy has Restarted.</p>'); } elseif ($result == 38) { putHtml('<p style="color: green;">XMPP Server has Restarted.</p>'); + } elseif ($result == 39) { + putHtml('<p style="color: green;">SNMP Server has Restarted.</p>'); } elseif ($result == 99) { putHtml('<p style="color: red;">Action Failed.</p>'); } elseif ($result == 100) { @@ -1041,6 +1051,8 @@ putHtml('<option value="racoon"'.$sel.'>Restart IPsec VPN</option>'); $sel = ($reboot_restart === 'pptpd') ? ' selected="selected"' : ''; putHtml('<option value="pptpd"'.$sel.'>Restart PPTP VPN Server</option>'); + $sel = ($reboot_restart === 'snmpd') ? ' selected="selected"' : ''; + putHtml('<option value="snmpd"'.$sel.'>Restart SNMP Server</option>'); $sel = ($reboot_restart === 'stunnel') ? ' selected="selected"' : ''; putHtml('<option value="stunnel"'.$sel.'>Restart Stunnel Proxy</option>'); $sel = ($reboot_restart === 'miniupnpd') ? ' selected="selected"' : ''; @@ -1426,6 +1438,11 @@ putHtml('XMPP Server, Messaging and Presence:'); putHtml('<input type="submit" value="Configure XMPP" name="submit_xmpp" class="button" /></td></tr>'); + if (is_file('/etc/init.d/snmpd') && is_file('/mnt/kd/snmp/snmpd.conf')) { + putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); + putHtml('SNMP Agent Server:'); + putHtml('<input type="submit" value="Configure SNMP Agent" name="submit_snmp_agent" class="button" /></td></tr>'); + } if (is_file('/etc/init.d/zabbix')) { putHtml('<tr class="dtrow1"><td style="text-align: left;" colspan="6">'); putHtml('Zabbix Monitoring:'); Modified: branches/1.0/package/webinterface/altweb/admin/system.php =================================================================== --- branches/1.0/package/webinterface/altweb/admin/system.php 2013-05-15 16:30:47 UTC (rev 6085) +++ branches/1.0/package/webinterface/altweb/admin/system.php 2013-05-15 18:32:17 UTC (rev 6086) @@ -174,7 +174,7 @@ $srcfile .= ' -e "s/^.*[.]conf$/&/p" -e "s/^webgui-prefs.txt$/&/p" -e "s/^ast.*/&/p"'; $srcfile .= ' -e "s/^blocked-hosts$/&/p" -e "s/^dnsmasq.static$/&/p" -e "s/^hosts$/&/p" -e "s/^ethers$/&/p"'; $srcfile .= ' -e "s/^rc.local$/&/p" -e "s/^rc.local.stop$/&/p" -e "s/^rc.elocal$/&/p" -e "s/^rc.ledcontrol$/&/p"'; - $srcfile .= ' -e "s/^crontabs$/&/p"'; + $srcfile .= ' -e "s/^crontabs$/&/p" -e "s/^snmp$/&/p"'; $srcfile .= ' -e "s/^openvpn$/&/p" -e "s/^ipsec$/&/p" -e "s/^dahdi$/&/p" -e "s/^ssl$/&/p" -e "s/^apcupsd$/&/p")'; $srcfile .= $firewall; } elseif ($backup_type === 'cdr') { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |