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

Are there any sensor to monitor number of devices in a probe?

Votes:

0

Hello Community!

Are there any way to show a graph or quantity table of the number of devices monitored by one probe?

Best, Eduardo

devices quantity sensor

Created on Mar 29, 2021 7:36:58 PM



3 Replies

Votes:

0

Hello Eduardo,

Thank you for your message.

There is no native way to display this information, however you can get it by using the REST Custom sensor or an EXE/Script sensor:, with the following API call:

https://PRTGSERVER/api/table.json?content=devices&columns=objid,name,host,group,probe&count=*&id=PROBEID&noraw=1&username=PRTGUSER&passhash=PASSHASH

The request above returns a response such as the one illustrated below:

{
"prtg-version": "21.1.66.1621",
"treesize": 19,
"devices": [
{
"objid": 40,
"name": "Probe Device",
"host": "127.0.0.1",
"group": "Local Probe",
"probe": "Local Probe"
},
{
"objid": 2033,
"name": "Script EXE",
"host": "status.gotomeeting.com",
"group": "Services",
"probe": "Local Probe"
},
...
]
}

The object treesize returns the number of devices which corresponds to the request made.

Here is the structure of the response that the script must return in case you use the EXE/Script sensor: https://www.paessler.com/manuals/prtg/custom_sensors#standard_exescript

If you have questions, let us know.

Regards.

Created on Mar 30, 2021 6:11:43 AM by  Florian Lesage [Paessler Support]

Last change on Mar 30, 2021 6:13:00 AM by  Florian Lesage [Paessler Support]



Votes:

0

Hi Florian!

Thanks a lot for your reply, but I created and the sensor became RED reporting too many channels, is this the normal behavior or I have to filter in some way?

It seems an excellent way to monitor some statistics!

Best regards, Eduardo Ellery

Created on Mar 30, 2021 12:27:14 PM



Votes:

0

Thank you for your feedback.

I have taken a look at the REST Custom sensor, and unfortunately the credentials can't be hidden there. Therefore, I would recommend to go with the EXE/Script sensor to which you can pass the credentials configured in the device settings. To do so, you can use the placeholders %windowsuser and %windowspassword in the parameters sent to the script, explained below.

Here is an example of script which can help you to get the information, please notice that we do not provide support for it.

Param (
    [string]$url = "",
    [string]$probeID = "",
    [string]$prtguser = "",
    [string]$passhash = ""
)

function Invoke-Request {
    Param(
        $baseurl = $script:url,
        $user = $script:prtguser,
        $pass = $script:passhash,
        $probeID
    )
    $url = "{0}/api/table.json?content=devices&columns=objid,name&count=*&id={1}&noraw=1&username={2}&passhash={3}" -f $baseurl.trim("/"), $probeID, $user, $pass
    Invoke-RestMethod -Uri $url -Method Get -SkipCertificateCheck
}

try {
    $r = Invoke-Request
    $output = "{0}:OK" -f $($r.treesize)
    Write-Host $output
    exit 0
} catch {
    $err = "$($($_.exception.message)) at line : $($_.InvocationInfo.ScriptLineNumber))"
    $output = "0:{0}" -f $err
    Exit 1
}

When adding the EXE/Script sensor, you must send the parameters as the following:

"<Server Address>" "<ProbeID>" "<PRTG User>" "<Passhash>"

Make sure to remove the characters <> when replacing the information above. Here is the documentation regarding custom sensors: https://www.paessler.com/manuals/prtg/custom_sensors#standard_exescript

Regards.

Created on Mar 30, 2021 1:09:57 PM by  Florian Lesage [Paessler Support]

Last change on Mar 30, 2021 1:13:02 PM by  Florian Lesage [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.