Hi, I need to generate a web page that will give me a table with all of the down sensors with this columns - device name, sensor name .

I'm not very good with the API. can you help me?

Thanks, Meir


Article Comments

Hello,

the query would be something like:

https://MY_PRTG/api/table.xml?content=sensors&filter_status=5&output=xml&columns=device,sensor

best regards.


Sep, 2011 - Permalink

Thanks! Can I take this xml and produce http with a table? ( just like when I press the alarms button on the PRTG web interface)

Meir


Sep, 2011 - Permalink

If you want a table, you could use the alarms-URL directly:

https://MY_PRTG/alarms.htm?filter_status=5&filter_status=13&filter_status=14

best regards.


Sep, 2011 - Permalink

yes, but i don't need all of the columns... only device name, and sensor name of the "down state" devices.

Meir


Sep, 2011 - Permalink

The HTML-Table is only available in this format. You could however copy the alarms.htm and name it alarms2.htm, remove all the unwanted columns and then use the above mentioned URL again

https://MY_PRTG/alarms2.htm?filter_status=5&filter_status=13&filter_status=14

Sep, 2011 - Permalink

This can be done with API call:

/api/table.xml?content=sensors&output=html&columns=device,sensor&filter_status=5&filter_status=13&filter_status=14&login=myusername&password=mypassword

Replace myusername and mypassword with valid credentials to connect to your PRTG server.

Only, for some strange reason it produces a .xml file that has to be manually renamed to .htm before it can be opened with your web browser.


Sep, 2011 - Permalink

Thanks! Exactly what I was looking for. Anyone have idea how to produce htm page instead of the xml file? that will solve the problem completely...


Sep, 2011 - Permalink

Hi Meirely,

To solve the problem completely, you could write a script or batch file that:

  1. Downloads the file from the url
  2. Renames the file to .htm
  3. Starts a browser session with the renamed file

Sep, 2011 - Permalink

Hi Meirely

This is even a better solution.

In the \website\api folder of your PRTG installation create a new file named table.htm and paste the folowing code:

<#table output="htm" count="500" refreshable="false" sortable="false" tools="" showzoomlink="" tabletitle="" links="false" infoheader="false">

In your web browser you can now use the following url:

/api/table.htm?content=sensors&output=html&columns=device,sensor&filter_status=5&filter_status=13&filter_status=14&login=myusername&password=mypassword

Replace myusername and mypassword with valid credentials to connect to your PRTG server.

This will open the html page with the data you are looking for directly in your browser.


Sep, 2011 - Permalink

That is working great! Is there a parameter that I can add in the htm to make the page auto refresh?

Tha


Sep, 2011 - Permalink

In the table.htm file Insert the folowing code above the existing code to make the page refresh every 15 seconds

<META HTTP-EQUIV="refresh" CONTENT="15">

Sep, 2011 - Permalink

working! thanks


Sep, 2011 - Permalink