Hello,
After hours of Googling and with the few examples provided I could not implement the sensor to successfully keep track of associated clients to each AP in our environment. After trial and error and some of the examples I was able to piece together the PowerShell script needed to get the data desired including from the AP that has the role of Virtual Controller. You will need to download SnmpWalk.exe and place in an accessible place for the script. This will be for the "Custom Sensor EXE/Script Advanced."
I use SNMPv3 and so not to store the password in plain text in the script I use the following PowerShell command to create a AES key with the password in a file type of your choosing. Mind you it's not fool proof but better then plain text regardless of which SNMP version you are using.
---------------------------------------------------------------------------
$File = "FILENAME" [Byte[]] $key = (1..32) #Can use different AES bytes $Password = "PASSWORD" | ConvertTo-SecureString -AsPlainText -Force $Password | ConvertFrom-SecureString -key $key | Out-File $File
---------------------------------------------------------------------------
Use the following code on your AP with the Virtual Controller:
---------------------------------------------------------------------------
$File = "LOCATION OF PASSWORD FILE" [Byte[]] $key = (1..32) $SecurePassword = Get-Content $File | ConvertTo-SecureString -Key $key $NEWsecurePassword = (New-Object PSCredential "user",$SecurePassword).GetNetworkCredential().Password $snmpwalk = (c:\snmpwalk\SnmpWalk.exe -r:AP_IP -p:161 -v:3 -sn:USERNAME -ap:SHA -aw:$NEWsecurePassword -pp:AES128 -pw:$NEWsecurePassword -os:1.3.6.1.4.1.14823.2.3.3.1.2.5.1.4.0 -op:1.3.6.1.4.1.14823.2.3.3.1.2.5.1.5) $totalAP = ($snmpwalk | Select-String -Pattern 'NAME OF AP WITH VIRTUAL CONTROLLER') $numval = ($totalAP | Where-Object {"NAME OF AP WITH VIRTUAL CONTROLLER"} | Measure-Object | Select-Object -exp count) write-host "<prtg>" write-host "<result>" write-host "<channel>Clients connected</channel>" write-host "<value>"$numval"</value>" write-host "</result>" write-host "</prtg>"
---------------------------------------------------------------------------
Use the following code on each AP sensor:
---------------------------------------------------------------------------
$File = "LOCATION OF PASSWORD FILE" [Byte[]] $key = (1..32) $SecurePassword = Get-Content $File | ConvertTo-SecureString -Key $key $NEWsecurePassword = (New-Object PSCredential "user",$SecurePassword).GetNetworkCredential().Password $snmpwalk = (c:\snmpwalk\SnmpWalk.exe -r:AP_IP -p:161 -v:3 -sn:USERNAME -ap:SHA -aw:$NEWsecurePassword -pp:AES128 -pw:$NEWsecurePassword -os:1.3.6.1.4.1.14823.2.3.3.1.2.4.1.3 -op:1.3.6.1.4.1.14823.2.3.3.1.2.4.1.4) $totalAP = ($snmpwalk | Select-String -Pattern 'Total') $totalAP = $totalAP -replace 'Total:' $numval = [int]::Parse($totalAP) write-host "<prtg>" write-host "<result>" write-host "<channel>Clients connected</channel>" write-host "<value>"$numval"</value>" write-host "</result>" write-host "</prtg>"
---------------------------------------------------------------------------
Hope this helps someone save time!