What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Workaround for API call text field to number field?

Votes:

0

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.

api meraki rest

Created on May 11, 2022 9:01:10 AM



1 Reply

Votes:

0

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

Created on May 17, 2022 5:52:51 AM by  Johannes Beyerlein [Paessler Support]




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.