I manage or monitor a few servers, and it's a good idea to keep an eye on how they're holding up. The Linux `uptime` command is all I need - show me how long the server's been up (or if it's cycled recently - power hiccup?), and CPU load averages.
I just whipped up a dead-simple solution to let me embed the uptime reports from the servers into my retro homepage.
I'm quite sure there are better and/or more robust ways to do this, but this is what I came up with after maybe 2 minutes of thought.
On each of the servers, I added a shell script called "`uptimewriter.sh`" (in my `~/bin` directory, so located at `~/bin/uptimewriter.sh`). I made the file executable (`chmod +x ~/bin/uptimewriter.sh`) and used this script:
#!/bin/sh
echo "document.write('"`uptime`"');"
All it does is wrap the output of the `uptime` command in some javascript code to display the text when embedded on a web page. I then added it to the crontab on each of the servers, running every 15 minutes, and dumping the output into a file that will be visible via the webserver.
*/15 * * * * ~/bin/uptimewriter.sh > ~/public_html/uptime.js 2>&1
Every 15 minutes, the `uptimewriter.sh` script is run, and output into a javascript file that can be pulled to display on a web page.
Then, on my retro home page, I added code to run the javascript file:
When called from a web page, that will render the output of the `uptime` command, wrapped in a `document.write()` call as per the `uptimewriter.sh` script, displaying it nicely:
I can do some more work to style it a bit, so it wraps more nicely, but it's a decent start.