Skip to content

Instantly share code, notes, and snippets.



Last active Jan 5, 2021
What would you like to do?
Sample monitoring for a Raspberry Pi Access Point
echo "<html>\n<head>\n";
echo "<title>$hostname</title>\n";
// Refresh the page periodically
echo "<meta http-equiv='Refresh' content='47; URL=/'>\n";
echo "</head><body>\n";
function showit($title, $cmd_output){
echo "\n<h4 style='background: MidnightBlue; color: white; padding: 7px'> $t
itle </h4>\n";
if(empty($cmd_output)) {
echo "<div style='background: pink'><pre>NOT DETECTED </pre></div>\n";
else {
echo "<pre>$cmd_output </pre>\n";
showit("$hostname", "Status as of $timestamp");
showit("Uptime", `uptime`);
showit("Host Access Point Daemon (hostapd)", `ps aux | grep hostapd | grep -v grep`);
showit("DHCP server daemon", `ps aux | grep dhcpd | grep -v grep`);
showit("Route", `route -n`);
showit("Interfaces", `ifconfig|egrep -v "TX|RX"`);
showit("Interface Statistics", `netstat -i`);
showit("Who", `who`);
showit("Web Server (nginx)", `ps aux | grep nginx | grep -v grep`);
showit("CPU Info", `cat /proc/cpuinfo`);
echo "</body>\n</html>\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment