Hi all, I'm trying to use API to monitor our Meraki estate, but from what I can see, using the REST Custom v2 sensor, we can only return number based results. I'm wanting to monitor a text field that responds with either "online" or "offline". I'm thinking I can probably do something as an intermediary between Meraki and PRTG that takes this text field from the API call and does something like change online to equal 1, and offline to equal 0, and then have that go in to PRTG. Has anyone done something similar? Any suggestions on how I might achieve this? Thanks, Jack.


Article Comments

Hello Jack,

the REST Custom v2 sensor doesn't support string values yet.

The regular REST Custom sensor supports strings and would be the best choice for what you're trying to do.
This sensor is described here: https://www.paessler.com/manuals/prtg/rest_custom_sensor

You will need a Template for this, an example of this is below: { "prtg": { "result": [ { "channel": "CHANNEL", "value": lookup(PATH,"offline","online"), "valuelookup": "LOOKUP ID" } ] } }

In the template above, when the API returns the state "offline" the value will be 0. It will be 1 for "online".
You will need to replace the values in all caps with the desired Channel, the JSON key path and a lookup ID.
Please save the REST template here: C:\Program Files (x86)\PRTG Network Monitor\Custom Sensors\rest (file .template)

You will need a lookup file as well: <?xml version="1.0" encoding="UTF-8"?> <ValueLookup id="LOOKUP ID" desiredValue="1" undefinedState="Warning" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PaeValueLookup.xsd"> <Lookups> <SingleInt state="Error" value="0"> Offline </SingleInt> <SingleInt state="Ok" value="1"> Online </SingleInt> </Lookups> </ValueLookup> Please insert the lookup ID from the template file for the all caps value.
This needs to be saved here: C:\Program Files (x86)\PRTG Network Monitor\lookups\custom (file .ovl)


Kind regards,
Johannes Beyerlein, Technical Support Team


May, 2022 - Permalink