From 89a2847b69f302b3196abe76972dcf4ee881fefa Mon Sep 17 00:00:00 2001 From: Neil Lathwood Date: Fri, 13 Jan 2017 15:31:11 +0000 Subject: [PATCH] newdevice: Added Tomato and AsusWRT-Merlin OS #5254 (#5398) * newdevice: Added Tomato and AsusWRT-Merlin OS #5254 * that should not be there --- includes/definitions/asuswrt-merlin.yaml | 9 +++++++ includes/definitions/tomato.yaml | 8 +++++++ includes/discovery/os/linux.inc.php | 7 ++++++ includes/polling/os/asuswrt-merlin.inc.php | 28 ++++++++++++++++++++++ includes/polling/os/tomato.inc.php | 28 ++++++++++++++++++++++ tests/OSDiscoveryTest.php | 10 ++++++++ tests/snmpsim/asuswrt-merlin.snmprec | 3 +++ tests/snmpsim/tomato.snmprec | 3 +++ 8 files changed, 96 insertions(+) create mode 100644 includes/definitions/asuswrt-merlin.yaml create mode 100644 includes/definitions/tomato.yaml create mode 100644 includes/polling/os/asuswrt-merlin.inc.php create mode 100644 includes/polling/os/tomato.inc.php create mode 100644 tests/snmpsim/asuswrt-merlin.snmprec create mode 100644 tests/snmpsim/tomato.snmprec diff --git a/includes/definitions/asuswrt-merlin.yaml b/includes/definitions/asuswrt-merlin.yaml new file mode 100644 index 0000000000..70be880a37 --- /dev/null +++ b/includes/definitions/asuswrt-merlin.yaml @@ -0,0 +1,9 @@ +os: asuswrt-merlin +text: 'AsusWRT Merlin' +type: network +icon: asuswrt-merlin +over: + - { graph: device_bits, text: 'Device Traffic' } + - { graph: device_processor, text: 'CPU Usage' } + - { graph: device_mempool, text: 'Memory Usage' } + diff --git a/includes/definitions/tomato.yaml b/includes/definitions/tomato.yaml new file mode 100644 index 0000000000..1181824f6f --- /dev/null +++ b/includes/definitions/tomato.yaml @@ -0,0 +1,8 @@ +os: tomato +text: 'Tomato' +type: network +icon: tomato +over: + - { graph: device_bits, text: 'Device Traffic' } + - { graph: device_processor, text: 'CPU Usage' } + - { graph: device_mempool, text: 'Memory Usage' } diff --git a/includes/discovery/os/linux.inc.php b/includes/discovery/os/linux.inc.php index 1a8c6e37e3..73dc11af28 100644 --- a/includes/discovery/os/linux.inc.php +++ b/includes/discovery/os/linux.inc.php @@ -32,5 +32,12 @@ if (starts_with($sysDescr, 'Linux')) { $os = 'pcoweb'; // Carel PCOweb } elseif (starts_with($sysDescr, 'Linux mirthtemplate')) { $os = 'mirth'; + } elseif ($wrt = snmp_get($device, '.1.3.6.1.4.1.2021.7890.1.101.1', '-Osqnv')) { + $wrt = trim($wrt, '"'); + if (starts_with($wrt, 'ASUSWRT-Merlin')) { + $os = 'asuswrt-merlin'; + } elseif (starts_with($wrt, 'Tomato ')) { + $os = 'tomato'; + } } } diff --git a/includes/polling/os/asuswrt-merlin.inc.php b/includes/polling/os/asuswrt-merlin.inc.php new file mode 100644 index 0000000000..4b84a8b999 --- /dev/null +++ b/includes/polling/os/asuswrt-merlin.inc.php @@ -0,0 +1,28 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Neil Lathwood + * @author Neil Lathwood + */ + +list($ignore, $hardware) = explode(' ', trim(snmp_get($device, '.1.3.6.1.4.1.2021.7890.1.101.1', '-Osqnv'), '"')); + +unset($ignore); diff --git a/includes/polling/os/tomato.inc.php b/includes/polling/os/tomato.inc.php new file mode 100644 index 0000000000..514d0f753e --- /dev/null +++ b/includes/polling/os/tomato.inc.php @@ -0,0 +1,28 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Neil Lathwood + * @author Neil Lathwood + */ + +list($ignore, $version) = explode(' ', trim(snmp_get($device, '.1.3.6.1.4.1.2021.7890.1.101.1', '-Osqnv'), '"')); + +unset($ignore); diff --git a/tests/OSDiscoveryTest.php b/tests/OSDiscoveryTest.php index c2f55c2743..785a45df1f 100644 --- a/tests/OSDiscoveryTest.php +++ b/tests/OSDiscoveryTest.php @@ -177,6 +177,11 @@ class DiscoveryTest extends \PHPUnit_Framework_TestCase $this->checkOS('asa'); } + public function testAsusMerlin() + { + $this->checkOS('asuswrt-merlin'); + } + public function testAvayaers() { $this->checkOS('avaya-ers'); @@ -1383,6 +1388,11 @@ class DiscoveryTest extends \PHPUnit_Framework_TestCase $this->checkOS('timos', 'timos8'); } + public function testTomato() + { + $this->checkOS('tomato'); + } + public function testTpconductor() { $this->checkOS('tpconductor'); diff --git a/tests/snmpsim/asuswrt-merlin.snmprec b/tests/snmpsim/asuswrt-merlin.snmprec new file mode 100644 index 0000000000..ad95928d08 --- /dev/null +++ b/tests/snmpsim/asuswrt-merlin.snmprec @@ -0,0 +1,3 @@ +1.3.6.1.2.1.1.1.0|4|Linux wap-familyroom 2.6.36.4brcmarm #2 SMP PREEMPT Sat Nov 5 14:54:32 EDT 2016 armv7l +1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.8072.3.2.10 +1.3.6.1.4.1.2021.7890.1.101.1|4|ASUSWRT-Merlin RT-AC68U diff --git a/tests/snmpsim/tomato.snmprec b/tests/snmpsim/tomato.snmprec new file mode 100644 index 0000000000..c2040dd857 --- /dev/null +++ b/tests/snmpsim/tomato.snmprec @@ -0,0 +1,3 @@ +1.3.6.1.2.1.1.1.0|4|Linux wap-attic 2.6.22.19 #2 Sun Nov 20 16:53:30 CST 2016 mips +1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.8072.3.2.10 +1.3.6.1.4.1.2021.7890.1.101.1|4|Tomato v1.28.1120