New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


How do I monitor the connected clients of a bintec access point?

Votes:

0

Your Vote:

Up

Down

I want to know if it is possible to monitor the amount of connected clients and their corresponding IP addresses?

Is there a solution for that particular scenario?

custom custom-script-exe exe net-snmp prtg script snmp wifi

Created on Feb 9, 2017 12:37:39 PM by  Dariusz Gorka [Paessler Support]

Last change on Feb 10, 2017 10:54:41 AM by  Gerald Schoch [Paessler Support]



1 Reply

Accepted Answer

Votes:

1

Your Vote:

Up

Down

This article applies to PRTG Network Monitor 16 or later

Monitoring the Connected Clients of a bintec Access Point

If you want to monitor the connected clients of a bintec access point, use the following PowerShell (.ps1) script.

  • The script basically retrieves all entries under a specific OID, counts them, and exports the IP addresses.
  • The script uses the Net-SNMP library. You have to install it on the PRTG Core Server or the Remote Probe system you want to use the script on.

Requirements


How to Use the Script

  • Install the Net-SNMP library.
  • Save the script as a .ps1 file in the \Custom Sensors\EXEXML\ subdirectory of the PRTG program directory on the probe machine from where you want to check the access point.
#    ____  ____  ____________
#   / __ \/ __ \/_  __/ ____/
#  / /_/ / /_/ / / / / / __  
# / ____/ _, _/ / / / /_/ /  
#/_/   /_/ |_| /_/  \____/                         
#    NETWORK MONITOR
#-------------------
#(c) 2017 Dariusz Gorka, Paessler AG
#
# This script checks the connected clients of a bintec access point.
#

# Parameter "-hostaddr" for the remote host (bintec access point)
# Parameter "-community" for the SNMP v2c Community
# Parameter "-port" for the SNMP port of the device
# Parameter "-timeout" for the timeout of the request
# Parameter "-troubleshoot" for the troubleshooting of this script
param(
    [string]$hostaddr = "localhost",
    [string]$community = "public",
    [string]$port = "161",
    [string]$timeout = "5",
    [int]$troubleshoot = 0
)

$regex_string = "(STRING:..)(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b)"
$regex_ipaddr = "(IpAddress:.)(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b)"

[string[]] $walkresult = @(C:\usr\bin\snmpwalk.exe -Cc -Ln -On -v 2c -c $community $hostaddr":"$port ".1.3.6.1.4.1.272.4.46.5.1.54" -t $timeout 2>&1)

if ($troubleshoot -eq 1){
$walkresult_trouble = $walkresult -join ''
}

if (!($walkresult  -like "*= IpAddress: *" -or $walkresult  -like "*= String: *")){
    $clients = 0
} else {
    $clients = $walkresult.count

    for($i=0; $i -lt $walkresult.count; $i++){
        if ($walkresult  -like "*= IpAddress: *"){
            $walkresult[$i] = $walkresult[$i] -match $regex_ipaddr
        } else {
            $walkresult[$i] = $walkresult[$i] -match $regex_string
        }
        if ($i -eq ($walkresult.count -1)) {
            [string] $walkresult[$i] = $matches[2]
        } else {
            [string] $walkresult[$i] = $matches[2] + " - "
        }
    }

    [string]$walkresult_result = $walkresult -join ''
}


write-host "<prtg>"

write-host "<result>"
write-host "<channel>Connected Clients</channel>"
write-host "<value>$($clients)</value>"
write-host "</result>"

if($troubleshoot -eq 0){
    if (!($clients -eq 0)){
        write-host "<text>Clients: $($walkresult_result)</text>"
    }
}

if ($troubleshoot -eq 1){
write-host "<text>$($walkresult_trouble)</text>"
}

write-host "</prtg>"
  • Add an EXE/Script Advanced sensor.
  • In the sensor settings, select the above script from the dropdown list and provide the following under Parameters:

-hostaddr "<device-ip>" -community "<device-snmp-community>" -port "<device-snmp-port>"

  • Adjust the <device-ip>, <device-snmp-community>, and <device-snmp-port> parameters like in the examples below, depending on your scenario:
    • <device-ip>: 123.123.123.123
    • <device-snmp-community>: public
    • <device-snmp-port>: 161
  • You can also use the following placeholders:
    • <device-ip>: %host
    • <device-snmp-community>: %snmpcommunity
  • Click Continue to save your settings. You can now monitor the connected clients of a bintec access point.

Created on Feb 9, 2017 1:11:29 PM by  Dariusz Gorka [Paessler Support]

Last change on Feb 10, 2017 10:53:43 AM by  Gerald Schoch [Paessler Support]



Please log in or register to enter your reply.


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.