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

Sensors to report on the sensors on PRTG

Votes:

0

Hello, i am trying to make a monitoring team dashboard and need a set of sensors that can watch the current status of the PRTG server so i can pull these out to grafana. Do you know of a way/example of using the sensors already present in PRTG or using the REST XML sensor to return the PRTG status. Data i need is current alarms/warns/pauses and background tasks.

thanks sam

alarms prtg-status rest

Created on Mar 22, 2018 9:14:48 AM



5 Replies

Votes:

0

Hi Samuel,

if JSON is permissable you can retrieve all of specified information in JSON from the getstatus.htm function,

https://prtg.example.com/api/getstatus.htm?id=0&username=username&passhash=passhash

While there is a corresponding getstatus.xml function to return data in XML format, this does not include all of the fields the JSON version does, only including high level information such as the number of number of background tasks and active alarms.

If you require that the response be in XML, you can separately use the gettreenodestats.xml function to retrieve information regarding sensor totals

https://prtg.example.com/api/gettreenodestats.xml?username=username&passhash=passhash

Regards,

lordmilko

Created on Mar 22, 2018 10:52:06 AM



Votes:

0

Hello Mr Milko (first thank you so much for the PRTG data source!!)

The /api/getstatus.htm query appears to not be able to return the up/down sens info as it shows object not found in the outputted page for these fields. gettreenodestats.xml works well outputting all the info i need however when trying to input these into the grafana plugin i get unexpected json character.

More than anything i am trying to create a sensor within PRTG so that our attached alarm system can let us know if we breach over a certain threshold of alarms, these sensors i will then add to grafana

cheers sma

Created on Mar 22, 2018 11:27:44 AM



Votes:

1

If you are trying to create an EXE/Script Advanced sensor within PRTG that contains this information, the easiest way to extract this from PRTG is with PrtgAPI via the Get-PrtgStatus cmdlet

PS C:\> Get-PrtgStatus

Version                  : 18.1.38.11958
NewLogs                  : 1
NewAlarms                : 0
Alarms                   : 1
AcknowledgedAlarms       : 1
PartialAlarms            : 0
UnusualSensors           : 1
UpSensors                : 21
WarningSensors           : 1
...

You can store the result of Get-PrtgStatus in a variable and then turn each property you care about into a channel (which you should obviously do with PrtgAPI.CustomSensors :P)

$status = Get-PrtgStatus

Prtg {
    Result {
        Channel "Up"
        Value $status.UpSensors
    }

    Result {
        Channel "Down"
        Value $status.DownSensors
    }

    Result {
        Channel "Alarms"
        Value $status.Alarms
    }
}

Output:

<Prtg>
    <Result>
        <Channel>Up</Channel>
        <Value>199</Value>
    </Result>
    <Result>
        <Channel>Down</Channel>
        <Value />
    </Result>
    <Result>
        <Channel>Alarms</Channel>
        <Value>29</Value>
    </Result>
</Prtg>

By specifying the -Verbose argument to any PrtgAPI cmdlet you can see the URL it generates to retrieve the specified data.

I'm not sure why you would be getting object not found unless your user account potentially has limited permissions on your system

If Get-PrtgStatus also returns object not found, you can retrieve the information returned by gettreenodestats.xml via the Get-SensorTotals cmdlet

Created on Mar 22, 2018 12:40:18 PM



Votes:

0

Holy heck it works! Also this is the first time i've used the custom sensor creator and wow... you really know how to make my job/life easier :) Thanks!

Created on Mar 22, 2018 2:59:36 PM



Votes:

0

Hey lordmilko,

Thank you for helping the user and for pushing your great API-Application!

Best regards.

Created on Mar 22, 2018 3:12:34 PM by  Dariusz Gorka [Paessler Support]




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.