Monitor the values of a JSON API
Query a host's API (for example, a printer's supplies), look at its JSON and pick with one click the values to monitor, each with its metric and thresholds.
On this page
Many hosts have an API that responds in JSON: printers (ink or toner levels), UPS units, controllers, in-house systems. A JSON API test queries that API, takes the values you choose and stores them as device metrics: with their chart and status on the host's page in Infrastructure, like any other monitor.
Before you start
You need Administer on Plugins to create the test and Operate to associate it with a host.
The query is made by the monitoring probe (3.3.0 or later) that monitors the host. It can only be associated with hosts monitored by a probe; a server's agent and the ARGUNIS cloud don't run it.
If the API asks for a token or a username and password, create them in the vault first (Settings → Monitoring → Credentials). They are never written in the test.
Steps
Go to Settings → Monitoring → Monitoring tests and click New test.
Enter the Name (for example, "HP printer · inks").
In Plugin, choose JSON API: query a JSON and pick its values (always run by a probe).
In API URL, enter the address with the device macros, for example
https://$HOSTADDRESS$/cdm/supply/v1/suppliesPublic. That way the same test works for all printers of that model.If the host uses its own certificate (common on printers), check Accept the host's own certificate (self-signed).
In Query, search for a sample Device monitored by a probe (and choose the Credential if the API requires one) and click Query: the request is made by that device's probe.
You will see the API's JSON. Next to each numeric value, click Monitor: it is added to the Monitored values table with a name, its metric and its path.
In the table, adjust the Name, the Unit, whether it alerts when the value drops below or rises above, and the Warning and Critical thresholds. For example, an ink: "drops below", warning 20 and critical 10.
Click Save.
Then associate it with hosts from their page (Add from the catalog) or with a Create a monitoring tag.
In a list (for example, the supplies list), ARGUNIS finds the item by its content and not by its position: the path becomes suppliesList[supplyType=inkTank, supplyColorCode=K].percentLifeDisplay (the black ink tank). If the host changes the order of the list, the value is still found.
What happens next
Each value is a metric of the monitor on the host's page, with its chart.
The monitor's status is the worst of its values. If the API doesn't respond, doesn't return JSON or a value is missing, it goes critical and the text says why.
Up to 20 values per test, a response of up to 1 MB and an interval of at least 30 seconds.
POST, PUT, PATCH and DELETE requests can change data on the host: you have to confirm them when saving.