From: W.J.M. N. <ne...@nl...> - 2010-03-03 07:27:31
|
Hello, > I am trying to develop a new template for Cisco Wireless Controllers, and running into a snag with devmon's features. Here is a quick snippet of the SNMP conversations I am trying to analyze: > > (names of wireless access points connected to controller) > snmpwalk -v2c -cpublic 10.13.1.4 .1.3.6.1.4.1.14179.2.2.1.1.3 > SNMPv2-SMI::enterprises.14179.2.2.1.1.3.0.35.235.10.79.64 = STRING: "wap-1st-2" > SNMPv2-SMI::enterprises.14179.2.2.1.1.3.0.37.132.253.194.144 = STRING: "wap-2nd-5" > SNMPv2-SMI::enterprises.14179.2.2.1.1.3.0.37.132.253.200.192 = STRING: "wap-2nd-4" > > (number of clients connected to each WAP - by radio) > snmpwalk -v2c -cpublic 10.13.1.4 .1.3.6.1.4.1.14179.2.2.2.1.15 > SNMPv2-SMI::enterprises.14179.2.2.2.1.15.0.35.235.10.79.64.0 = Counter32: 4 > SNMPv2-SMI::enterprises.14179.2.2.2.1.15.0.35.235.10.79.64.1 = Counter32: 1 > SNMPv2-SMI::enterprises.14179.2.2.2.1.15.0.37.132.253.194.144.0 = Counter32: 7 > SNMPv2-SMI::enterprises.14179.2.2.2.1.15.0.37.132.253.194.144.1 = Counter32: 3 > SNMPv2-SMI::enterprises.14179.2.2.2.1.15.0.37.132.253.200.192.0 = Counter32: 1 > SNMPv2-SMI::enterprises.14179.2.2.2.1.15.0.37.132.253.200.192.1 = Counter32: 1 > > In the above examples, 0.35.235.10.79.64 resents a single WAP (the repeater part of the oid identifies the MAC address in decimal). In the above example, the WAP labeled as wap-1st-2 has a "repeater OID" of 0.35.235.10.79.64.0, which corresponds to a MAC address of 00:23:eb:0a:4f:40 (not particularly germane to this question, but I thought I would include the example). > > Each WAP has two radios, which lead to two different results (.0 and .1). > > What I would *like* to have is a nice devmon table similar to "regular" switches, with the WAP name in the 1st column, the .0 client count in column 2, and .1 count in column 3: > > WAP Name 2.4GHz clients 5 GHz clients > wap-1st-2 4 1 > wap-2nd-5 7 3 > wap-2nd-4 1 1 > > But I believe I have found a limitation with the devmon template capabilities. I can easily get the names of the WAPs, and even the repeater section of the OID (via a transform of INDEX). But I have tried the CHAIN, INDEX, and REGSUB transform, and nothing is able to produce the results I seek. > > I need to have a "devmon transforms" that can give me a new oid like follows: > > wapClients24 = {.1.3.6.1.4.1.14179.2.2.2.1.15.}{wapRepeaterOid}.0 > wapClients24 = {.1.3.6.1.4.1.14179.2.2.2.1.15.}{wapRepeaterOid}.1 > > In all my reading of the devmon documentation, I cannot think of any scheme to do this type of operation. > AFAIK, that is not possible in Devmon. However, the intended result can be obtained using a server-side script on Xymon. The following perl script may do what you want: #!/usr/bin/perl # # WAP-usage: determine the number of users per radio of the Wireless Access # Points (WAPs) as well as the number of users per (Cisco) # Wireless LAN Controller. # use strict ; use POSIX qw/ strftime / ; # Format time # # Installation constants. # my $XyDisp= $ENV{BBSERVERHOSTNAME} ; # Name of monitor server my $XySend= $ENV{BB} ; # Monitor interface program my $FmtDate= "%Y.%m.%d %H:%M:%S" ; # Default date format $FmtDate= $ENV{BBDATEFORMAT} if defined $ENV{BBDATEFORMAT} ; # my $WLC= 'wlc00' ; # Name of Wireless LAN Controller my $TestName= 'wap-user' ; # Xymon test name # # Define the commands to retrieve the information, using SNMP, to determine # the number of users. One command is used to retrieve the names of the # access points, the other to retrieve the number of users per access point # and per radio. # my $SnmpCmd0= "snmpwalk -c public -v 2c $WLC .1.3.6.1.4.1.14179.2.2.1.1.3" ; my $SnmpCmd1= "snmpwalk -c public -v 2c $WLC .1.3.6.1.4.1.14179.2.2.2.1.15" ; # # Variable allocation. # my $Now= strftime( $FmtDate, localtime ) ; # Timestamp of tests my $Cmd ; # Full blown snmpwalk command my $Color= "green" ; # Test status my %Map = () ; # Mapping of code to name my %Users= () ; # Number of users per wap per radio my @Lines ; # Command output my $Result= "" ; # Test result # # Determine the names and the associated codes of the wireless access points. # @Lines= `$SnmpCmd0` ; foreach ( @Lines ) { if ( m/2\.2\.1\.1\.3\.([\.\d]+) = STRING: \"(nlrwap\d\d)\"/ ) { $Map{$1}= $2 ; } # of if } # of foreach # # Determine the number of users per access point and per radio. # @Lines= `$SnmpCmd1` ; # Retrieve user counts foreach ( @Lines ) { if ( m/2\.2\.2\.1\.15\.([\.\d]+)\.(\d) = Counter32: (\d+)/ ) { next unless defined $Map{$1} ; $Users{$Map{$1}}{$2}= $3 ; # Save user count } # of if } # of foreach # # Report the number of users for each WAP to Xymon. # foreach my $wap ( sort keys %Users ) { $Result= "<!--\n" ; foreach my $radio ( sort keys %{$Users{$wap}} ) { $Result.= "Radio$radio : $Users{$wap}{$radio}\n" ; } # of foreach $Result.= "-->" ; $Result= "\"status $wap.$TestName green $Now\n" . "Number of WAP users\n\n$Result\"\n" ; `$XySend $XyDisp $Result` ; # Inform Xymon } # of foreach # # Report the total number of users of the WLC to Xymon. # @Lines= ( 0, 0 ) ; # Preset total number of users $Result= sprintf( "%-9s %7s %7s\n", 'AP', '2.4 GHz', '5.0 GHz' ) ; foreach my $wap ( sort keys %Users ) { $Users{$wap}{1}= 0 unless defined $Users{$wap}{1} ; $Result.= sprintf( "%-9s %7d %7d\n", $wap, $Users{$wap}{0}, $Users{$wap}{1} ) ; $Lines[0]+= $Users{$wap}{0} ; $Lines[1]+= $Users{$wap}{1} ; } # of foreach $Result= "\"status $WLC.$TestName green $Now\n" . "Number of WAP users\n\n$Result<!--\n" . "Radio0 : $Lines[0]\n" . "Radio1 : $Lines[1]\n" . "-->\"\n" ; `$XySend $XyDisp $Result` ; # Inform Xymon Kind regards, Wim Nelis. ******************************************************************************************************* The NLR disclaimer (http://www.nlr.nl/emaildisclaimer) is valid for NLR e-mail messages. ******************************************************************************************************* |