What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

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 not retrieving single device details

Votes:

0

Your Vote:

Up

Down

Hi,

I have tried to use the API to retrieve multiple (ideally all) properties from a single device object and get no results (directly from the API builder in PRTG).

If I navigate to a device I can clearly see the object id is 12345 https://prtg/device.htm?id=12345&tabid=7

But when I try to use the API to retrieve device details I get no real data (other than basic XML with totalcount=0) https://prtg/api/table.xml?content=devices&output=xml&columns=objid,group,device,name,status&count=10&id=12345

If I leave off the "id=12345" - I get back all device names. The help for the "id" field clearly states "The table will only contain information for this object id and its child objects (all objects will be used if this parameter is omitted)"

Am I missing something here?

Thanks, Steve

api device prtg

Created on Nov 13, 2019 11:39:56 AM by  pilkins (0) 1



4 Replies

Votes:

0

Your Vote:

Up

Down

Hello Steve,

Thank you for your post.

What exactly do you want to have as a result? Do you want all the sensors that are in the device?
Can you give an example on how the output should look like?


Kind regards,
Sasa Ignjatovic, Tech Support Team

Created on Nov 14, 2019 10:21:09 AM by  Sasa Ignjatovic [Paessler Support]



Votes:

1

Your Vote:

Up

Down

https://prtg/api/table.xml?content=devices&output=xml&columns=objid,group,device,name,status&count=10&id=12345

This request is not valid. To filter by ID you need to specify filter_objid=12345

Created on Nov 14, 2019 10:34:58 AM by  lordmilko (2,142) 2 1



Votes:

0

Your Vote:

Up

Down

lordmilko,

Thanks for the pointer - using the "filter_objid=" URL parameter has solved my problem accessing device properties in one go (rather than multiple API calls).

Sasa,

The PRTG API online help seems to incorrectly specify the use of "id=xxx" URL parameter to filter results. It is mentioned on the "Accessing Live Object Data and Live Status Data" page and used in the "XML Table Query Builder" if you specify an ID to return for the "Devices: List of all devices" test. This does not work (hence my original problem). Lordmilkos reply/help has pointed me to the correct parameter.

The use of the "ID=" parameter is also reference on the same page under the "Filtering by Object ID" section. It states "Add an ID parameter (for example, id=1) to the API URL to select a subset of items".

Clearly this did not work for me - and I can find no reference on the page to the use of "filter_objid="

Cheers, Steve

Created on Nov 15, 2019 5:22:44 PM by  pilkins (0) 1



Votes:

0

Your Vote:

Up

Down

Hello Steve,

The problem was with the "content=devices", this will list all the devices that are under the object with the specified ID. Since the ID that you entered was from a device, you have received a empty result (since you can not have devices under a device). So the solution is to filter for the ID, as lordmilko suggested.

Created on Nov 18, 2019 7:45:04 AM by  Sasa Ignjatovic [Paessler Support]



Please log in or register to enter your reply.


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.