Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

Wednesday, September 14, 2011

Quick and Dirty Server Monitoring with Python

Sometimes you just need a quick and dirty script for monitoring servers to see if they are up. I wrote the following python script and have it running from cron so that it will notify me via SMS when a server's service isn't responding. The list of hosts is in a python dictionary with the key being the hostname or ip to monitor and the value being a list of service ports to check. If a host/port doesn't respond, it emails to the Sprint messaging service which appears on my phone. Any provider that has an email to SMS gateway should work. It isn't anywhere near a full fledged monitoring system but works well enough.