New Feature: JSON Format Check Scripts

Posted by : Steven Acreman | Product Updates, Nagios, JSON, Output | 0 Comments

Our agent runs Nagios check scripts in any language, and Nagios check scripts are great if you want to easily send service status and performance metrics back to your monitoring service, but what if you want to display tabular data on your Dashboard?

This was one of the requests from one of our customers, and also something we built a brittle Ruby script to do at our previous company, to report on business metrics and service KPIs to management in a weekly email. Sometimes you want to display metrics in a table such as AWS costs this week vs. last week and the percentage change, or display Average Server Utalisation for each month over the past year.

So we've created a new output format we accept on Dataloop.IO that allows you to write a check script in any language, but instead of outputting the standard Nagios format output, send us JSON instead, which will automatically display as a table on our Dashboards if you drag it on. This means you can write a simple script to pull in all the data you want from various sources and see it immediately displayed as a table after its run.

Example

Lets say I'm monitoring a Farmville clone online game and want to see how many virtual animals my players have in total right now. I could write a simple script that pulls the metrics from my Database and sends the results as JSON to Dataloop.IO to be displayed as a table below:

Table Example

 

To create this table I just need to output a JSON array to STDOUT from my script with the data, which is then sent from our agent to Dataloop.IO to be stored and rendered on our Dashboards:

JSON Output:

[["pigs", 15], ["chickens", 12], ["ostriches", 9], ["hens", 30]]

 

Python Script:


#!/usr/bin/env python

import json

animals = []

animals.append(['pigs',15])
animals.append(['chickens',12])
animals.append(['ostriches',9])
animals.append(['hens',30])

print json.dumps(animals)

 

Bash Script:

 

#!/usr/bin/env bash

echo [["pigs", 15], ["chickens", 12], ["ostriches", 9], ["hens", 30]]

 

Summary

So in just a few minutes we've created a simple table with live data that can be displayed on your Dashboard. To create multi-column tables you just make the array bigger and the Dashboard will automatically display more columns.

If you'd like to try it for yourself, don't forget to Signup for Dataloop.IO now!

Go Beyond Cloud Monitoring

Scale your infrastructure monitoring for Cloud, SaaS, Microservices and IoT-ready deployments with Outlyer. We’ve designed a solution for the agile organization. Start now and see your operational metrics in minutes.

Start Your 14 Day Trial Now