2016-05-24 20:42:33 +01:00
|
|
|
<?php
|
2020-07-23 09:57:22 -05:00
|
|
|
|
2017-02-23 22:45:50 +00:00
|
|
|
use LibreNMS\RRD\RrdDefinition;
|
|
|
|
|
2016-05-25 19:56:10 +01:00
|
|
|
$associations=array();
|
|
|
|
|
2016-05-26 20:42:08 +01:00
|
|
|
// if this config flag is true, don't poll for stations
|
|
|
|
// this in case of large APs which may have many stations
|
|
|
|
// to prevent causing long polling times
|
2019-06-23 00:29:12 -05:00
|
|
|
if (\LibreNMS\Config::get('xirrus_disable_stations') != true) {
|
2016-05-26 20:42:08 +01:00
|
|
|
// station associations
|
|
|
|
// custom RRDs and graph as each AP may have 16 radios
|
|
|
|
$assoc = snmpwalk_cache_oid($device, 'XIRRUS-MIB::stationAssociationIAP', array(), 'XIRRUS-MIB');
|
2016-08-28 12:32:58 -05:00
|
|
|
foreach ($assoc as $s) {
|
2016-05-26 20:42:08 +01:00
|
|
|
$radio = array_pop($s);
|
2017-11-02 16:07:58 -05:00
|
|
|
$associations[$radio] = (int)$associations[$radio] + 1;
|
2016-05-25 19:56:10 +01:00
|
|
|
}
|
2016-08-28 12:32:58 -05:00
|
|
|
unset($radio);
|
|
|
|
unset($assoc);
|
2016-05-26 20:42:08 +01:00
|
|
|
// write to rrds
|
2016-08-28 12:32:58 -05:00
|
|
|
foreach ($associations as $radio => $count) {
|
2016-07-07 01:33:43 -05:00
|
|
|
$measurement = 'xirrus_users';
|
|
|
|
$rrd_name = array($measurement, $radio);
|
2017-02-23 22:45:50 +00:00
|
|
|
$rrd_def = RrdDefinition::make()->addDataset('stations', 'GAUGE', 0, 3200);
|
2016-07-07 01:33:43 -05:00
|
|
|
$fields = array(
|
|
|
|
'stations' => $count
|
|
|
|
);
|
|
|
|
$tags = compact('radio', 'rrd_name', 'rrd_def');
|
|
|
|
data_update($device, $measurement, $tags, $fields);
|
2016-05-26 20:42:08 +01:00
|
|
|
}
|
2020-07-23 09:57:22 -05:00
|
|
|
$os->enableGraph('xirrus_stations');
|
2016-05-25 19:56:10 +01:00
|
|
|
}
|
|
|
|
|
2016-07-07 01:33:43 -05:00
|
|
|
// cleanup
|
2017-11-02 16:07:58 -05:00
|
|
|
unset($rrd_def, $associations, $tags, $fields, $measurement);
|