Monitor anything and get SMS notifications![]() A while back I did a post on sending international SMS messages the cheap way using Tropo.com. I have now coded an extension to crash_hound which allows you to monitor anything and get SMS notifications for 2 cents pr. message - the service works anywhere in the world! The new version of crash_hound has deprecated Notifo since SMS reminders are generally more reliable. You can fork the code on github.com. How to get startedTo get started should be really simple, here are 5 steps you need to follow:
Followed this and got the API key? Great, you are ready to setup your first checks! Using crash_houndTo download and install crash_hound from PyPi simply do: $ sudo easy_install crash_hound After it's installed properly you can create your first check script: from crash_hound import CrashHound, ReportCrash, CommonChecks, SenderTropo
# Configure sender and checker
crash_sender = SenderTropo('TROPO_API_KEY',
'+56 9 ...YOUR MOBILE NUMBER...')
crash_checker = CrashHound(crash_sender)
# 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)
# Will run your checks every 10 seconds (indefinitely)
crash_checker.run_checks(check_interval=10)
Run the above script and you should get a SMS notification on your phone! ... If you insists on using NotifoIf you really want to use Notifo here is how you create a Notifo sender: from crash_hound import SenderNotifo
crash_sender = SenderNotifo('NOTIFO_API_KEY',
'NOTIFO_API_PASSWORD')
crash_checker = CrashHound(crash_sender)
Code
·
Code improvement
·
Python
·
Tips
•
17. Aug 2011
|
|