Index: sql-schema/026.sql
===================================================================
--- sql-schema/026.sql	(revision 0)
+++ sql-schema/026.sql	(revision 0)
@@ -0,0 +1 @@
+CREATE TABLE IF NOT EXISTS `access_points` (  `accesspoint_id` int(11) NOT NULL AUTO_INCREMENT,  `device_id` int(11) NOT NULL,  `name` varchar(255) NOT NULL,  `radio_number` tinyint(4) DEFAULT NULL,  `type` varchar(16) NOT NULL,  `mac_addr` varchar(24) NOT NULL,  `deleted` tinyint(1) NOT NULL DEFAULT '0',  `channel` tinyint(4) unsigned NOT NULL DEFAULT '0',  `txpow` tinyint(4) NOT NULL DEFAULT '0',  `radioutil` tinyint(4) NOT NULL DEFAULT '0',  `numasoclients` smallint(6) NOT NULL DEFAULT '0',  `nummonclients` smallint(6) NOT NULL DEFAULT '0',  `numactbssid` tinyint(4) NOT NULL DEFAULT '0',  `nummonbssid` tinyint(4) NOT NULL DEFAULT '0',  `interference` tinyint(3) unsigned NOT NULL,  PRIMARY KEY (`accesspoint_id`),  KEY `deleted` (`deleted`),  KEY `name` (`name`,`radio_number`)) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COMMENT='Access Points';
\ No newline at end of file
Index: html/pages/device/graphs/wireless.inc.php
===================================================================
--- html/pages/device/graphs/wireless.inc.php	(revision 2920)
+++ html/pages/device/graphs/wireless.inc.php	(working copy)
@@ -7,4 +7,5 @@
   include("includes/print-device-graph.php");
 }
 
