System watcher

Every system administrator must look after his system. This script make self-diagnostics, then mail result to you. Don't forget that you can re-look about these things "by hand" too, at least one time in mounth...



cat > /tmp/stat.txt << [DONE]


<H1>Misc Information</H1>
<Table Border = 1>

<TR><TD>Hostname</TD><TD>`cat /etc/HOSTNAME`</TD></TR>

<TR><TD>OS / Kernel</TD><TD>`cat /proc/version`</TD></TR>

<TR><TD>Up time</TD><TD>`uptime`</TD></TR>


<H1>Memory info:</H1>
<PRE>`cat /proc/meminfo`</PRE>

<H1>Disk usage and mounts:</H1>

<PRE>`df -m`</PRE>

<H1>Mail q:</H1>

<H1>Last 25 logins:</H1>
<PRE>`last -25`</PRE>

<H1>Last 25 lines from system log:</H1>
<PRE>`tail -n 25 /var/log/syslog`</PRE>

<H1>Last 25 lines from message log:</H1>
<PRE>`tail -n 25 /var/log/messages`</PRE>

<Table Border = 1>
        printf "<TR><TD>$1</TD><TD>"

        if ( ps -axe | grep $1 > /dev/null ) ;  then 
                printf "OK" ; 
                printf "FAIL" ; 

        printf "</TD>\n"

lookup httpd
lookup named
lookup inetd
lookup sendmail



uuencode stat.html < /tmp/stat.txt | \
	mail $RCPT -s "server statistics"

rm /tmp/stat.txt

Do you see another idea here??? You can write HTML with embedded SHell script:)))))


printf "content-type: text/html\n\n"

cat << [END]

<H1>The passwd file:</H1>
<PRE>`cat /etc/passwd`</PRE>


Copyleft 16.Sep.1999,
Nikolay Mijaylov