Like seeing your server monitoring metrics on your business dashboard? Do you have a Dashing dashboard on your wall TV that you’d like to add OpsDash status to? Read on!
Dashing is a popular open-source dashboard from Shopify, and we don’t dispute it’s claims to being “exceptionally handsome!” OpsDash now provides APIs with which you can not only send in custom metrics, but also query out alert status. Let’s try pulling the alert status out of OpsDash and show it in a Dashing dashboard, ending up like this:
This is a tweak of the Dashing sample dashboard, with the first three widgets showing OpsDash alerting status. The OpsDash open alerts page, at the time, looked like this:
Let’s see how to set this up!
The OpsDash API
The OpsDash APIs can be enabled by setting
api.enable = 1 in your OpsDash
/etc/opsdash/server.cfg. Once enabled, you can access the APIs
http://your.server:port/pubapi/v1/.... The APIs allow you to send custom
metrics, create, list, delete sources, services and source groups and also of
course, to query the OpsDash status.
Fetching the status couldn’t be simpler:
The Dashing Job
Given this API, we can write a Dashing job (a small Ruby script), that pulls this info and parses out the required values:
This sends three values to Dashing, which can be included in dashboard
configuration files that live under the
dashboards folder. Note that
in the above code,
10.0.0.128 is the OpsDash server’s IP which you’ll
need to change.
Here is the HTML snippet that we put in
dashboards/sample.erb to show
the Critical Alerts widget in the screenshot:
Try it out yourself! Tweet your screenshots to @therapidloop and we’ll retweet them!