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

prtg api, Channel/sensorID to Device name, or Device name to channel

Votes:

0

hi, given that we need the data from various Channels of a sensor, how do we get the PRTG device's name when using a sensorID,

ie: api/table.json?noraw=1&content=channels&sortby=name&columns=name=textraw,minimum,maximum,condition,lastvalue&id=2704&username=ROuserprtg&passhash=xxx

How do i then get the Device Name from this sensorID ? (ie so i can give a "friendly" name in my app/script, something other than Traffic IN / Traffic OUT)

or another way i can solve my issue is the answer to this: Starting with a DeviceID (of a device), how do i then get the most recent values for any OR all sensor channels of that Device?

(i have only been able to find value_ which gives the "most recent results of a sensor" , but this is not the actual data, its often a time in msec of the response PRTG got to the actual raw data (ie the channel data) thanks

api prtg snmp

Created on Aug 13, 2020 4:09:18 AM

Last change on Aug 13, 2020 5:10:22 AM by  Marijan Horsky [Paessler Support]



3 Replies

Accepted Answer

Votes:

1

Hello Jim,

Thank you for your post.

You can get the sensor details (device name, channel results...) with the API call:

/api/getsensordetails.json?id=sensorid or /api/getsensordetails.xml?id=sensorid


Kind regards,
Sasa Ignjatovic, Tech Support Team

Created on Aug 14, 2020 7:29:04 AM by  Sasa Ignjatovic [Paessler Support]



Votes:

0

Dang, i actually had that in my notes! not sure how i missed it. But thank you very much for the quick and great reply.

if it helps anyone, what ive been doing is using a bash script, where i provide an array (manually typed into script) of my PRTG sensor IDs and every 1m the script is called (cron) and it pulls all the channel values for each of the sensorIDs ive specified in the array, into graphite/whisperDB.

im using a loop over this URL + JQ and awk;

https://prtg.you/api/table.json?noraw=1&content=channels&sortby=name&columns=name=textraw,lastvalue&id=3644&username=ROuserprtg&passhash=xxxxx

now i will add this below so i can pull device or sensor name (i had prior been using an array of hard set names for each sensor ID i added to the script/array);

https://prtg.you/api/getsensordetails.json?id=3644&username=ROuserprtg&passhash=xxxxx

So this script allows my grafana instance atop of graphite to nativly make use of my PRTG data! and it looks amazing! (im aware of the community PRTG grafana plugin, but while great, it has some bugs/issues and is no longer maintained).

Im certainly not a coder, and the script is very simple/basic, but if anyone is interested lmk and ill make a new thread/post it

PRTG is excellent at reliably pulling/storing data (and great at graphing too!), but thanks to the prtgAPI, manipulating prtg data in grafana is an option.

examples of my grafana graphs from prtg data: https://imgur.com/a/BMHztAt

tks

Created on Aug 15, 2020 10:01:47 PM



Votes:

0

to update, Ultimately in my script im now using: https://prtg.you/api/table.json?content=sensor&columns=objid,device,sensor&output=json&id=3644&username=ROuserprtg&passhash=xxxxx

(or other id= )

as i made some changes such that either a deviceID or (just) a SensorID can be provided in array and the script will loop over to grab (and send to graphite) either: all the sensors + channels , names and values (if one or more DeviceIDs are provided) or just the channels , names and values (if only a specific SensorID is provided).

thanks again

Created on Aug 17, 2020 5:59:26 PM




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.