3737use LibreNMS \Interfaces \Discovery \Sensors \WirelessRateDiscovery ;
3838use LibreNMS \Interfaces \Discovery \Sensors \WirelessXpiDiscovery ;
3939use LibreNMS \OS ;
40+ use SnmpQuery ;
4041
4142class Ceraos extends OS implements OSDiscovery, WirelessXpiDiscovery, WirelessFrequencyDiscovery, WirelessErrorsDiscovery, WirelessMseDiscovery, WirelessPowerDiscovery, WirelessRateDiscovery
4243{
@@ -57,9 +58,10 @@ public function discoverOS(Device $device): void
5758 $ device ->location ->save ();
5859 }
5960
61+ $ ifDescr = SnmpQuery::walk ('IF-MIB::ifDescr ' )->valuesByIndex ();
6062 $ num_radios = 0 ;
61- foreach (snmpwalk_group ( $ this -> getDeviceArray (), ' ifDescr ' , ' IF-MIB ' ) as $ interface ) {
62- if ($ interface [ ' ifDescr ' ] == 'Radio ' ) {
63+ foreach ($ ifDescr as $ cols ) {
64+ if (( $ cols [ ' IF-MIB:: ifDescr ' ] ?? null ) = == 'Radio ' ) {
6365 $ num_radios ++;
6466 }
6567 }
@@ -74,7 +76,7 @@ public function discoverWirelessXpi()
7476 $ sensors = [];
7577 $ divisor = 100 ;
7678
77- $ xpi = snmpwalk_group ( $ this -> getDeviceArray (), ' genEquipRadioStatusXPI ' , ' MWRM-RADIO-MIB ' );
79+ $ xpi = SnmpQuery:: walk ( ' MWRM-RADIO-MIB::genEquipRadioStatusXPI ' )-> valuesByIndex ( );
7880 foreach ($ xpi as $ index => $ data ) {
7981 $ sensors [] = new WirelessSensor (
8082 'xpi ' ,
@@ -83,7 +85,7 @@ public function discoverWirelessXpi()
8385 'ceraos ' ,
8486 $ index ,
8587 $ ifNames [$ index ],
86- $ data ['genEquipRadioStatusXPI ' ] / $ divisor ,
88+ $ data ['MWRM-RADIO-MIB:: genEquipRadioStatusXPI ' ] / $ divisor ,
8789 1 ,
8890 $ divisor
8991 );
@@ -96,7 +98,7 @@ public function discoverWirelessFrequency()
9698 {
9799 $ sensors = [];
98100 // MWRM-RADIO-MIB::genEquipRfuCfgTxFreq
99- $ tx = snmpwalk_group ( $ this -> getDeviceArray (), ' genEquipRfuCfgTxFreq ' , ' MWRM-RADIO-MIB ' );
101+ $ tx = SnmpQuery:: walk ( ' MWRM-RADIO-MIB::genEquipRfuCfgTxFreq ' )-> valuesByIndex ( );
100102 $ TxRadio = 0 ;
101103 foreach ($ tx as $ index => $ data ) {
102104 $ TxRadio ++;
@@ -113,7 +115,7 @@ public function discoverWirelessFrequency()
113115 );
114116 }
115117 // MWRM-RADIO-MIB::genEquipRfuCfgRxFreq
116- $ rx = snmpwalk_group ( $ this -> getDeviceArray (), ' genEquipRfuCfgRxFreq ' , ' MWRM-RADIO-MIB ' );
118+ $ rx = SnmpQuery:: walk ( ' MWRM-RADIO-MIB::genEquipRfuCfgRxFreq ' )-> valuesByIndex ( );
117119 $ RxRadio = 0 ;
118120 foreach ($ rx as $ index => $ data ) {
119121 $ RxRadio ++;
@@ -145,7 +147,7 @@ public function discoverWirelessRate()
145147
146148 $ sensors = [];
147149
148- $ tx = snmpwalk_group ( $ this -> getDeviceArray (), ' genEquipRadioMRMCCurrTxBitrate ' , ' MWRM-RADIO-MIB ' );
150+ $ tx = SnmpQuery:: walk ( ' MWRM-RADIO-MIB::genEquipRadioMRMCCurrTxBitrate ' )-> valuesByIndex ( );
149151 foreach ($ tx as $ index => $ data ) {
150152 $ sensors [] = new WirelessSensor (
151153 'rate ' ,
@@ -154,12 +156,12 @@ public function discoverWirelessRate()
154156 'ceraos-tx ' ,
155157 $ index ,
156158 $ ifNames [$ index ] . ' TX Bitrate ' ,
157- $ data ['genEquipRadioMRMCCurrTxBitrate ' ],
159+ $ data ['MWRM-RADIO-MIB:: genEquipRadioMRMCCurrTxBitrate ' ],
158160 1000
159161 );
160162 }
161163
162- $ rx = snmpwalk_group ( $ this -> getDeviceArray (), ' genEquipRadioMRMCCurrRxBitrate ' , ' MWRM-RADIO-MIB ' );
164+ $ rx = SnmpQuery:: walk ( ' MWRM-RADIO-MIB::genEquipRadioMRMCCurrRxBitrate ' )-> valuesByIndex ( );
163165 foreach ($ rx as $ index => $ data ) {
164166 $ sensors [] = new WirelessSensor (
165167 'rate ' ,
@@ -168,7 +170,7 @@ public function discoverWirelessRate()
168170 'ceraos-rx ' ,
169171 $ index ,
170172 $ ifNames [$ index ] . ' RX Bitrate ' ,
171- $ data ['genEquipRadioMRMCCurrRxBitrate ' ],
173+ $ data ['MWRM-RADIO-MIB:: genEquipRadioMRMCCurrRxBitrate ' ],
172174 1000
173175 );
174176 }
@@ -188,7 +190,7 @@ public function discoverWirelessErrors()
188190
189191 $ sensors = [];
190192
191- $ mse = snmpwalk_group ( $ this -> getDeviceArray (), ' genEquipRadioStatusDefectedBlocks ' , ' MWRM-RADIO-MIB ' );
193+ $ mse = SnmpQuery:: walk ( ' MWRM-RADIO-MIB::genEquipRadioStatusDefectedBlocks ' )-> valuesByIndex ( );
192194 foreach ($ mse as $ index => $ data ) {
193195 $ sensors [] = new WirelessSensor (
194196 'errors ' ,
@@ -197,7 +199,7 @@ public function discoverWirelessErrors()
197199 'ceraos ' ,
198200 $ index ,
199201 $ ifNames [$ index ] . ' Defected Blocks ' ,
200- $ data ['genEquipRadioStatusDefectedBlocks ' ]
202+ $ data ['MWRM-RADIO-MIB:: genEquipRadioStatusDefectedBlocks ' ]
201203 );
202204 }
203205
@@ -217,7 +219,7 @@ public function discoverWirelessMse()
217219 $ sensors = [];
218220 $ divisor = 100 ;
219221
220- $ mse = snmpwalk_group ( $ this -> getDeviceArray (), ' genEquipRadioStatusMSE ' , ' MWRM-RADIO-MIB ' );
222+ $ mse = SnmpQuery:: walk ( ' MWRM-RADIO-MIB::genEquipRadioStatusMSE ' )-> valuesByIndex ( );
221223 foreach ($ mse as $ index => $ data ) {
222224 $ sensors [] = new WirelessSensor (
223225 'mse ' ,
@@ -226,7 +228,7 @@ public function discoverWirelessMse()
226228 'ceraos ' ,
227229 $ index ,
228230 $ ifNames [$ index ],
229- $ data ['genEquipRadioStatusMSE ' ] / $ divisor ,
231+ $ data ['MWRM-RADIO-MIB:: genEquipRadioStatusMSE ' ] / $ divisor ,
230232 1 ,
231233 $ divisor
232234 );
@@ -247,29 +249,42 @@ public function discoverWirelessPower()
247249
248250 $ sensors = [];
249251
250- $ tx = snmpwalk_group ( $ this -> getDeviceArray (), ' genEquipRfuStatusTxLevel ' , ' MWRM-RADIO-MIB ' );
252+ $ tx = SnmpQuery:: walk ( ' MWRM-RADIO-MIB::genEquipRfuStatusTxLevel ' )-> valuesByIndex ( );
251253 foreach ($ tx as $ index => $ data ) {
252254 $ sensors [] = new WirelessSensor (
253255 'power ' ,
254256 $ this ->getDeviceId (),
255257 '.1.3.6.1.4.1.2281.10.5.1.1.3. ' . $ index ,
256258 'ceraos-tx ' ,
257259 $ index ,
258- $ ifNames [$ index ] . ' TX Level ' ,
259- $ data ['genEquipRfuStatusTxLevel ' ]
260+ $ ifNames [$ index ] . ' TX ' ,
261+ $ data ['MWRM-RADIO-MIB:: genEquipRfuStatusTxLevel ' ]
260262 );
261263 }
262264
263- $ rx = snmpwalk_group ( $ this -> getDeviceArray (), ' genEquipRfuStatusRxLevel ' , ' MWRM-RADIO-MIB ' );
264- foreach ($ rx as $ index => $ data ) {
265+ $ main_rx = SnmpQuery:: walk ( ' MWRM-RADIO-MIB::genEquipRfuStatusRxLevel ' )-> valuesByIndex ( );
266+ foreach ($ main_rx as $ index => $ data ) {
265267 $ sensors [] = new WirelessSensor (
266268 'power ' ,
267269 $ this ->getDeviceId (),
268270 '.1.3.6.1.4.1.2281.10.5.1.1.2. ' . $ index ,
269- 'ceraos-rx ' ,
271+ 'ceraos-main-rx ' ,
272+ $ index ,
273+ $ ifNames [$ index ] . ' RX Main ' ,
274+ $ data ['MWRM-RADIO-MIB::genEquipRfuStatusRxLevel ' ]
275+ );
276+ }
277+
278+ $ div_rx = SnmpQuery::walk ('MWRM-RADIO-MIB::genEquipRfuStatusRxLevelDiversity ' )->valuesByIndex ();
279+ foreach ($ div_rx as $ index => $ data ) {
280+ $ sensors [] = new WirelessSensor (
281+ 'power ' ,
282+ $ this ->getDeviceId (),
283+ '.1.3.6.1.4.1.2281.10.5.1.1.10. ' . $ index ,
284+ 'ceraos-diversity-rx ' ,
270285 $ index ,
271- $ ifNames [$ index ] . ' RX Level ' ,
272- $ data ['genEquipRfuStatusRxLevel ' ]
286+ $ ifNames [$ index ] . ' RX Diversity ' ,
287+ $ data ['MWRM-RADIO-MIB::genEquipRfuStatusRxLevelDiversity ' ]
273288 );
274289 }
275290
0 commit comments