Hi,

I'm trying to monitor my client count on each AP, Optionnally, splitting values between SSID

here is the needed Table OID : 1.3.6.1.4.1.26928.1.1.1.2.1.2

In this table there is a row per connected client.

The way to know numbers of client is to count entry 1.3.6.1.4.1.26928.1.1.1.2.1.2.1.2 (client IP) and group by 1.3.6.1.4.1.26928.1.1.1.2.1.2.1.10 (SSID)

My question is how to process in PRTG for at least to count rows af this table, or count rows grouped by SSID ?

Thanks for your help


Article Comments

Have you tried the SNMP Custom Table Sensor with those OIDs already? Please also have a look at the corresponding KB article :)


Apr, 2016 - Permalink

Hi,

Yes I have, but, SNMP Custom Table sensor is monitring predefined rows of a table (you choose rows during setup using one column as index and some other clumns as value fields).

It doesn't allow you to monitor row count.

In the specific case of that table, rows are corresponding to a name device connected to the AP. So as device list connected to each AP is changing, monitoring each device on each AP won't be a solution ( about 20 APs connect about 200 devices in corp, and some guest devices)

Thanks fr your reply

regards


Apr, 2016 - Permalink

You probably need to come up with a script that parses the number of entries in the table, the sensor is unable to do so. Do the APs have a webinterface that offers some stats? Maybe you could parse this as well...


Apr, 2016 - Permalink

Hi, Sorry, I wasn't notified of your response.

I will have a look in Writing a script. I think it will be easier than accessing the Hivemanager

regards


May, 2016 - Permalink

Here is My script (using http://vwiki.co.uk/SNMP_and_PowerShell#PowerShell_v1_and_v2 informations) :

param(
[string]$pIP
)

[reflection.assembly]::LoadFrom( (Resolve-Path "C:\MA_Scripts\lib\SharpSnmpLib.dll") )

function New-GenericObject {
    # Creates an object of a generic type - see http://www.leeholmes.com/blog/2006/08/18/creating-generic-types-in-powershell/
 
    param(
        [string] $typeName = $(throw “Please specify a generic type name”),
        [string[]] $typeParameters = $(throw “Please specify the type parameters”),
        [object[]] $constructorParameters
        )
 
    ## Create the generic type name
    $genericTypeName = $typeName + ‘`’ + $typeParameters.Count
    $genericType = [Type] $genericTypeName
 
    if(-not $genericType)
        {
        throw “Could not find generic type $genericTypeName”
        }
 
    ## Bind the type arguments to it
    [type[]] $typedParameters = $typeParameters
    $closedType = $genericType.MakeGenericType($typedParameters)
    if(-not $closedType)
        {
        throw “Could not make closed type $genericType”
        }
 
    ## Create the closed version of the generic type
    ,[Activator]::CreateInstance($closedType, $constructorParameters)
}


function Invoke-SnmpWalk ([string]$sIP, $sOIDstart, [string]$Community = "public", [int]$UDPport = 161, [int]$TimeOut=3000) {
    # $sOIDstart
    # $TimeOut is in msec, 0 or -1 for infinite
 
    # Create OID object
    $oid = New-Object Lextm.SharpSnmpLib.ObjectIdentifier ($sOIDstart)
 
    # Create list for results
    $results = New-GenericObject System.Collections.Generic.List Lextm.SharpSnmpLib.Variable                       # PowerShell v1 and v2
    # $results = New-Object 'System.Collections.Generic.List[Lextm.SharpSnmpLib.Variable]'                         # PowerShell v3
 
    # Create endpoint for SNMP server
    $ip = [System.Net.IPAddress]::Parse($sIP)
    $svr = New-Object System.Net.IpEndPoint ($ip, 161)
 
    # Use SNMP v2 and walk mode WithinSubTree (as opposed to Default)
    $ver = [Lextm.SharpSnmpLib.VersionCode]::V2
    $walkMode = [Lextm.SharpSnmpLib.Messaging.WalkMode]::WithinSubtree
 
    # Perform SNMP Get
    try {
        [Lextm.SharpSnmpLib.Messaging.Messenger]::Walk($ver, $svr, $Community, $oid, $results, $TimeOut, $walkMode)
    } catch {
        Write-Host "SNMP Walk error: $_"
        Return $null
    }
 
    $ClientsSSID = @{}

    foreach ($var in $results) {
	    if( $var.Id.ToString().StartsWith(".1.3.6.1.4.1.26928.1.1.1.2.1.2.1.10.") ) {
        	$SSID = $var.Data.ToString()
		    if($ClientsSSID.ContainsKey($SSID)){
			    $ClientsSSID.Set_Item($SSID,$ClientsSSID.Get_Item($SSID)+1)
		    }else{
			    $ClientsSSID.add($SSID,1)
		    }
	    }
    }


    write-host '<?xml version="1.0" encoding="Windows-1252" ?>'
    write-host '<prtg>'
    ForEach($client in $ClientsSSID.keys){
        write-host "   <result>"
        write-host "      <channel>$client</channel>"
        write-host "      <value>",$ClientsSSID.Get_Item($client),"</value>"
        write-host "   </result>"
    }
    write-host "</prtg>"
}

Invoke-SnmpWalk $pIP "1.3.6.1.4.1.26928.1.1.1.2.1.2" "xxxx"

this works well


May, 2016 - Permalink

Cool, thanks for sharing! :)


May, 2016 - Permalink

I still have a problem on my remote probes.

I copied needed Dll and ps1 file in the good directories.

Why I run the script on command line, it works well, But Prtg returns an invalid xml syntax.

I supposed there is something about remote execution of powershell ?

regards


May, 2016 - Permalink

Did you execute Set-ExecutionPolicy RemoteSigned in an administrative PowerShell (x86) already?


May, 2016 - Permalink

That's it, thanks a lots, everything is working well

to use it, create un custom sensor (Exe sensor upgraded) and then set IP in parameter field.

regards


May, 2016 - Permalink

How Can I mark this topic as solved ?


May, 2016 - Permalink

That's not necessary, glad it worked :)


May, 2016 - Permalink

See also this thread using the REST Custom Sensor to retrieve the amount of connected clients per AP through Aerohive's REST API.


Feb, 2018 - Permalink