1<?php
2
3/**
4 * Observium
5 *
6 *   This file is part of Observium.
7 *
8 * @package    observium
9 * @subpackage poller
10 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
11 *
12 */
13
14//  Polling of AP and radios status for Juniper Wireless (ex Trapeze)
15
16// getting APs and radios
17
18$radios_snmp = snmpwalk_cache_twopart_oid($device, 'trpzApStatRadioOpStatisticsTable', $radios_snmp, 'TRAPEZE-NETWORKS-AP-STATUS-MIB');
19if (OBS_DEBUG > 1 && count($radios_snmp)) { print_vars($radios_snmp); }
20
21// OIDs to graph
22$oids_counter = array(
23  'TxUniPkt',
24  'TxUniOctet',
25  'TxMultiPkt',
26  'TxMultiOctet',
27  'RxPkt',
28  'RxOctet',
29  'UndcrptPkt',
30  'UndcrptOctet',
31  'PhyErr',
32  'ResetCount',
33  'AutoTuneChannelChangeCount',
34  'TxRetriesCount',
35  'ClientAssociations',
36  'ClientFailedAssociations',
37  'ClientReAssociations',
38  'SignalingPkt',
39  'ReTransmitOctet',
40  'RefusedConnectionCount',
41  'RxDataPkt',
42  'RxAuthPkt',
43  'RxAssocPkt',
44  'TxDataPkt',
45  'TxAuthRespPkt',
46  'TxAssocRespPkt');
47
48$oids_gauge = array(
49  'UserSessions',
50  'NoiseFloor');
51
52// Goes through the SNMP radio data
53foreach ($radios_snmp as $ap_serial => $ap_radios)
54{
55  foreach ($ap_radios as $radio_number => $radio)
56  {
57    $rrdupdate = 'N';
58    $rrd_create = '';
59    if ($radio_number == 'radio-1')      { $radio_number = 1; } // FIXME just get number from radio-X ?
60    else if ($radio_number == 'radio-2') { $radio_number = 2; }
61    $rrd_file = 'wifi-radio-'. $ap_serial . '-' . $radio_number.'.rrd';
62
63    foreach ($oids_gauge as $oid)
64    {
65      $oid_ds = truncate($oid, 19, '');
66      $rrd_create .= " DS:$oid_ds:GAUGE:600:U:125000000000";
67
68      if (is_numeric($radio['trpzApStatRadioOpStats'.$oid]))
69      {
70        $value = $radio['trpzApStatRadioOpStats'.$oid];
71      } else {
72        $value = '0';
73      }
74      $rrdupdate .= ":$value";
75    }
76    foreach ($oids_counter as $oid)
77    {
78      $oid_ds = truncate($oid, 19, '');
79      $rrd_create .= " DS:$oid_ds:COUNTER:600:0:125000000000";
80
81      if (is_numeric($radio['trpzApStatRadioOpStats'.$oid]))
82      {
83        $value = $radio['trpzApStatRadioOpStats'.$oid];
84      } else {
85        $value = '0';
86      }
87      $rrdupdate .= ":$value";
88    }
89    rrdtool_create($device, $rrd_file, $rrd_create);
90    rrdtool_update($device, $rrd_file, $rrdupdate);
91  }
92}
93
94unset($oids, $oid, $radio);
95
96// EOF
97