diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index beacc1b2c5..156e747cb4 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -294,6 +294,7 @@ function print_graph_tag($args) function generate_graph_tag($args) { + foreach ($args as $key => $arg) { $urlargs[] = $key."=".$arg; @@ -538,4 +539,49 @@ function foldersize($path) return array($total_size, $total_files); } +function generate_ap_link($args, $text = NULL, $type = NULL) +{ + global $config; + + $args = ifNameDescr($args); + if (!$text) { $text = fixIfName($args['label']); } + if ($type) { $args['graph_type'] = $type; } + if (!isset($args['graph_type'])) { $args['graph_type'] = 'port_bits'; } + + if (!isset($args['hostname'])) { $args = array_merge($args, device_by_id_cache($args['device_id'])); } + + $content = "
".$args['text']." - " . fixifName($args['label']) . "
"; + if ($args['ifAlias']) { $content .= $args['ifAlias']."
"; } + $content .= "
"; + $graph_array['type'] = $args['graph_type']; + $graph_array['legend'] = "yes"; + $graph_array['height'] = "100"; + $graph_array['width'] = "340"; + $graph_array['to'] = $config['time']['now']; + $graph_array['from'] = $config['time']['day']; + $graph_array['id'] = $args['accesspoint_id']; + $content .= generate_graph_tag($graph_array); + $graph_array['from'] = $config['time']['week']; + $content .= generate_graph_tag($graph_array); + $graph_array['from'] = $config['time']['month']; + $content .= generate_graph_tag($graph_array); + $graph_array['from'] = $config['time']['year']; + $content .= generate_graph_tag($graph_array); + $content .= "
"; + + + $url = generate_ap_url($args); + if (port_permitted($args['interface_id'], $args['device_id'])) { + return overlib_link($url, $text, $content, $class); + } else { + return fixifName($text); + } +} + +function generate_ap_url($ap, $vars=array()) +{ + return generate_url(array('page' => 'device', 'device' => $ap['device_id'], 'tab' => 'accesspoint', 'ap' => $ap['accesspoint_id']), $vars); +} + + ?> diff --git a/html/includes/graphs/accesspoints/auth.inc.php b/html/includes/graphs/accesspoints/auth.inc.php new file mode 100644 index 0000000000..33c38f094b --- /dev/null +++ b/html/includes/graphs/accesspoints/auth.inc.php @@ -0,0 +1,17 @@ + diff --git a/html/includes/graphs/accesspoints/channel.inc.php b/html/includes/graphs/accesspoints/channel.inc.php new file mode 100644 index 0000000000..e05d580d28 --- /dev/null +++ b/html/includes/graphs/accesspoints/channel.inc.php @@ -0,0 +1,24 @@ + diff --git a/html/includes/graphs/accesspoints/interference.inc.php b/html/includes/graphs/accesspoints/interference.inc.php new file mode 100644 index 0000000000..b3a0b86156 --- /dev/null +++ b/html/includes/graphs/accesspoints/interference.inc.php @@ -0,0 +1,27 @@ + diff --git a/html/includes/graphs/accesspoints/numasoclients.inc.php b/html/includes/graphs/accesspoints/numasoclients.inc.php new file mode 100644 index 0000000000..4d85fb1047 --- /dev/null +++ b/html/includes/graphs/accesspoints/numasoclients.inc.php @@ -0,0 +1,28 @@ + diff --git a/html/includes/graphs/accesspoints/nummonbssid.inc.php b/html/includes/graphs/accesspoints/nummonbssid.inc.php new file mode 100644 index 0000000000..223067d6d4 --- /dev/null +++ b/html/includes/graphs/accesspoints/nummonbssid.inc.php @@ -0,0 +1,29 @@ + diff --git a/html/includes/graphs/accesspoints/nummonclients.inc.php b/html/includes/graphs/accesspoints/nummonclients.inc.php new file mode 100644 index 0000000000..010ffd079e --- /dev/null +++ b/html/includes/graphs/accesspoints/nummonclients.inc.php @@ -0,0 +1,28 @@ + diff --git a/html/includes/graphs/accesspoints/radioutil.inc.php b/html/includes/graphs/accesspoints/radioutil.inc.php new file mode 100644 index 0000000000..27d2c82505 --- /dev/null +++ b/html/includes/graphs/accesspoints/radioutil.inc.php @@ -0,0 +1,30 @@ + diff --git a/html/includes/graphs/accesspoints/txpow.inc.php b/html/includes/graphs/accesspoints/txpow.inc.php new file mode 100644 index 0000000000..cc0c60eec9 --- /dev/null +++ b/html/includes/graphs/accesspoints/txpow.inc.php @@ -0,0 +1,31 @@ + diff --git a/html/includes/graphs/graph.inc.php b/html/includes/graphs/graph.inc.php index f31dc57d0d..6a3191f07a 100644 --- a/html/includes/graphs/graph.inc.php +++ b/html/includes/graphs/graph.inc.php @@ -65,10 +65,11 @@ if (is_file($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.p { include($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php"); } + } else { - graph_error("Graph Template Missing"); + graph_error("$type*$subtype ");//Graph Template Missing"); } function graph_error($string) @@ -106,6 +107,7 @@ function graph_error($string) } } + if ($error_msg) { /// We have an error :( @@ -141,6 +143,7 @@ if ($error_msg) { unlink($graphfile); echo(""); } else { + if ($rrd_options) { rrdtool_graph($graphfile, $rrd_options); diff --git a/html/includes/print-accesspoint-graphs.inc.php b/html/includes/print-accesspoint-graphs.inc.php new file mode 100644 index 0000000000..f268af6cb8 --- /dev/null +++ b/html/includes/print-accesspoint-graphs.inc.php @@ -0,0 +1,13 @@ + diff --git a/html/includes/print-accesspoint.inc.php b/html/includes/print-accesspoint.inc.php new file mode 100644 index 0000000000..e41e6dd690 --- /dev/null +++ b/html/includes/print-accesspoint.inc.php @@ -0,0 +1,92 @@ + + "); +echo(" " . generate_ap_link($ap, " $text
")); +echo(""); +echo("$break".$ap['mac_addr']."
".$ap['type']. " - channel ".$ap['channel']); +echo("
txpow $ap[txpow]"); +echo("
"); +echo(""); + + +echo(""); +$ap['graph_type'] = "accesspoints_numasoclients"; +echo(generate_ap_link($ap, "")); +echo("
\n"); +$ap['graph_type'] = "accesspoints_radioutil"; +echo(generate_ap_link($ap, "")); +echo("
\n"); +$ap['graph_type'] = "accesspoints_interference"; +echo(generate_ap_link($ap, "")); +echo("
\n"); + +echo(""); + +echo(" ".format_bi($ap[numasoclients])." Clients
"); +echo(" ".format_bi($ap[radioutil])." % busy
"); +echo(" ".format_bi($ap[interference])." interference index
"); + +echo(""); + + + +if ($vars['tab'] == "accesspoint") { + + + $graph_type='accesspoints_numasoclients'; + echo(""); + echo("
Associated Clients
"); + include("includes/print-accesspoint-graphs.inc.php"); + echo(""); + + $graph_type='accesspoints_interference'; + echo(""); + echo("
Interference
"); + include("includes/print-accesspoint-graphs.inc.php"); + echo(""); + + $graph_type='accesspoints_channel'; + echo(""); + echo("
Channel
"); + include("includes/print-accesspoint-graphs.inc.php"); + echo(""); + + $graph_type='accesspoints_txpow'; + echo(""); + echo("
Transmit Power
"); + include("includes/print-accesspoint-graphs.inc.php"); + echo(""); + + $graph_type='accesspoints_radioutil'; + echo(""); + echo("
Radio Utilization
"); + include("includes/print-accesspoint-graphs.inc.php"); + echo(""); + + $graph_type='accesspoints_nummonclients'; + echo(""); + echo("
Monitored Clients
"); + include("includes/print-accesspoint-graphs.inc.php"); + echo(""); + + $graph_type='accesspoints_nummonbssid'; + echo(""); + echo("
Number of monitored BSSIDs
"); + include("includes/print-accesspoint-graphs.inc.php"); + echo(""); + + } + +?> diff --git a/html/pages/device.inc.php b/html/pages/device.inc.php index b2f00fcf23..f293c2d851 100644 --- a/html/pages/device.inc.php +++ b/html/pages/device.inc.php @@ -6,6 +6,7 @@ if ($vars['tab'] == "port" && is_numeric($vars['device']) && port_permitted($var $permit_ports = 1; } + if (device_permitted($vars['device']) || $check_device == $vars['device']) { $selected['iface'] = "selected"; @@ -118,6 +119,15 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) '); } + if (@dbFetchCell("SELECT COUNT(accesspoint_id) FROM accesspoint WHERE device_id = '" . $device['device_id'] . "'") > '0') + { + echo('
  • + + Access Points + +
  • '); + } + if (isset($config['smokeping']['dir'])) { $smokeping_files = array(); diff --git a/html/pages/device/graphs/wireless.inc.php b/html/pages/device/graphs/wireless.inc.php index 077022e3d1..98afa48d72 100644 --- a/html/pages/device/graphs/wireless.inc.php +++ b/html/pages/device/graphs/wireless.inc.php @@ -8,4 +8,4 @@ if (is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/wificlients-radio1 include("includes/print-device-graph.php"); } -?> \ No newline at end of file +?> diff --git a/includes/common.php b/includes/common.php index f830bff3c9..1a2dd7d07f 100644 --- a/includes/common.php +++ b/includes/common.php @@ -279,6 +279,16 @@ function device_by_name($name, $refresh = 0) return device_by_id_cache(getidbyname($name), $refresh); } + +function accesspoint_by_id($ap_id, $refresh = '0') { + + $ap = dbFetchRow("SELECT * FROM `accesspoint` WHERE `accesspoint_id` = ?", array($ap_id)); + + return $ap; + +} + + function device_by_id_cache($device_id, $refresh = '0') { global $cache; diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 5de4f12930..2cb98b42ca 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -65,6 +65,20 @@ $config['memcached']['port'] = 11211; $config['slow_statistics'] = TRUE; ### THIS WILL CHANGE TO FALSE IN FUTURE + + + +### RRD Format Settings +### These should not normally be changed +### Though one could conceivably increase or decrease the size of each RRA if one had performance problems +### Or if one had a very fast I/O subsystem with no performance worries. + +$config['rrd_rra'] = " RRA:AVERAGE:0.5:1:2016 RRA:AVERAGE:0.5:6:1440 RRA:AVERAGE:0.5:24:1440 RRA:AVERAGE:0.5:288:1440 "; +$config['rrd_rra'] .= " RRA:MAX:0.5:1:720 RRA:MIN:0.5:6:1440 RRA:MIN:0.5:24:775 RRA:MIN:0.5:288:797 "; +$config['rrd_rra'] .= " RRA:MAX:0.5:1:720 RRA:MAX:0.5:6:1440 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797 "; +$config['rrd_rra'] .= " RRA:LAST:0.5:1:1440 "; + + ### RRDCacheD - Make sure it can write to your RRD dir! #$config['rrdcached'] = "unix:/var/run/rrdcached.sock"; diff --git a/includes/definitions.inc.php b/includes/definitions.inc.php index fe7d883a6f..fe890b18f9 100644 --- a/includes/definitions.inc.php +++ b/includes/definitions.inc.php @@ -896,6 +896,10 @@ $os = "arubaos"; $config['os'][$os]['text'] = "ArubaOS"; $config['os'][$os]['type'] = "wireless"; $config['os'][$os]['icon'] = "arubaos"; +$config['os'][$os]['over'][0]['graph'] = "device_arubacontroller_numaps"; +$config['os'][$os]['over'][0]['text'] = "Number of APs"; +$config['os'][$os]['over'][1]['graph'] = "device_arubacontroller_numclients"; +$config['os'][$os]['over'][1]['text'] = "Number of Clients"; $os = "dsm"; $config['os'][$os]['text'] = "Synology DSM"; diff --git a/includes/polling/aruba-controller.inc.php b/includes/polling/aruba-controller.inc.php new file mode 100644 index 0000000000..8de8ccb72d --- /dev/null +++ b/includes/polling/aruba-controller.inc.php @@ -0,0 +1,146 @@ + $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 $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;$z1), 'accesspoint', '`accesspoint_id` = ?', Array($ap_db[$z]['accesspoint_id'])); + } + + + } + +} + + +?> diff --git a/includes/polling/os/arubaos.inc.php b/includes/polling/os/arubaos.inc.php index 692b560c4a..6e0e54941b 100644 --- a/includes/polling/os/arubaos.inc.php +++ b/includes/polling/os/arubaos.inc.php @@ -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']; +} + ?> diff --git a/includes/snmp.inc.php b/includes/snmp.inc.php index fd1aac692f..8434e5e39d 100644 --- a/includes/snmp.inc.php +++ b/includes/snmp.inc.php @@ -121,6 +121,9 @@ function snmp_get($device, $oid, $options = NULL, $mib = NULL, $mibdir = NULL) else { return false; } } + + + function snmp_walk($device, $oid, $options = NULL, $mib = NULL, $mibdir = NULL) { global $debug,$config,$runtime_stats; @@ -331,6 +334,29 @@ function snmpwalk_cache_oid($device, $oid, $array, $mib = NULL, $mibdir = NULL) return $array; } +// just like snmpwalk_cache_oid except that it returns the numerical oid as the index +// this is useful when the oid is indexed by the mac address and snmpwalk would +// return periods (.) for non-printable numbers, thus making many different indexes appear +// to be the same. +function snmpwalk_cache_oid_num($device, $oid, $array, $mib = NULL, $mibdir = NULL) +{ + $data = snmp_walk($device, $oid, "-OQUn", $mib, $mibdir); + + foreach (explode("\n", $data) as $entry) + { + list($oid,$value) = explode("=", $entry); + $oid = trim($oid); $value = trim($value); + list($oid, $index) = explode(".", $oid, 2); + if (!strstr($value, "at this OID") && isset($oid) && isset($index)) + { + $array[$index][$oid] = $value; + } + } + + return $array; +} + + function snmpwalk_cache_multi_oid($device, $oid, $array, $mib = NULL, $mibdir = NULL) { global $cache; diff --git a/sql-schema/026.sql b/sql-schema/026.sql new file mode 100644 index 0000000000..39be485f64 --- /dev/null +++ b/sql-schema/026.sql @@ -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