graphing cisco 4400 wireless controllers

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

andys
Posts: 24
Joined: Fri Mar 23, 2007 8:06 am

Post by andys »

fixed the interfaces php script for snmpv2. the original query_cisco4400_interfaces.php polled the WLC for the oid $bsnMobileStationInterface using snmpv1 - as seen below, this returns a simple array from which the script extracts the number of associations for a given interface.

the scripts were modified for snmpv2 but, as seen below, the output for the oid $bsnMobileStationInterface using snmpv2 returned a nested array which the original script couldn't cope with so the snmpv2 script was modified to simply sum the number of associations regardless of interface.

i've attached a new query_cisco4400_interfaces.php script that works with both snmp v1 and 2 - it will poll a WLC for the oid $bsnMobileStationInterface and 'flatten' the returned array. the script can then extract the number of associations for a given interface.

cheers
andy


SNMPv1
Array
(
[0] => "wifi_interface_1"
[1] => "wifi_interface_2"
)


SNMPv2
Array
(
[0] => Array
(
[oid] => enterprises.14179.2.1.4.1.27.0.28.X.X.X.X
[value] => wifi_interface_1
)

[1] => Array
(
[oid] => enterprises.14179.2.1.4.1.27.0.28.X.X.X.X
[value] => wifi_interface_2
)
)
Attachments
fixed_snmpv2_query_cisco4400_interfaces.rar
(1.08 KiB) Downloaded 646 times
User avatar
egarnel
Cacti Pro User
Posts: 708
Joined: Thu Nov 21, 2002 8:55 am
Location: Austin, TX

Channel status

Post by egarnel »

I am working on pulling channel & power info out of the controllers and have cludged together some scripts.

Code: Select all

<?php

/* do NOT run this script through a web browser */
if (!isset($_SERVER["argv"][0]) || isset($_SERVER['REQUEST_METHOD'])  || isset($_SERVER['REMOTE_ADDR'])) {
   die("<br><strong>This script is only meant to run at the command line.</strong>");
}

$no_http_headers = true;

if (file_exists(dirname(__FILE__) . "/../include/global.php")) {
        include(dirname(__FILE__) . "/../include/global.php");
}
include(dirname(__FILE__) . "/../include/config.php");
include(dirname(__FILE__) . "/../lib/snmp.php");

$hostname = $_SERVER["argv"][1];
$snmp_community = $_SERVER["argv"][2];
$snmp_version = $_SERVER["argv"][3];


$bsnMobileStationChannel = ".1.3.6.1.4.1.14179.2.2.2.1.4";

$stationchannel = reindex(@cacti_snmp_walk($hostname, $snmp_community, $bsnMobileStationChannel, $snmp_version, "", "", "", ""));

$findStationchannelType= array_count_values($stationchannel);

$stationchannel1=0;
$stationchannel6=0;
$stationchannel11=0;
$stationchannel36=0;
$stationchannel40=0;
$stationchannel44=0;
$stationchannel48=0;
$stationchannel149=0;
$stationchannel153=0;
$stationchannel157=0;
$stationchannel161=0;
$stationchannel165=0;


if (array_key_exists('0', $findStationchannelType)) {
        $stationcchannel1=$findStationchannelType[0];
        }
if (array_key_exists('1', $findStationchannelType)) {
        $stationchannel6=$findStationchannelType[1];
        }
if (array_key_exists('2', $findStationchannelType)) {
        $stationchannel11=$findStationchannelType[2];
        }
if (array_key_exists('3', $findStationchannelType)) {
        $stationchannel36=$findStationchannelType[3];
        }
if (array_key_exists('4', $findStationchannelType)) {
        $stationchannel40=$findStationchannelType[4];
        }
if (array_key_exists('5', $findStationchannelType)) {
        $stationchannel44=$findStationchannelType[5];
        }
if (array_key_exists('6', $findStationchannelType)) {
        $stationchannel48=$findStationchannelType[6];
        }
if (array_key_exists('7', $findStationchannelType)) {
        $stationchannel149=$findStationchannelType[7];
        }
if (array_key_exists('8', $findStationchannelType)) {
        $stationchannel153=$findStationchannelType[9];
        }
if (array_key_exists('9', $findStationchannelType)) {
        $stationchannel157=$findStationchannelType[9];
        }
if (array_key_exists('10', $findStationchannelType)) {
        $stationchannel161=$findStationchannelType[10];
        }
if (array_key_exists('11', $findStationchannelType)) {
        $stationchannel165=$findStationchannelType[11];
        }


