Monitor anything and get free notifications on your iPhone

Crash Hound

I released crash_hound today, it let's you do following things:
  • monitor and script any checks such as if your website is down, too slow or the worker queue is too big
  • get instant (and free!) notifications via notifo.com - currently only supports iPhone

I currently use it to monitor my sites, database servers, worker queues etc. and I feel much safer since I know I'll get a notification right away if something dies.

You can fork the code on github.com.

How to get started

Install following modules via easy_install:

$ sudo easy_install notifo
$ sudo easy_install crash_hound

And that's basically it, you are ready to script and to get free notifications on your iPhone!

Get ready to script!

crash_hound is a Python library. Here is an example with some comments:

from crash_hound import CrashHound, ReportCrash, CommonChecks

crash_checker = CrashHound('amix',
                           'MY API SECRET')

#Check an URL and get notifications if it does not return 302 or 200
#I.e. you will get notification if it's down. Will notify every 60 seconds.
crash_checker.register_check('Google.com Blah test',
                             lambda: CommonChecks.website_check('http://google.com/blah'),
                             notify_every=60)

#Custom checks are supported.
#Here is a custom check. Will notify every 60 seconds.
def check_42():
    if 42:
        raise ReportCrash('42 is true!')
    else:
        pass #Ignore

crash_checker.register_check('42 Checker',
                             check_42,
                             notify_every=60)

#Will run your checks every 10 seconds (indefinitely)
crash_checker.run_checks(check_interval=10)

Save this in a file named test.py and run it via:

$ python test.py

You should get some notifications on your phone! Happy hacking :-)

26. Jun 2010 Announcements · Code · Python · Tips
© Amir Salihefendic