Server Up? Notifications via Twitter/Google Script

flickr photo shared by Thomas Hawk under a Creative Commons ( BY-NC ) license

Reclaim Hosting has a great status page that alerts you when stuff is not working correctly. We had a brief outage this morning and I just thought it’d be nice to see if we could proactively send out a message based on that status page but only for things relevant to our server.

I asked Tim (as you can see in the tweets below) and ended up with an API that happily spit out a JSON feed.

Based on my recent experiments with JSON and Google Scripts I didn’t think it’d be too hard to write something to send out Tweets based on that feed. I found this snippet that dealt with the authorization portion for Twitter.1

Once I had the JSON parsed and assigned to variables, all I had to do was set it to check every 5 minutes. Now we can hook it up to the ALTLab account if we’d like, have it notify various people, etc. etc. Fun stuff . . . all done during lunch.

The following script will check a JSON feed and send a Tweet out from my account letting @vcualtlab know we should check on one of our servers that’s on Reclaim Hosting.

1 It does seem to be missing one piece ( var twit = new Twitter.OAuth(props); ) but he doesn’t have comments turned on . . .

3 thoughts on “Server Up? Notifications via Twitter/Google Script

    1. There’s an external library referenced in that linked example and I’m sure that does all the heavy lifting. But I’m always happy to draft off the hard work of smart people. 🙂

Comments are closed.