Name="Watchdog für Server"
Stich="Watchdog Server free df mail bzip2 uuencode logs tail w"
Zeit="Don Jun 27 15:01:42 MEST 2002"
Kurz="Haben Sie einen kleinen Server, den Sie überwachen wollen?
Dann ist vielleicht watchdog.sh was für Sie."
Lang="
watchdog.sh schickt in regelmäßigen Abständen komprimiert Mails
an den Administrator mit allen wichtigen Statusreports (Arbeitsspeicher, Load
Average, Festplattenspeicher, eingeloggte User, ...). Das Skript wird bereits
erfolgreich in der Infothek des Holbein Gymnsasiums Augsburgs eingesetzt.
Die Mails sind mit bzip2 komprimiert und mit uuencode steuerzeichenlos. Um sie
klar lesbar anzuschauen muss die Mail nur an uudecode | bzcat | less
gefüttert werden.
In der Crontab muss dann noch ein Eintrag in der Art wie
`exCodes crontab`
*/5 * * * * /pfad/zur/watchdog.sh
`exCodee`
stehen.
Das Skript, Download:
`exCodes watchdog.sh`
#!/bin/bash
# watchdog.sh - A little watchdog for Linux/Unix
# Copyright (C) Don Jun 27 15:10:30 MEST 2002 - now by Ingo Blechschmidt
`cat gpl.lic`
`cat add.lic`
{ time {
echo "WATCHDOG REPORT for \`date\`:"
echo
echo
echo
echo "Users logged in:"
echo
/usr/bin/w
echo
echo
echo "Interface settings:"
echo
/sbin/ifconfig
echo
echo
echo "Routing table:"
echo
/sbin/route -n
echo
echo
echo "Active processes:"
echo
/bin/ps -xua
echo
echo
echo "Connections:"
echo
/bin/netstat -a
echo
echo
echo "Load average and uptime:"
echo
/bin/cat /proc/loadavg /proc/uptime
echo
echo
echo "Free space:"
echo
/bin/df -h
echo
/bin/df
echo
echo
echo "Free RAM:"
echo
/usr/bin/free
echo
echo "Logs:"
{ find /var/log -type f; find /var/squid/logs -type f; } 2>&1 | grep -v gz | xargs tail -n 20
echo
echo
echo "Ping to google and to 1-5:"
echo
/bin/ping -c1 www.google.de
/bin/ping -c1 192.168.0.101
/bin/ping -c1 192.168.0.102
/bin/ping -c1 192.168.0.103
/bin/ping -c1 192.168.0.104
/bin/ping -c1 192.168.0.105
echo
echo
echo "Time elapsed:"
} 2>&1; } 2>&1 | /usr/bin/bzip2 | { /usr/bin/uuencode --base64 -; echo; echo; } | mail -s IFWATCHDOG iblech-ml@gmx.de
sleep 3
/usr/sbin/sendmail -v -q
`exCodee`
... aber wozu brauch man einen Wachhund bei Linux? ;-)
"
case $1 in
Name) echo $Name; exit;;
Stich) echo $Stich; exit;;
Zeit) echo $Zeit; exit;;
Kurz) echo $Kurz; exit;;
Lang) echo $Lang; exit;;
esac
# if [ "$1" = "Name" ]; then echo $Name; fi
mself_vA=" txt/0035.txt txt/0082.txt txt/0091.txt"