July 26, 2007

Host monitoring with Twitter and Perl - a poor man's Nagios

Twitter LogoJustin Mason of SpamAssassin fame recently published a perl-script on his blog, he developed to check health of some of his servers using perl and posting alerts to Jaiku.

Since i use twitter, i modified his script to post alerts and extended the functionality a bit. The script cureently only checks webservers via HEAD requests. If a host does not respond, it posts an alert to a given Twitter account, remembers the host and will post a host-up notification to twitter, should the host come up again.

The benefit of this is, that you can get Tweets via SMS providing you a nice 24/7 monitoring solution. In order to receive SMS alerts, you basically need 2 twitter accounts. One where you send the alerts to and a second one which you use to follow the first one in order to receive notifications vis SMS (as you can't receive notifications from your own account, this is not possible using just one account).

The script is usually run by cron. To run it, you need Perl and the Perl LWP module as well as a configuratio-file which is described in the header of the perl-script.

Download checkandtwitter.pl V 0.2 here and enjoy.

Posted in: , by seiz | Comments (0)

Post a comment