From 0c9330dc11813c854facf0198248eaf36ca8567b Mon Sep 17 00:00:00 2001 From: arrmo Date: Wed, 7 Aug 2019 13:01:13 -0500 Subject: [PATCH] Added support for OS dd-wrt (#10500) --- includes/definitions/dd-wrt.yaml | 15 +++++++++++ includes/polling/os/dd-wrt.inc.php | 31 +++++++++++++++++++++++ tests/data/dd-wrt.json | 40 ++++++++++++++++++++++++++++++ tests/snmpsim/dd-wrt.snmprec | 10 ++++++++ 4 files changed, 96 insertions(+) create mode 100644 includes/definitions/dd-wrt.yaml create mode 100644 includes/polling/os/dd-wrt.inc.php create mode 100644 tests/data/dd-wrt.json create mode 100644 tests/snmpsim/dd-wrt.snmprec diff --git a/includes/definitions/dd-wrt.yaml b/includes/definitions/dd-wrt.yaml new file mode 100644 index 0000000000..5044cbd396 --- /dev/null +++ b/includes/definitions/dd-wrt.yaml @@ -0,0 +1,15 @@ +os: dd-wrt +text: dd-wrt +type: network +icon: dd-wrt +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.8072.3.2.10 + snmpget: + oid: .1.3.6.1.4.1.8072.1.3.2.3.1.1.6.100.105.115.116.114.111 + op: starts + value: dd-wrt diff --git a/includes/polling/os/dd-wrt.inc.php b/includes/polling/os/dd-wrt.inc.php new file mode 100644 index 0000000000..fd501d7b9d --- /dev/null +++ b/includes/polling/os/dd-wrt.inc.php @@ -0,0 +1,31 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Neil Lathwood + * @author Neil Lathwood + */ + +// dd-wrt, cannot use exec with OID specified. Options are extend (w/OID), or exec (w/o OID) +// -> extend seems to be the recommended approach, so use that (changes OID, which "spells out" name) +list($ignore, $version) = explode(' ', snmp_get($device, '.1.3.6.1.4.1.8072.1.3.2.3.1.1.6.100.105.115.116.114.111', '-Osqnv')); +$hardware = snmp_get($device, '.1.3.6.1.4.1.8072.1.3.2.3.1.1.8.104.97.114.100.119.97.114.101', '-Osqnv'); + +unset($ignore); diff --git a/tests/data/dd-wrt.json b/tests/data/dd-wrt.json new file mode 100644 index 0000000000..9f2635b140 --- /dev/null +++ b/tests/data/dd-wrt.json @@ -0,0 +1,40 @@ +{ + "os": { + "discovery": { + "devices": [ + { + "sysName": "", + "sysObjectID": ".1.3.6.1.4.1.8072.3.2.10", + "sysDescr": "Linux wap-study 3.10.108-d8 #24797 Thu Jun 6 12:07:26 CEST 2019 mips", + "sysContact": null, + "version": null, + "hardware": null, + "features": null, + "os": "dd-wrt", + "type": "network", + "serial": null, + "icon": "dd-wrt.png", + "location": null + } + ] + }, + "poller": { + "devices": [ + { + "sysName": "", + "sysObjectID": ".1.3.6.1.4.1.8072.3.2.10", + "sysDescr": "Linux wap-study 3.10.108-d8 #24797 Thu Jun 6 12:07:26 CEST 2019 mips", + "sysContact": "", + "version": "3.10.108-d8", + "hardware": "Netgear WNDR4500", + "features": null, + "os": "dd-wrt", + "type": "network", + "serial": null, + "icon": "dd-wrt.png", + "location": "" + } + ] + } + } +} diff --git a/tests/snmpsim/dd-wrt.snmprec b/tests/snmpsim/dd-wrt.snmprec new file mode 100644 index 0000000000..8db1f33cbd --- /dev/null +++ b/tests/snmpsim/dd-wrt.snmprec @@ -0,0 +1,10 @@ +1.3.6.1.2.1.1.1.0|4|Linux wap-study 3.10.108-d8 #24797 Thu Jun 6 12:07:26 CEST 2019 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.2.1.1.3.0|67|12930721 +1.3.6.1.2.1.1.4.0|4| +1.3.6.1.2.1.1.5.0|4| +1.3.6.1.2.1.1.6.0|4| +1.3.6.1.2.1.25.1.1.0|67|17244413 +1.3.6.1.4.1.8072.1.3.2.3.1.1.6.100.105.115.116.114.111|4|dd-wrt 3.10.108-d8 +1.3.6.1.4.1.8072.1.3.2.3.1.1.8.104.97.114.100.119.97.114.101|4|Netgear WNDR4500 +1.3.6.1.6.3.10.2.1.3.0|2|129307