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
Article Comments
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;
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
Aug, 2020 - Permalink
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
Aug, 2020 - Permalink
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
Aug, 2020 - Permalink