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

Ubiquiti device statistics not seen



Good Morning I already created the sensor with all the steps of the t Powershell script, it runs the sensor it is in green state without errors, but it doesn't show information about the connected clients, the connected APs etc.

I followed all the steps to create the script and everything ok but I can't see the statistics

prtg snmp ubnt-unifi-mib

Created on May 18, 2020 5:29:13 PM

4 Replies



Dear hector2010,

all script come without technical support. In order to debug the issue, pleas open the sensors's "Settings" tab, enable "Write Exe result to disk", and after next scan, check the output in ""C:\ProgramData\Paessler\PRTG Network Monitor\Logs\sensors".

Created on May 18, 2020 6:44:06 PM by  Arne Seifert [Paessler Support]



Annex the log to the sensor

<prtg> <result> <channel>Access Points Connected</channel> <value>0</value> </result> <result> <channel>Access Points Upgradeable</channel> <value>0</value> </result> <result> <channel>Clients (Total)</channel> <value>0</value> </result> <result> <channel>Guests</channel> <value>0</value> </result> <result> <channel>Response Time</channel> <value>2018</value> <CustomUnit>msecs</CustomUnit> </result> </prtg>

Created on May 19, 2020 3:06:41 AM



param( [string]$server = '', [string]$port = '8443', [string]$site = 'default', [string]$username = 'admin', [string]$password = 'c3rv3c3r14', [switch]$debug = $false )

  1. Ignore SSL Errors [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
  2. [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
  1. Define supported Protocols [System.Net.ServicePointManager]::SecurityProtocol = @("Tls12","Tls11","Tls","Ssl3")
  1. Confirm Powershell Version. if ($PSVersionTable.PSVersion.Major -lt 3) { Write-Output "<prtg>" Write-Output "<error>1</error>" Write-Output "<text>Powershell Version is $($PSVersionTable.PSVersion.Major) Requires at least 3. </text>" Write-Output "</prtg>" Exit }
  1. Create $controller and $credential using multiple variables/parameters. [string]$controller = "https://$($server):$($port)/manage/account/login" [string]$credential = "`{`"username`":`"$username`",`"password`":`"$password`"`}"
  1. Start debug timer $queryMeasurement = [System.Diagnostics.Stopwatch]::StartNew()
  1. Perform the authentication and store the token to myWebSession try { $null = Invoke-Restmethod -Uri "$controller" -method post -body $credential -ContentType "application/json; charset=utf-8" -SessionVariable myWebSession }catch{ Write-Output "<prtg>" Write-Output "<error>1</error>" Write-Output "<text>Authentication Failed: $($_.Exception.Message)</text>" Write-Output "</prtg>" Exit }
  1. Query API providing token from first query. try { $jsonresultat = Invoke-Restmethod -Uri "" -WebSession $myWebSession }catch{ Write-Output "<prtg>" Write-Output "<error>1</error>" Write-Output "<text>API Query Failed: $($_.Exception.Message)</text>" Write-Output "</prtg>" Exit }
  1. Load File from Debug Log
  2. $jsonresultatFile = Get-Content '.\unifi_sensor2017-15-02-05-42-24_log.json'
  3. $jsonresultat = $jsonresultatFile | ConvertFrom-Json
  1. Stop debug timer $queryMeasurement.Stop()
  1. Iterate jsonresultat and count the number of AP's.
  2. $_.state -eq "1" = Connected
  3. $_.type -like "uap" = Access Point ?

$apCount = 0 Foreach ($entry in ($jsonresultat.data | where-object { $_.state -eq "1" -and $_.type -like "uap"})){ $apCount ++ }

$apUpgradeable = 0 Foreach ($entry in ($jsonresultat.data | where-object { $_.state -eq "1" -and $_.type -like "uap" -and $_.upgradable -eq "true"})){ $apUpgradeable ++ }

$userCount = 0 Foreach ($entry in ($jsonresultat.data | where-object { $_.type -like "uap"})){ $userCount += $entry.'num_sta' }

$guestCount = 0 Foreach ($entry in ($jsonresultat.data | where-object { $_.type -like "uap"})){ $guestCount += $entry.'guest-num_sta' }

  1. Write Results

write-host "<prtg>"

Write-Host "<result>" Write-Host "<channel>Access Points Connected</channel>" Write-Host "<value>$($apCount)</value>" Write-Host "</result>"

Write-Host "<result>" Write-Host "<channel>Access Points Upgradeable</channel>" Write-Host "<value>$($apUpgradeable)</value>" Write-Host "</result>"

Write-Host "<result>" Write-Host "<channel>Clients (Total)</channel>" Write-Host "<value>$($userCount)</value>" Write-Host "</result>"

Write-Host "<result>" Write-Host "<channel>Guests</channel>" Write-Host "<value>$($guestCount)</value>" Write-Host "</result>"

Write-Host "<result>" Write-Host "<channel>Response Time</channel>" Write-Host "<value>$($queryMeasurement.ElapsedMilliseconds)</value>" Write-Host "<CustomUnit>msecs</CustomUnit>" Write-Host "</result>"

write-host "</prtg>"

  1. Write JSON file to disk when -debug is set. For troubleshooting only. if ($debug){ [string]$logPath = ((Get-ItemProperty -Path "hklm:SOFTWARE\Wow6432Node\Paessler\PRTG Network Monitor\Server\Core" -Name "Datapath").DataPath) + "Logs (Sensors)\" $timeStamp = (Get-Date -format yyyy-dd-MM-hh-mm-ss)

$json = $jsonresultat | ConvertTo-Json $json | Out-File $logPath"unifi_sensor$($timeStamp)_log.json" }

Created on May 19, 2020 3:11:41 AM



Dear hector2010,

it seems the script yields zero-values. You could run the individual commands manually and debug it in order to see where it is going wrong. As from our side, script usage is not covered by technical support.

Created on May 19, 2020 1:32:59 PM by  Arne Seifert [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.