We’re using a handful of web services with RESTful APIs serving JSON over HTTP at work to serve content to different client applications.

The services all expose the same status interface that spits out statistics and status information about the service. The representation of the status interface is uniform across all the services. Nagios uses the interface to monitor the service status, and we alert the appropriate people via Email if any service is experiencing service disruptions.

I also wanted to create a dashboard of some sorts to that actively monitors the service state, prints out summary information and refreshes automatically.

Yesterday I created the first version of it using Google Docs Spreadsheet. it’s extremely simple, and it took about 10 minutes to put together. It’s implemented using a custom Google Apps Script that calls the service status API call, parses the JSON output and outputs a simple Google Docs Spreadsheet.

The service status API calls output JSON that looks like this:

The Google App Script that processes this looks like this:

The script is called from cell A1 with:

The time query parameter is completely bogus and is there just to force the Google Docs Spreadsheet to autorefresh. The GoogleClock() function call will cause the spreadsheet to autorefresh automatically.

The output looks like this:

This allows me to create a simple Google Docs Spreadsheet that acts as a dashboard to all my services. I have a worksheet for each service, and I can easily monitor the status throughout the day.

I can also easily create a “cover sheet” that just outputs the “status” value (“ok”, “warn” or “critical”) of each service.

It shouldn’t be too hard to enhance this to create a (near) real-time chart of key statistics either.

All in all this was much, much easier than I expected. It took me about 10 minutes to create the script and the first sheet. The most difficulty I had with it was struggling with manipulating the JavaScript object created by the fetchServiceStatus() JS function, since I haven’t worked with JavaScript for years. A real JavaScript developer would’ve been able to do this in a fraction of the time.

Tagged with →  
Share →

Leave a Reply

Your email address will not be published. Required fields are marked *