diff --git a/LibreNMS/OS/Ray.php b/LibreNMS/OS/Ray.php new file mode 100644 index 0000000000..7ae41de1f8 --- /dev/null +++ b/LibreNMS/OS/Ray.php @@ -0,0 +1,97 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2017 Tony Murray + * @author Tony Murray + */ + +namespace LibreNMS\OS; + +use LibreNMS\Device\WirelessSensor; +use LibreNMS\Interfaces\Discovery\Sensors\WirelessFrequencyDiscovery; +use LibreNMS\Interfaces\Discovery\Sensors\WirelessPowerDiscovery; +use LibreNMS\Interfaces\Discovery\Sensors\WirelessRssiDiscovery; +use LibreNMS\Interfaces\Discovery\Sensors\WirelessSnrDiscovery; +use LibreNMS\OS; + +class Ray extends OS implements + WirelessFrequencyDiscovery, + WirelessPowerDiscovery, + WirelessRssiDiscovery, + WirelessSnrDiscovery +{ + + /** + * Discover wireless frequency. This is in GHz. Type is frequency. + * Returns an array of LibreNMS\Device\Sensor objects that have been discovered + * + * @return array Sensors + */ + public function discoverWirelessFrequency() + { + $oid = '.1.3.6.1.4.1.33555.1.2.1.4'; // RAY-MIB::txFreq.0 + return array( + new WirelessSensor('frequency', $this->getDeviceId(), $oid, 'racom', 1, 'Frequency', null, 1, 1000), + ); + } + + /** + * Discover wireless tx or rx power. This is in dBm. Type is power. + * Returns an array of LibreNMS\Device\Sensor objects that have been discovered + * + * @return array + */ + public function discoverWirelessPower() + { + $oid = '.1.3.6.1.4.1.33555.1.2.1.12'; // RAY-MIB::rfPowerConfigured.0 + return array( + new WirelessSensor('power', $this->getDeviceId(), $oid, 'racom', 1, 'Tx Power'), + ); + } + + /** + * Discover wireless RSSI (Received Signal Strength Indicator). This is in dBm. Type is rssi. + * Returns an array of LibreNMS\Device\Sensor objects that have been discovered + * + * @return array + */ + public function discoverWirelessRssi() + { + $oid = '.1.3.6.1.4.1.33555.1.3.2.1'; // RAY-MIB::rss.0 + return array( + new WirelessSensor('rssi', $this->getDeviceId(), $oid, 'racom', 1, 'RSSI', null, 1, 10), + ); + } + + /** + * Discover wireless SNR. This is in dB. Type is snr. + * Returns an array of LibreNMS\Device\Sensor objects that have been discovered + * + * @return array Sensors + */ + public function discoverWirelessSnr() + { + $oid = '.1.3.6.1.4.1.33555.1.3.2.2'; // RAY-MIB::snr.0 + return array( + new WirelessSensor('snr', $this->getDeviceId(), $oid, 'racom', 1, 'CINR', null, 1, 10), + ); + } +} diff --git a/html/images/os/ray.png b/html/images/os/ray.png new file mode 100644 index 0000000000..52265e8639 Binary files /dev/null and b/html/images/os/ray.png differ diff --git a/includes/definitions/ray.yaml b/includes/definitions/ray.yaml new file mode 100644 index 0000000000..b587fab022 --- /dev/null +++ b/includes/definitions/ray.yaml @@ -0,0 +1,12 @@ +os: ray +text: 'RAy' +type: wireless +icon: ray +over: + - { graph: device_bits, text: 'Device Traffic' } + - { graph: device_processor, text: 'CPU Usage' } + - { graph: device_mempool, text: 'Memory Usage' } +discovery: + - sysObjectId: .1.3.6.1.4.1.33555.1.1 +mib_dir: + - ray diff --git a/includes/discovery/processors/ray.inc.php b/includes/discovery/processors/ray.inc.php new file mode 100644 index 0000000000..719603bbf4 --- /dev/null +++ b/includes/discovery/processors/ray.inc.php @@ -0,0 +1,23 @@ + + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. Please see LICENSE.txt at the top level of + * the source code distribution for details. + */ + +if ($device['os'] == 'ray') { + echo 'ray : '; + + $oid = '.1.3.6.1.4.1.33555.1.1.5.1'; + $descr = 'Processor'; + $usage = snmp_get($device, $oid, '-Ovqn'); + + if (is_numeric($usage)) { + discover_processor($valid['processor'], $device, $oid, '0', 'ray', $descr, '1', $usage); + } +} diff --git a/includes/discovery/sensors/temperature/ray.inc.php b/includes/discovery/sensors/temperature/ray.inc.php new file mode 100644 index 0000000000..3921e2e915 --- /dev/null +++ b/includes/discovery/sensors/temperature/ray.inc.php @@ -0,0 +1,22 @@ + + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. Please see LICENSE.txt at the top level of + * the source code distribution for details. + */ + +d_echo('RAY'); +$oid = ".1.3.6.1.4.1.33555.1.1.4.2"; +$index = 0; +$sensor_type = ' temperatureRadio'; +$descr = 'Internal Temp'; +$divisor = 100; +$temperature = (snmp_get($device, $oid, '-Oqv', 'RAY-MIB') / $divisor); +if (is_numeric($temperature)) { + discover_sensor($valid['sensor'], 'temperature', $device, $oid, $index, $sensor_type, $descr, $divisor, null, null, null, null, null, $temperature); +} diff --git a/includes/discovery/sensors/voltage/ray.inc.php b/includes/discovery/sensors/voltage/ray.inc.php new file mode 100644 index 0000000000..5c831a9bad --- /dev/null +++ b/includes/discovery/sensors/voltage/ray.inc.php @@ -0,0 +1,23 @@ + + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. Please see LICENSE.txt at the top level of + * the source code distribution for details. + */ + + +d_echo('RAY'); +$oid = ".1.3.6.1.4.1.33555.1.1.4.3"; +$index = 0; +$sensor_type = 'voltageUnit'; +$descr = 'Voltage'; +$divisor = 10; +$voltage = (snmp_get($device, $oid, '-Oqv', 'RAY-MIB') / $divisor); +if (is_numeric($voltage)) { + discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $sensor_type, $descr, $divisor, null, null, null, null, null, $voltage); +} diff --git a/includes/polling/os/ray.inc.php b/includes/polling/os/ray.inc.php new file mode 100644 index 0000000000..e006c9409b --- /dev/null +++ b/includes/polling/os/ray.inc.php @@ -0,0 +1,8 @@ + -3,9)." + ::= { radio 1 } + +snr OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION "Receiving SNR indicator in decimal dB (39 -> 3,9)." + ::= { radio 2 } + +fecBlockCounter OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION "Total block counter for BER calculation. Block size is 2048 bits. Supported by RAy10 only." + ::= { radio 3 } + +fecUncorrectBlockCounter OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION "Incorrect block counter for BER calculation. Block size is 2048 bits. Supported by RAy10 only." + ::= { radio 4 } + +timeAllConnect OBJECT-TYPE + SYNTAX TimeTicks + MAX-ACCESS read-only + STATUS current + DESCRIPTION "Overall link uptime." + ::= { radio 5 } + +timeAllDisconnect OBJECT-TYPE + SYNTAX TimeTicks + MAX-ACCESS read-only + STATUS current + DESCRIPTION "Overall link downtime." + ::= { radio 6 } + +timeMaxDisconnect OBJECT-TYPE + SYNTAX TimeTicks + MAX-ACCESS read-only + STATUS current + DESCRIPTION "The longest drop (disconnecting)." + ::= { radio 7 } + +numDisconnect OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION "Number of drops (disconnecting)." + ::= { radio 8 } + +reliability OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION "Reliability in thousandths of %." + ::= { radio 9 } + +linkUptime OBJECT-TYPE + SYNTAX TimeTicks + MAX-ACCESS read-only + STATUS current + DESCRIPTION "Current radio link uptime. Not supported by RAy10." + ::= { radio 10 } + +ber OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION "Bit Error Rate (BER) multiplied by 10^9. Not supported by RAy10." + ::= { radio 11 } + +-- statistic Ethernet mib + +ethInThroughput OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION "Input Ethernet 1 data port throughput in kbps. Not supported by RAy10." + ::= { ethernet 1 } + +ethOutThroughput OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION "Output Ethernet 1 data port throughput in kbps. Not supported by RAy10." + ::= { ethernet 2 } + +eth2InThroughput OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION "Input Ethernet 2 data port throughput in kbps. Supported by RAy2 only." + ::= { ethernet 3 } + +eth2OutThroughput OBJECT-TYPE + SYNTAX Integer32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION "Output Ethernet 2 data port throughput in kbps. Supported by RAy2 only." + ::= { ethernet 4 } + + +-- definition traps + +airDisconnect NOTIFICATION-TYPE + OBJECTS { lineStatus } + STATUS current + DESCRIPTION + "Air line disconnected. Not supported by RAy2." + ::= { rayTraps 1 } + +airConnect NOTIFICATION-TYPE + OBJECTS { lineStatus } + STATUS current + DESCRIPTION + "Air line connected after being disconnected. Not supported by RAy2." + ::= { rayTraps 2 } + +airWdog NOTIFICATION-TYPE + OBJECTS { lineStatus } + STATUS current + DESCRIPTION + "Air watch dog. Supported by RAy10 only." + ::= { rayTraps 3 } + +tempAlarm NOTIFICATION-TYPE + OBJECTS { temperatureModem } + STATUS current + DESCRIPTION + "Temperature exceeded the threshold. Not supported by RAy2." + ::= { rayTraps 4 } + +powerAlarm NOTIFICATION-TYPE + OBJECTS { voltageUnit } + STATUS current + DESCRIPTION + "Power voltage is out of the thresholds. Not supported by RAy2." + ::= { rayTraps 5 } + +memoryAlarm NOTIFICATION-TYPE + OBJECTS { useMemory } + STATUS current + DESCRIPTION + "Memory use exceeded the threshold. Supported by RAy10 only." + ::= { rayTraps 6 } + +rssAlarm NOTIFICATION-TYPE + OBJECTS { rss } + STATUS current + DESCRIPTION + "RSS exceeded the threshold. Not supported by RAy2." + ::= { rayTraps 7 } + +snrAlarm NOTIFICATION-TYPE + OBJECTS { snr } + STATUS current + DESCRIPTION + "SNR exceeded the threshold. Not supported by RAy2." + ::= { rayTraps 8 } + +berAlarm NOTIFICATION-TYPE + OBJECTS { fecUncorrectBlockCounter, fecBlockCounter } + STATUS current + DESCRIPTION + "BER exceeded the threshold. Not supported by RAy2." + ::= { rayTraps 9 } + +rfPowerFail NOTIFICATION-TYPE + OBJECTS { rfPowerStatus } + STATUS current + DESCRIPTION + "RF Power amplifier failure. Not supported." + ::= { rayTraps 10 } + +peerEthLinkDown NOTIFICATION-TYPE + OBJECTS { ethPeer } + STATUS current + DESCRIPTION + "Peer station Ethernet link Up/Down. Not supported by RAy2." + ::= { rayTraps 11 } + + +-- RAy2 trap definitions + +tr2TemperatureAlarm NOTIFICATION-TYPE + OBJECTS { temperatureModem, + alarmTemperature } + STATUS current + DESCRIPTION + "Temperature exceeded the threshold. Supported by RAy2 only." + ::= { ray2Traps 1 } + +tr2VoltageLowAlarm NOTIFICATION-TYPE + OBJECTS { voltageUnit, + alarmVoltageLow } + STATUS current + DESCRIPTION + "Supply voltage below minimal threshold. Supported by RAy2 only." + ::= { ray2Traps 2 } + +tr2VoltageHighAlarm NOTIFICATION-TYPE + OBJECTS { voltageUnit, + alarmVoltageHigh } + STATUS current + DESCRIPTION + "Supply voltage above maximal threshold. Supported by RAy2 only." + ::= { ray2Traps 3 } + +tr2RssAlarm NOTIFICATION-TYPE + OBJECTS { rss, + alarmRss } + STATUS current + DESCRIPTION + "RSS exceeded the threshold. Supported by RAy2 only." + ::= { ray2Traps 4 } + +tr2SnrAlarm NOTIFICATION-TYPE + OBJECTS { snr, + alarmSnr } + STATUS current + DESCRIPTION + "SNR exceeded the threshold. Supported by RAy2 only." + ::= { ray2Traps 5 } + +tr2BerAlarm NOTIFICATION-TYPE + OBJECTS { ber, + alarmBer } + STATUS current + DESCRIPTION + "BER exceeded the threshold. Supported by RAy2 only." + ::= { ray2Traps 6 } + +tr2AirDisconnect NOTIFICATION-TYPE + OBJECTS { lineStatusII, + alarmPeerDisconnected } + STATUS current + DESCRIPTION + "Air line disconnected. Supported by RAy2 only." + ::= { ray2Traps 7 } + +tr2AirConnect NOTIFICATION-TYPE + OBJECTS { lineStatusII, + alarmPeerDisconnected } + STATUS current + DESCRIPTION + "Air line connected after being disconnected. Supported by RAy2 (up to fw 2.1.7.0) only." + ::= { ray2Traps 8 } + +tr2Eth1LinkDown NOTIFICATION-TYPE + OBJECTS { eth1Link, + alarmEth1Down } + STATUS current + DESCRIPTION + "Local station Ethernet 1 link Up/Down. Supported by RAy2 only." + ::= { ray2Traps 9 } + +tr2Eth21LinkDown NOTIFICATION-TYPE + OBJECTS { eth2Link, + alarmEth2Down } + STATUS current + DESCRIPTION + "Local station Ethernet 2 link Up/Down. Supported by RAy2 only." + ::= { ray2Traps 10 } + +tr2RfPowerFail NOTIFICATION-TYPE + OBJECTS { rfPowerStatus, + alarmRfPowerFail } + STATUS current + DESCRIPTION + "RF Power amplifier failure. Supported by RAy2 only." + ::= { ray2Traps 11 } + +tr2NetBitrate NOTIFICATION-TYPE + OBJECTS { netBitrate, + alarmNetBitrate } + STATUS current + DESCRIPTION + "Air speed below threshold. Supported by RAy2 only." + ::= { ray2Traps 12 } + +tr2WifiOn NOTIFICATION-TYPE + OBJECTS { wifiHAP, + alarmWifiOn } + STATUS current + DESCRIPTION + "WiFi Host Access Point is on. Supported by RAy2 only." + ::= { ray2Traps 13 } + +END diff --git a/tests/snmpsim/ray.snmprec b/tests/snmpsim/ray.snmprec new file mode 100644 index 0000000000..0cc2f765f9 --- /dev/null +++ b/tests/snmpsim/ray.snmprec @@ -0,0 +1,2 @@ +1.3.6.1.2.1.1.1.0|4|RAy - Microwave Link +1.3.6.1.2.1.1.2.0|6|.1.3.6.1.4.1.33555.1.1 diff --git a/tests/snmpsim/ray_24GHz.snmprec b/tests/snmpsim/ray_24GHz.snmprec new file mode 100644 index 0000000000..728c6857ec --- /dev/null +++ b/tests/snmpsim/ray_24GHz.snmprec @@ -0,0 +1,2 @@ +1.3.6.1.2.1.1.1.0|4|Microwave Link +1.3.6.1.2.1.1.2.0|6|.1.3.6.1.4.1.33555.1.1