print "stationchannel1:" . $stationchannel1 . " stationchannel6:" . $stationchannel6 . " stationchannel11:" . $stationchannel11 . " 

stationcchannel36:" . $stationchannel36 . " stationchannel40:" . $stationchannel40 . " stationchannel44:" . $stationchannel44 . " stationchannel48:" 

. $stationchannel48 . " stationchannel149:" . $stationchannel149 . " stationchannel153:" . $stationchannel153 . " stationchannel157:" . 

$stationchannel157 . " stationchannel161:" . $stationchannel161 . " stationchannel165:" . $stationchannel165;

function reindex($arr) {
        $return_arr = array();

        for ($i=0;($i<sizeof($arr));$i++) {
                $return_arr[$i] = $arr[$i]["value"];
        }

        return $return_arr;
}

?>

Output works fine see example:

Code: Select all

 /usr/bin/php -q /var/www/html/cacti/scripts/Cisco_WLC_Station_Channel.php 192.168.1.9 public 2
stationchannel1:0 stationchannel6:10 stationchannel11:0 stationcchannel36:0 stationchannel40:0 stationchannel44:0 stationchannel48:11 stationchannel149:0 stationchannel153:0 stationchannel157:0 stationchannel161:0 stationchannel165:19


Still working on getting it into Cacti though...

Note: Channels in use are hard coded into script
Attachments
Cisco_WLC_Station_Channel_php.txt
rename to .php
(3.3 KiB) Downloaded 490 times
Cacti1 OS: CentOS 5.6 | 300+ devices
Cacti2 OS: CentOS 5.6 | 300+ devices
King of the Elves
Local Anarchists Union #427
"Anarchism is founded on the observation that since few men are wise enough to rule themselves, even fewer are wise enough to rule others." -Edward Abbey
User avatar
egarnel
Cacti Pro User
Posts: 708
Joined: Thu Nov 21, 2002 8:55 am
Location: Austin, TX

Power Values per controller

Post by egarnel »

here is another script that pulls the ap power levels per controller

Code: Select all

<?php
/* do NOT run this script through a web browser */
if (!isset($_SERVER["argv"][0]) || isset($_SERVER['REQUEST_METHOD'])  || isset($_SERVER['REMOTE_ADDR'])) {
   die("<br><strong>This script is only meant to run at the command line.</strong>");
}

$no_http_headers = true;

if (file_exists(dirname(__FILE__) . "/../include/global.php")) {
        include(dirname(__FILE__) . "/../include/global.php");
}
include(dirname(__FILE__) . "/../include/config.php");
include(dirname(__FILE__) . "/../lib/snmp.php");

$hostname = $_SERVER["argv"][1];
$snmp_community = $_SERVER["argv"][2];

if(isset($_SERVER["argv"][3]))
$snmp_version = $_SERVER["argv"][3];
else
$snmp_version = "2" ;

function snmp_walk($hostname, $snmp_community, $oid, $snmp_version, $cacti_version) {

        if ($cacti_version) {
                $value = cacti_snmp_walk($hostname, $snmp_community, $oid, $snmp_version, "", "", "", "", "", "", 161, 1000, 1);
        } else {
               $value = cacti_snmp_walk($hostname, $snmp_community, $oid, $snmp_version, "", "", 161, 1000);
        }
        //print_r($value);
        return $value;
}

$bsnAPIfPhyTxPowerLevel = ".1.3.6.1.4.1.14179.2.2.2.1.6";

$appower = reindex(snmp_walk($hostname, $snmp_community, $bsnAPIfPhyTxPowerLevel, $snmp_version, $config["cacti_version"]));

$sorted = array_count_values($appower);

if (is_array($sorted) && count($sorted) > 0) {
  $indexmax = 4;
  for ($i=1;$i<=$indexmax;$i++) {
    if(!isset($sorted[$i]))
      $sorted[$i] = 0;
  }

  $newfinalarray = array("1db_:"=>$sorted[7],"2db_:"=>$sorted[6],"5db_:"=>$sorted[5],"8db_:"=>$sorted[4],"11db_:"=>$sorted[3],"14db_:"=>$sorted[2],"17db_:"=>$sorted[1]);
  print " 1db_:" . $sorted[7] . " 2db_:" . $sorted[6] . " 5db_:" . $sorted[5] . " 8db_:" . $sorted[4] . " 11db_:" . $sorted[3] . " 14db_:" . $sorted[2] . " 17db_:" . $sorted[1] ."\n";
} else {
  print "1db_:0 2db_:0 5db_:0 8db_:0 11db_:0 14db_:0 17db_:0";
}

