diff --git a/LibreNMS/OS/Ciscosat.php b/LibreNMS/OS/Ciscosat.php index 11978d4d9c..5fb86cc2f0 100644 --- a/LibreNMS/OS/Ciscosat.php +++ b/LibreNMS/OS/Ciscosat.php @@ -1,4 +1,5 @@ getDevice(), 'satSignalUncorErrCnt', array(), 'CISCO-DMN-DSG-TUNING-MIB', null, '-Ob'); - $sensors = array(); + $oids = snmpwalk_cache_oid($this->getDevice(), 'satSignalUncorErrCnt', [], 'CISCO-DMN-DSG-TUNING-MIB', null, '-Ob'); + $sensors = []; foreach ($oids as $index => $entry) { $sensors[] = new WirelessSensor( 'errors', @@ -28,8 +29,8 @@ class Ciscosat extends OS implements WirelessErrorsDiscovery, WirelessRssiDiscov public function discoverWirelessRssi() { - $oids = snmpwalk_cache_oid($this->getDevice(), 'satSignalLevel', array(), 'CISCO-DMN-DSG-TUNING-MIB', null, '-Ob'); - $sensors = array(); + $oids = snmpwalk_cache_oid($this->getDevice(), 'satSignalLevel', [], 'CISCO-DMN-DSG-TUNING-MIB', null, '-Ob'); + $sensors = []; foreach ($oids as $index => $entry) { $sensors[] = new WirelessSensor( 'rssi', @@ -37,42 +38,44 @@ class Ciscosat extends OS implements WirelessErrorsDiscovery, WirelessRssiDiscov '.1.3.6.1.4.1.1429.2.2.5.5.3.1.1.7.' . $index, 'ciscosat', $index, - 'Receive Signal Level ' .$index + 'Receive Signal Level ' . $index ); } return $sensors; } -// snr - Discover C/N Link Margin + public function discoverWirelessSnr() { - $cnmargin = snmpwalk_cache_oid($this->getDevice(), 'satSignalCnMargin', array(), 'CISCO-DMN-DSG-TUNING-MIB', null, '-OQUsb'); - $dbindex = 0; + $sensors = []; + + // snr - Discover C/N Link Margin + $cnmargin = snmpwalk_cache_oid($this->getDevice(), 'satSignalCnMargin', [], 'CISCO-DMN-DSG-TUNING-MIB', null, '-OQUsb'); foreach ($cnmargin as $index => $entry) { - $snrstatus[] = new WirelessSensor( + $sensors[] = new WirelessSensor( 'snr', $this->getDeviceId(), '.1.3.6.1.4.1.1429.2.2.5.5.3.1.1.6.' . $index, - 'ciscosat', - ++$dbindex, - 'C/N Link Margin ' .$index, + 'ciscosat-cn-margin', + $index, + 'C/N Link Margin ' . $index, $entry ); } -// snr - Discover C/N Ratio - $cnratio = snmpwalk_cache_oid($this->getDevice(), 'satSignalCndisp', array(), 'CISCO-DMN-DSG-TUNING-MIB', null, '-OQUsb'); + + // snr - Discover C/N Ratio + $cnratio = snmpwalk_cache_oid($this->getDevice(), 'satSignalCndisp', [], 'CISCO-DMN-DSG-TUNING-MIB', null, '-OQUsb'); foreach ($cnratio as $index => $entry) { - array_push($snrstatus, new WirelessSensor( + $sensors[] = new WirelessSensor( 'snr', $this->getDeviceId(), '.1.3.6.1.4.1.1429.2.2.5.5.3.1.1.5.' . $index, - 'ciscosat', - ++$dbindex, - 'C/N Ratio ' .$index, + 'ciscosat-cn-ratio', + $index, + 'C/N Ratio ' . $index, $entry - ) ); } - return $snrstatus; + return $sensors; } } diff --git a/tests/data/ciscosat.json b/tests/data/ciscosat.json index 26bf142192..7536004995 100644 --- a/tests/data/ciscosat.json +++ b/tests/data/ciscosat.json @@ -273,7 +273,7 @@ "sensor_deleted": 0, "sensor_class": "snr", "sensor_index": "1", - "sensor_type": "ciscosat", + "sensor_type": "ciscosat-cn-margin", "sensor_descr": "C/N Link Margin 1", "sensor_divisor": 1, "sensor_multiplier": 1, @@ -293,8 +293,8 @@ { "sensor_deleted": 0, "sensor_class": "snr", - "sensor_index": "2", - "sensor_type": "ciscosat", + "sensor_index": "1", + "sensor_type": "ciscosat-cn-ratio", "sensor_descr": "C/N Ratio 1", "sensor_divisor": 1, "sensor_multiplier": 1, @@ -361,7 +361,7 @@ "sensor_deleted": 0, "sensor_class": "snr", "sensor_index": "1", - "sensor_type": "ciscosat", + "sensor_type": "ciscosat-cn-margin", "sensor_descr": "C/N Link Margin 1", "sensor_divisor": 1, "sensor_multiplier": 1, @@ -381,8 +381,8 @@ { "sensor_deleted": 0, "sensor_class": "snr", - "sensor_index": "2", - "sensor_type": "ciscosat", + "sensor_index": "1", + "sensor_type": "ciscosat-cn-ratio", "sensor_descr": "C/N Ratio 1", "sensor_divisor": 1, "sensor_multiplier": 1,