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

API single call returning multi sensor channels

Votes:

0

Good evening everyone,

I need to retrieve a large amount of sensors (and their channels) with one API request and return the whole list in JSON or XML. Unfortunately I can't seem to get any further than either having all the sensors values without the channel data, or the channel data but then it is only for a single sensor.

It is not feasible due to the total amount of sensors to perform a API call for each one of them because that would take too long (and create an asynchronous mess)

How can this be done ... and please don't tell me it cant :-)

Thanks Michaël

api channels multiple sensors

Created on Oct 6, 2018 7:30:26 PM



5 Replies

Accepted Answer

Votes:

0

Hello Michaël,
thank you for your KB-Post/Inquiry.

Unfortunately I don't really have good news. Most API calls will only contain the value of a sensor's primary channel.

If you need all channels, you need to work with /api/table.xml?content=channels, in which case a sensor ID must be specified/supplied (for instance: &id=1234)

Best Regards,
Luciano Lingnau [Paessler Support]

Created on Oct 8, 2018 11:30:46 AM by  Luciano Lingnau [Paessler]



Votes:

0

Hi Luciano,

Unfortunately then in this case I would have to iterate through all sensors with individual /api/table.xml?content=channels&id=n requests which is not workable due to the delay it would create in rendering the data.

What is the structure of the data files you use (as you don't us any rdbms for this purpose), then I can maybe write my own api extension.

Thanks
Michaël

Created on Oct 8, 2018 12:47:45 PM

Last change on Oct 9, 2018 6:19:09 AM by  Luciano Lingnau [Paessler]



Votes:

0

Hello Michaël,
thank you for your reply.

Would you mind elaborating about what exactly you're trying to achieve? Why exactly do you want to get all live sensor data out of PRTG? What do you want to do with it?

But yes, I agree that iterating trough every possible sensor in your installation o get the live data for each channel from every sensor could take a while.

Depending on what you're trying to achieve, the following may save you some work:

However, direct access to the data files is not an option, they are binary-encoded in a proprietary format. The API is the only available interface with the data.

Best Regards,
Luciano Lingnau [Paessler Support]

Created on Oct 9, 2018 6:32:24 AM by  Luciano Lingnau [Paessler]



Votes:

0

Any chance that PAESSLER has added the ability to pull all Channels from the API instead of per sensor?

Created on Apr 7, 2022 1:38:44 AM



Votes:

0

Hello uramirez_074,
thank you for your inquiry.

While we don't plan to make any major changes to the existing PRTG API, we're working on a new API that is being built from the ground up to be more flexible and user-friendly. While it is far from being production ready, this is the API that we'll be extending and maintaining in the future. I encourage you to have a look at the following:

While the new API v2 is far from being complete, as per the API Reference you should already be able to issue a /api/v2/sensors?offset=0&limit=100&include_all_channels=true and this would include all channels for every sensor in the result.

However, it's very important to keep in mind that the API v2 in it's current state is still an Alpha version and breaking changes (as well as bugs) might still be common in this phase. You can read more about it in the links above.

Best Regards,
Luciano Lingnau [Paessler]

Created on Apr 7, 2022 7:21:28 AM by  Luciano Lingnau [Paessler]




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.