This is a simple script that gathers the date, kernel, uptime, disk usage and current tcp connections and displays the output in html for viewing. Adding other variables to the script is simple.
Create the following script and name it systemstat:[download systemstat]
#! /bin/sh
# Change the SYSTEM variable to your web directory
SYSTEM=/www/htdocs/status.html
echo "<html><title>`hostname` Status</title>" > $SYSTEM
echo "<body bgcolor=white><font color=93321C>" >> $SYSTEM
echo "<h2>`hostname` status <font size=-1> </h2></font></font>" >> $SYSTEM
echo "<pre>" >> $SYSTEM
echo "<b>Date:</b> `date`" >> $SYSTEM
echo >> $SYSTEM
echo "<b>Kernel:</b>" >> $SYSTEM
uname -a >> $SYSTEM
echo >> $SYSTEM
echo "<b>Uptime:</b>" >> $SYSTEM
uptime >> $SYSTEM
echo >> $SYSTEM
echo "<b>Disk Usage:</b>" >> $SYSTEM
df -h >> $SYSTEM
echo >> $SYSTEM
echo "<b>TCP connections:</b>" >> $SYSTEM
netstat -an -f inet >> $SYSTEM
echo >> $SYSTEM
Run the script:
# ./systemstat
The resulting status.html file will be placed in the directory specified by “SYSTEM”