function reindex($arr) {
   $return_arr = array();

   for ($i=0;($i<sizeof($arr));$i++) {
      $return_arr[$i] = $arr[$i]["value"];
   }

   return $return_arr;
}
?>
And the resulting output:

Code: Select all

 /usr/bin/php -q /var/www/html/cacti/scripts/query_ciscoWLC_power.php 192.168.1.9 public 2

 1db_:5 2db_:10 5db_:5 8db_:12 11db_:10 14db_:9 17db_:24

Again, I am still working on getting this into Cacti
Cacti1 OS: CentOS 5.6 | 300+ devices
Cacti2 OS: CentOS 5.6 | 300+ devices
King of the Elves
Local Anarchists Union #427
"Anarchism is founded on the observation that since few men are wise enough to rule themselves, even fewer are wise enough to rule others." -Edward Abbey
User avatar
egarnel
Cacti Pro User
Posts: 708
Joined: Thu Nov 21, 2002 8:55 am
Location: Austin, TX

Post by egarnel »

bump
Cacti1 OS: CentOS 5.6 | 300+ devices
Cacti2 OS: CentOS 5.6 | 300+ devices
King of the Elves
Local Anarchists Union #427
"Anarchism is founded on the observation that since few men are wise enough to rule themselves, even fewer are wise enough to rule others." -Edward Abbey
Shmegles
Cacti User
Posts: 64
Joined: Fri Oct 05, 2007 4:14 pm
Location: Seattle, WA, USA

Post by Shmegles »

I took the various WLC graphs and associated scripts and put 'em all into a single tarball and also made a host template (http://docs.cacti.net/usertemplate:host:cisco4400). Credit is due to the people who actually wrote the scripts and created graph and data templates.
gkservice
Posts: 2
Joined: Fri Feb 20, 2009 10:30 am

Post by gkservice »

I tried to get this working with a WLC2106 but the output is only

Code: Select all

output: stationdot11a:0 stationdot11b:0 stationdot11g:0 stationunknownprotocol:0 stationmobile:0
How can I debug this better?
spoonman
Cacti User
Posts: 305
Joined: Tue May 03, 2005 8:54 am
Location: GA

Post by spoonman »

/usr/local/php/bin/php -q Cisco_WLC_Station_CCX.php 172.17.17.5 ***** 2

Warning: Missing argument 9 for cacti_snmp_walk(), called in /usr/local/apache/htdocs/cacti/scripts/Cisco_WLC_Station_CCX.php on line 23 and defined in /usr/local/apache/htdocs/cacti/lib/snmp.php on line 227

Warning: Missing argument 10 for cacti_snmp_walk(), called in /usr/local/apache/htdocs/cacti/scripts/Cisco_WLC_Station_CCX.php on line 23 and defined in /usr/local/apache/htdocs/cacti/lib/snmp.php on line 227

Notice: Undefined variable: context in /usr/local/apache/htdocs/cacti/lib/snmp.php on line 244
stationccxunsupported:140 stationccxv1:1 stationccxv2:0 stationccxv3:2 stationccxv4:63 stationccxv5:0


I get a wierd error but it seems to return items?? Any ideas?? Have Cacti 8.7e with PA 2.6

Thanks
spoonman
Cacti User
Posts: 305
Joined: Tue May 03, 2005 8:54 am
Location: GA

Post by spoonman »

And my output from cacti log...

12/01/2009 10:30:04 AM - SPINE: Poller[0] Host[107] DS[1368] SCRIPT: /usr/local/php/bin/php -q /usr/local/apache/htdocs/cacti/scripts/Cisco_WLC_Station_Status.php 172.17.17.5 ****** 2, output: U

Thanks.
Aligator
Posts: 7
Joined: Mon Jul 24, 2006 1:37 am
Location: Tasmania, Aust.

Update on "n" clients

Post by Aligator »

I've upgraded to 6.0.188.0 on our WLC (WiSM), enabled 802.11n and I think I can see an enhancement that can be made the next time someone is working on these graphs, as I now have the 802.11n station IDs.

Viz

cacti_graph_template_cisco_wlc_station_protocol - bsnMobileStationProtocol, 1.3.6.1.4.1.14179.2.1.4.1.25
1 : dot11a, 2 : dot11b, 3 : dot11g, 4 : unknown, 5 : mobile

Can become:

cacti_graph_template_cisco_wlc_station_protocol - bsnMobileStationProtocol, 1.3.6.1.4.1.14179.2.1.4.1.25
1 : dot11a, 2 : dot11b, 3 : dot11g, 4 : unknown, 5 : mobile, 6 : dot11n(2.4), 7 : dot11n(5)