-?>
\ No newline at end of file
+
+?>
Index: html/includes/print-accesspoint-graphs.inc.php
===================================================================
--- html/includes/print-accesspoint-graphs.inc.php	(revision 0)
+++ html/includes/print-accesspoint-graphs.inc.php	(revision 0)
@@ -0,0 +1,13 @@
+<?php
+
+global $config;
+
+$graph_array['height'] = "100";
+$graph_array['width']  = "215";
+$graph_array['to']     = $config['time']['now'];
+$graph_array['id']     = $ap['accesspoint_id'];
+$graph_array['type']   = $graph_type;
+
+include("includes/print-quadgraphs.inc.php");
+
+?>
Index: html/includes/print-accesspoint.inc.php
===================================================================
--- html/includes/print-accesspoint.inc.php	(revision 0)
+++ html/includes/print-accesspoint.inc.php	(revision 0)
@@ -0,0 +1,92 @@
+<?php
+
+if($int_colour)
+{
+  $row_colour = $int_colour;
+} else {
+  if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
+}
+
+
+$text=$ap['name'] ." ".$ap['type'];
+$ap['text']=$text;
+
+echo("<tr style=\"background-color: $row_colour;\" valign=top onmouseover=\"this.style.backgroundColor='$list_highlight';\" onmouseout=\"this.style.backgroundColor='$row_colour';\" onclick=\"location.href='" . generate_ap_url($ap) . "/'\" style='cursor: pointer;'> 
+         <td valign=top width=350>");
+echo("        <span class=list-large> " . generate_ap_link($ap,  " $text </span><br />"));
+echo("<span class=interface-desc>");
+echo("$break".$ap['mac_addr']."<br>".$ap['type']. " - channel ".$ap['channel']);
+echo("<br />txpow $ap[txpow]");
+echo("</span>");
+echo("</td><td width=100>");
+
+
+echo("</td><td width=150>");
+$ap['graph_type'] = "accesspoints_numasoclients";
+echo(generate_ap_link($ap, "<img src='graph.php?type=$ap[graph_type]&amp;id=".$ap['accesspoint_id']."&amp;from=".$config['time']['day']."&amp;to=".$config['time']['now']."&amp;width=100&amp;height=20&amp;legend=no&amp;bg=".str_replace("#","", $row_colour)."'>"));
+echo("<br>\n");
+$ap['graph_type'] = "accesspoints_radioutil";
+echo(generate_ap_link($ap, "<img src='graph.php?type=$ap[graph_type]&amp;id=".$ap['accesspoint_id']."&amp;from=".$config['time']['day']."&amp;to=".$config['time']['now']."&amp;width=100&amp;height=20&amp;legend=no&amp;bg=".str_replace("#","", $row_colour)."'>"));
+echo("<br>\n");
+$ap['graph_type'] = "accesspoints_interference";
+echo(generate_ap_link($ap, "<img src='graph.php?type=$ap[graph_type]&amp;id=".$ap['accesspoint_id']."&amp;from=".$config['time']['day']."&amp;to=".$config['time']['now']."&amp;width=100&amp;height=20&amp;legend=no&amp;bg=".str_replace("#","", $row_colour)."'>"));
+echo("<br>\n");
+
+echo("</td><td width=120>");
+
+echo("<img src='images/icons/wireless.png' style='height:20px; width:20px;' align=absmiddle /> ".format_bi($ap[numasoclients])." Clients<br />");
+echo("<img src='images/icons/wireless.png' style='height:20px; width:20px;' align=absmiddle /> ".format_bi($ap[radioutil])." % busy<br />");
+echo("<img src='images/icons/wireless.png' style='height:20px; width:20px;' align=absmiddle /> ".format_bi($ap[interference])." interference index<br />");
+
+echo("</td></tr>");
+
+
+
+if ($vars['tab'] == "accesspoint") {
+
+
+  $graph_type='accesspoints_numasoclients';
+  echo("<tr style='background-color: $row_colour; padding: 0px;'><td colspan=7>");
+  echo("<div class='graphhead'>Associated Clients</div>");
+  include("includes/print-accesspoint-graphs.inc.php");
+  echo("</td></tr>");
+
+  $graph_type='accesspoints_interference';
+  echo("<tr style='background-color: $row_colour; padding: 0px;'><td colspan=7>");
+  echo("<div class='graphhead'>Interference</div>");
+  include("includes/print-accesspoint-graphs.inc.php");
+  echo("</td></tr>");
+
+  $graph_type='accesspoints_channel';
+  echo("<tr style='background-color: $row_colour; padding: 0px;'><td colspan=7>");
+  echo("<div class='graphhead'>Channel</div>");
+  include("includes/print-accesspoint-graphs.inc.php");
+  echo("</td></tr>");
+
+  $graph_type='accesspoints_txpow';
+  echo("<tr style='background-color: $row_colour; padding: 0px;'><td colspan=7>");
+  echo("<div class='graphhead'>Transmit Power</div>");
+  include("includes/print-accesspoint-graphs.inc.php");
+  echo("</td></tr>");
+
+  $graph_type='accesspoints_radioutil';
+  echo("<tr style='background-color: $row_colour; padding: 0px;'><td colspan=7>");
+  echo("<div class='graphhead'>Radio Utilization</div>");
+  include("includes/print-accesspoint-graphs.inc.php");
+  echo("</td></tr>");
+
+  $graph_type='accesspoints_nummonclients';
+  echo("<tr style='background-color: $row_colour; padding: 0px;'><td colspan=7>");
+  echo("<div class='graphhead'>Monitored Clients</div>");
+  include("includes/print-accesspoint-graphs.inc.php");
+  echo("</td></tr>");
+
+  $graph_type='accesspoints_nummonbssid';
+  echo("<tr style='background-color: $row_colour; padding: 0px;'><td colspan=7>");
+  echo("<div class='graphhead'>Number of monitored BSSIDs</div>");
+  include("includes/print-accesspoint-graphs.inc.php");
+  echo("</td></tr>");
+
+ }
+
+?>
Index: includes/polling/os/arubaos.inc.php
===================================================================
--- includes/polling/os/arubaos.inc.php	(revision 2920)
+++ includes/polling/os/arubaos.inc.php	(working copy)
@@ -4,4 +4,19 @@
 $badchars = array("(", ")", ",");
 list(,,$hardware,,$version,) = str_replace($badchars, "", explode (" ", $poll_device['sysDescr']));
 
+//// Build SNMP Cache Array
+
+//stuff about the controller
+$switch_info_oids = array('wlsxSwitchRole','wlsxSwitchMasterIp');
+echo("Caching Oids: ");
+foreach ($switch_info_oids as $oid) { echo("$oid "); $aruba_info = snmpwalk_cache_oid($device, $oid, $aruba_info, "WLSX-SWITCH-MIB"); }
+
+echo("\n");
+
+if ($aruba_info[0]['wlsxSwitchRole']=='master') {
+	$features="Master Controller";
+} else {
+	$features="Local Controller for ".$aruba_info[0]['wlsxSwitchMasterIp'];
+}	
+
 ?>
Index: includes/polling/aruba-controller.inc.php
===================================================================
--- includes/polling/aruba-controller.inc.php	(revision 0)
+++ includes/polling/aruba-controller.inc.php	(revision 0)
@@ -0,0 +1,146 @@
+<?php
+if ($device['type'] == 'wireless' && $device['os'] == 'arubaos') 
+{
+  global $config;
+
+  echo("Aruba Controller: ");
+  $polled = time();
+
+  //// Build SNMP Cache Array
+	
+  //stuff about the controller
+  $switch_info_oids = array('wlsxSwitchRole','wlsxSwitchMasterIp');
+  $switch_counter_oids = array('wlsxSwitchTotalNumAccessPoints.0','wlsxSwitchTotalNumStationsAssociated.0');
+
+
+  $switch_apinfo_oids = array('wlsxWlanRadioEntry','wlanAPChInterferenceIndex');
+  $switch_apname_oids = array('wlsxWlanRadioEntry.16');
+
+
+
+  $aruba_oids=array_merge($switch_info_oids,$switch_counter_oids);
+  echo("Caching Oids: ");
+  foreach ($aruba_oids as $oid) { echo("$oid "); $aruba_stats = snmpwalk_cache_oid($device, $oid, $aruba_stats, "WLSX-SWITCH-MIB"); }
+  foreach ($switch_apinfo_oids as $oid) { echo("$oid "); $aruba_apstats = snmpwalk_cache_oid_num($device, $oid, $aruba_apstats, "WLSX-WLAN-MIB"); }
+  foreach ($switch_apname_oids as $oid) { echo("$oid "); $aruba_apnames = snmpwalk_cache_oid_num($device, $oid, $aruba_apnames, "WLSX-WLAN-MIB"); }
+
+
+  echo("\n");
+
+  $rrdfile = $host_rrd . "/aruba-controller".safename(".rrd");
+  if (!is_file($rrdfile))
+  {
+    rrdtool_create($rrdfile," --step 300 DS:NUMAPS:GAUGE:600:0:12500000000 DS:NUMCLIENTS:GAUGE:600:0:12500000000 ".$config['rrd_rra']);
+  }
+
+  $cont_rrd_update="$polled:".$aruba_stats[0]['wlsxSwitchTotalNumAccessPoints'].":".$aruba_stats[0]['wlsxSwitchTotalNumStationsAssociated'];
+  $ret = rrdtool_update($rrdfile,$cont_rrd_update);
+
+  // also save the info about how many clients in the same place as the wireless module
+  $wificlientsrrd  = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("wificlients-radio1.rrd");
+
+  if (!is_file($wificlientsrrd))
+  {
+    rrdtool_create($wificlientsrrd,"--step 300 DS:wificlients:GAUGE:600:-273:10000 ".$config['rrd_rra']);
+  }
+
+  rrdtool_update($wificlientsrrd,"N:".$aruba_stats[0]['wlsxSwitchTotalNumStationsAssociated']);
+
+  $graphs['wifi_clients'] = TRUE;
+
+
+  $ap_db = dbFetchRows("SELECT * FROM `accesspoint` WHERE `device_id` = ?", array($device['device_id']));
+
+
+  foreach ($aruba_apnames as $key => $value) {
+    $radioid=str_replace("1.3.6.1.4.1.14823.2.2.1.5.2.1.5.1.16.","",$key);
+    $name=$value[''];
+    $type         =$aruba_apstats["1.3.6.1.4.1.14823.2.2.1.5.2.1.5.1.2.$radioid"][''];
+    $channel      =$aruba_apstats["1.3.6.1.4.1.14823.2.2.1.5.2.1.5.1.3.$radioid"]['']+0;
+    $txpow        =$aruba_apstats["1.3.6.1.4.1.14823.2.2.1.5.2.1.5.1.4.$radioid"]['']+0;
+    $radioutil    =$aruba_apstats["1.3.6.1.4.1.14823.2.2.1.5.2.1.5.1.6.$radioid"]['']+0;
+    $numasoclients=$aruba_apstats["1.3.6.1.4.1.14823.2.2.1.5.2.1.5.1.7.$radioid"]['']+0;
+    $nummonclients=$aruba_apstats["1.3.6.1.4.1.14823.2.2.1.5.2.1.5.1.8.$radioid"]['']+0;
+    $numactbssid  =$aruba_apstats["1.3.6.1.4.1.14823.2.2.1.5.2.1.5.1.9.$radioid"]['']+0;
+    $nummonbssid  =$aruba_apstats["1.3.6.1.4.1.14823.2.2.1.5.2.1.5.1.10.$radioid"]['']+0;
+    $interference =$aruba_apstats["1.3.6.1.4.1.14823.2.2.1.5.3.1.6.1.11.$radioid"]['']+0;
+
+    $radionum=substr($radioid,strlen($radioid)-1,1);
+
+    if ($debug)
+    {
+      echo("* radioid: $radioid\n");
+      echo("  radionum: $radionum\n");
+      echo("  name: $name\n");
+      echo("  type: $type\n");
+      echo("  channel: $channel\n");
+      echo("  txpow: $txpow\n");
+      echo("  radioutil: $radioutil\n");
+      echo("  numasoclients: $numasoclients\n");			
+      echo("  interference: $interference\n");			
+
+    }
+
+    // if there is a numeric channel, assume the rest of the data is valid, I guess		
+    if (is_numeric($channel))
+    {
+      $rrd_file = $config['rrd_dir'] . "/" . $device['hostname'] ."/" .safename("arubaap-$name.$radionum.rrd");
+      if (!is_file($rrd_file))
+      {
+	$dslist="DS:channel:GAUGE:600:0:200 ";
+	$dslist.="DS:txpow:GAUGE:600:0:200 ";
+	$dslist.="DS:radioutil:GAUGE:600:0:100 ";
+	$dslist.="DS:nummonclients:GAUGE:600:0:500 ";
+	$dslist.="DS:nummonbssid:GAUGE:600:0:200 ";
+	$dslist.="DS:numasoclients:GAUGE:600:0:500 ";
+	$dslist.="DS:interference:GAUGE:600:0:2000 ";
+	rrdtool_create($rrd_file, "--step 300 $dslist ".$config['rrd_rra']);
+      }
+
+      rrdtool_update($rrd_file,  "$polled:".$channel.":".$txpow.":".$radioutil.":".$nummonclients.":".$nummonbssid.":".$numasoclients.":".$interference);
+    }
+
+    //generate the mac address
+    $macparts=explode(".",$radioid,-1);
+    $mac="";
+    foreach ($macparts as $part) {
+      $mac.=sprintf("%02x",$part).":";
+    }
+    $mac=rtrim($mac,":");
+
+
+    $foundid=0;
+
+    for ($z=0;$z<sizeof($ap_db);$z++) { 
+      if ($ap_db[$z]['name']==$name && $ap_db[$z]['radio_number']==$radionum) {
+	$foundid=$ap_db[$z]['accesspoint_id'];
+	$ap_db[$z]['seen']=1;
+	continue;
+      }
+    }
+
+
+
+    if ($foundid==0) {
+      $ap_id = dbInsert(array('device_id' => $device['device_id'], 'name' => $name,'radio_number'=>$radionum, 'type'=>$type,'mac_addr'=>$mac,'channel'=>$channel,'txpow'=>$txpow,'radioutil'=>$radioutil,'numasoclients'=>$numasoclients,'nummonclients'=>$nummonclients,'numactbssid'=>$numactbssid,'nummonbssid'=>$nummonbssid,'interference'=>$interference), 'accesspoint');
+    } else {
+      dbUpdate(array('mac_addr' => $mac,'deleted'=>0,'channel'=>$channel,'txpow'=>$txpow,'radioutil'=>$radioutil,'numasoclients'=>$numasoclients,'nummonclients'=>$nummonclients,'numactbssid'=>$numactbssid,'nummonbssid'=>$nummonbssid,'interference'=>$interference), 'accesspoint', '`accesspoint_id` = ?', Array($foundid));
+    }
+
+
+
+  }
+
+  //mark APs which are not on this controller anymore as deleted
+  for ($z=0;$z<sizeof($ap_db);$z++) {
+    if (!isset($ap_db[$z]['seen']) && $ap_db[$z]['deleted']==0) {
+      dbUpdate(array('deleted'=>1), 'accesspoint', '`accesspoint_id` = ?', Array($ap_db[$z]['accesspoint_id']));
+    }
+	  
+
+  }
+
+}
+
+
+?>
