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 . . .

Comments on this post

  1. Jeff Everhart said on February 24, 2016 at 3:58 pm

    Is oAuth with Twitter really that easy in apps script? I’ve got to try this for myself.

    • Tom Woodward said on February 24, 2016 at 4:01 pm

      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. 🙂

Trackbacks and Pingbacks on this post

  1. #SQ779 Count Down | Mark Morvant said on November 14, 2016 at 4:03 pm

    […] Server Up? Notifications via Twitter/Google Script […]