Regards.
User avatar
egarnel
Cacti Pro User
Posts: 708
Joined: Thu Nov 21, 2002 8:55 am
Location: Austin, TX

Post by egarnel »

I'll see if I can find some time soon to revise & test
Cacti1 OS: CentOS 5.6 | 300+ devices
Cacti2 OS: CentOS 5.6 | 300+ devices
King of the Elves
Local Anarchists Union #427
"Anarchism is founded on the observation that since few men are wise enough to rule themselves, even fewer are wise enough to rule others." -Edward Abbey
User avatar
egarnel
Cacti Pro User
Posts: 708
Joined: Thu Nov 21, 2002 8:55 am
Location: Austin, TX

Post by egarnel »

1st version:

I have this working fine on my test Cacti box:

created in Cacti 8.7.e on Centos 5.x

import cacti_graph_template_cisco_wlc_client_radio_types.xml

copy query_WLC_ClientProtocol.php to <cacti dir>/scripts
Attachments
wlc_clients.zip
includes template &amp; php
(5.1 KiB) Downloaded 373 times
Cacti1 OS: CentOS 5.6 | 300+ devices
Cacti2 OS: CentOS 5.6 | 300+ devices
King of the Elves
Local Anarchists Union #427
"Anarchism is founded on the observation that since few men are wise enough to rule themselves, even fewer are wise enough to rule others." -Edward Abbey
User avatar
egarnel
Cacti Pro User
Posts: 708
Joined: Thu Nov 21, 2002 8:55 am
Location: Austin, TX

Post by egarnel »

1 minor tweak. Change the color of "unknown" to something else under the graph template
Cacti1 OS: CentOS 5.6 | 300+ devices
Cacti2 OS: CentOS 5.6 | 300+ devices
King of the Elves
Local Anarchists Union #427
"Anarchism is founded on the observation that since few men are wise enough to rule themselves, even fewer are wise enough to rule others." -Edward Abbey
User avatar
egarnel
Cacti Pro User
Posts: 708
Joined: Thu Nov 21, 2002 8:55 am
Location: Austin, TX

Post by egarnel »

WLC AP power level script
graphs the AP power levels on a controller
rev 1.

import the xml, copy the php to cacti-dir/scripts

levels are 1 -8 as returned via snmp
Attachments
AP power level
AP power level
ap-power-level.png (36.93 KiB) Viewed 7634 times
wlc_power.zip
(5.21 KiB) Downloaded 267 times
Cacti1 OS: CentOS 5.6 | 300+ devices
Cacti2 OS: CentOS 5.6 | 300+ devices
King of the Elves
Local Anarchists Union #427
"Anarchism is founded on the observation that since few men are wise enough to rule themselves, even fewer are wise enough to rule others." -Edward Abbey
ElGribbo
Posts: 5
Joined: Tue Apr 03, 2007 9:23 am
Location: Louisville, KY

Post by ElGribbo »

Does anyone happen to have an export of all these graphs working on SNMPv2 on 0.8.6j they can post? It is not possible for me to upgrade my cacti server at this time.

Thanks in advance.
ssletner
Posts: 24
Joined: Thu Oct 14, 2010 10:41 pm

Re: graphing cisco 4400 wireless controllers

Post by ssletner »

I'm having the following problem when running the following:

php -q D:\AppServ\www\cacti\scripts\Cisco_WLC_Station_Status.php 10.34.254.129 public 2

I get the following output:

Warning: Missing argument 9 for cacti_snmp_walk(), called in D:\AppServ\www\cacti\scripts\Cisco_WLC_Station_Status.php on line 23 and defined in D:\AppServ\www\cacti\lib\snmp.php on line 264

Warning: Missing argument 10 for cacti_snmp_walk(), called in D:\AppServ\www\cacti\scripts\Cisco_WLC_Station_Status.php on line 23 and defined in D:\AppServ\www\cacti\lib\snmp.php on line 264

Notice: Undefined variable: context in D:\AppServ\www\cacti\lib\snmp.php on line 292
stationidle:0 stationpending:0 stationauthenticated:0 stationassociated:267 stationpowersave:0 stationdisassociated:0 stationtobedeleted:0 stationprobing:10 stationblacklisted:0

log shows:
CMDPHP: Poller[0] Host[4] Description[xxxxxxxxx] WARNING: Result from CMD not valid. Partial Result: U

Any ideas? It looks like its pulling the information as you can see from the 'stationassociated:267' but because of the errors the graphs wont work.

I see that spoonman had the same issue but I haven't seen a reply on how to fix this.

Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests