Nathan Foreman took on the epic HackaSCOM challenge of building an API Query Management Pack (MP) in just 24 hours and came out as the winner!
Here’s a closer look at everything Nathan managed to build in the 24 hours, which he is now refining so anyone can use this free, open-source MP.
There was some midnight oil burnt as Nathan worked day and night to deliver not just a functional MP but also the UI overlay that made his work stand out to the crowd.
Nathan had to create an MP that could setup a generic class hierarchy against which the monitoring data can be stored, and use an agent watcher to invoke the API web requests.
At the start of the challenge, Nathan said:
“This is usually looked at as simple, but the value to the business is very high. I’d like to bring it into the console authoring pane, where you can select ‘New API template’ and paste your query, set alert, and you’re done.”
Here’s how it turned out.
The API Query handles numeric data, so Nathan built a PowerShell module to handle the collection of the data and then used a SCOM filter expression to evaluate the data as ‘healthy’, ‘warning’, and ‘critical’, then raise alerts.
Here’s a rough sketch Nathan shared of his initial thoughts after just one hour of the HackaSCOM challenge.
For the filter expressions module requirements, there’s the question of whether ‘good’ is up or down. Orders in the last hour or available disk space would have high numbers as good, whereas a high number of milliseconds it takes for something to load would be bad. So this needed to be configurable by the user.
Nathan delivered an impressive demo to the HackaSCOM community and panel of judges. Watch it here from 01:20:00.
Using the weather from weatherapi.com as a data source, Nathan created an API Query MP that works with XML or JSON. In his demo, Nathan shows the tracking of the ‘feels like’ temperature in Fahrenheit from inside SCOM.
Once you’ve installed the Management Pack, here’s how to set up your API query alerts:
First, in SCOM, head to API Perspective Monitoring then the Add Monitoring Wizard where you can set up your API query using the easy UI. Go into the API Perspective and name it appropriately. In the demo, Nathan tracked Boston_Temp.
Choose your method – GET or POST – and you can choose to parse on JSON or XML. In the demo, Nathan uses GET and JSON response format. He added in the URL:
http://api.weatherapi.com/v1/current.json?key=d05568e735ba4d61910165002211611&q=Boston&aqi=no and current.feelslike_f as the extraction path.
Then choose when you want an alert to be generated and the warning and critical thresholds.
The API Query MP will then start to generate alerts as the temperature crosses thresholds.
These alerts will also auto recover as the values change. Very neat!
In addition, you can drill into the performance of the API call itself, as well as the value you’re monitoring via the API, so you can go back and see the historic values.
Stoyan Chalakov, one of the HackaSCOM judges told Nathan:
“I’m amazed by the UI extension – it’s really a top feature. You did an awesome job. It’s something the community really needs, and the UI extension makes it so much easier to use.”
Nathan already sees some areas that the API Query MP could be extended (and even started work on some elements in the 24-hour challenge!).
“Moving forward, it would be good to actually have somewhere in there do an ‘entity managed by’ managed service and tie it to a resource pool. Then you could say, ‘This branch office, we have a gateway. Run it from there’ ”
said Nathan.
Nathan also nearly managed to get a SQL Query MP built too! Using the OLE DB template, he extended it to allow you to do a SQL test and select your watchers to get a very similar outcome as the API query alerts. The only thing missing from this, which Nathan didn’t have time to complete, is the State View graph.
“I don’t know how you squeezed this in!” said Shivam Kumar.
“The only extending I can think of on the API Query MP would be if you can get the string responses also and how we are alerting that. I think if you add that, then it is production-ready.”
This API Query Management Pack has huge potential and has been long needed by the SCOM community. Thanks to Nathan’s heroic efforts and pulling an all-nighter to build it, you can now get the MP for yourself!
Download the API Query MP here:
https://github.com/P2P-Nathan/HackaSCOM-Perspective-Monitoring