Quick and dirty service monitor scripts
Someday, you might want to monitor popular internet services on several hosts. It should be quick and simple so you don't have to install so long software packets to meet the dependencies. I have ones for you. They are written in pure Perl to monitor HTTP service and MySQL service.
up.sh
#!/bin/sh
echo "up!"
down.sh
#!/bin/sh
echo "down!"
In order to use them, you have to pass necessary arguments and don't forget to put those command line to your cron. For example, in case of you have a web server running at www1.mydomain.com
and a database serer at db1.mydomain.com
.
/opt/mon/http.pl www1.mydomain.com 80 / 3 /opt/mon
/opt/mon/mysql.pl db1.mydomain.com 3306 3 /opt/mon
These scripts will send you an e-mail whenever service status changed as well as execute up.sh
or down.sh
stored in /opt/mon
according the new status of those services.
Tags: perl, heartbeat, high availability
Attachment | Size |
---|---|
http.pl_.txt | 2.28 KB |
mysql.pl_.txt | 2.21 KB |
- sugree's blog
- 975 reads
Post new comment