From f0a335c5573784615922c1e5af9968639fae0921 Mon Sep 17 00:00:00 2001 From: laf Date: Sat, 29 Oct 2016 14:16:57 +0000 Subject: [PATCH 1/3] newdevice: Added support for Dell Remote consoles --- includes/definitions.inc.php | 7 +++++++ includes/discovery/os/dell-rcs.inc.php | 28 ++++++++++++++++++++++++++ includes/polling/os/dell-rcs.inc.php | 26 ++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 includes/discovery/os/dell-rcs.inc.php create mode 100644 includes/polling/os/dell-rcs.inc.php diff --git a/includes/definitions.inc.php b/includes/definitions.inc.php index 34704ecd03..0f1ef40df0 100644 --- a/includes/definitions.inc.php +++ b/includes/definitions.inc.php @@ -1090,6 +1090,13 @@ $config['os'][$os]['over'][1]['text'] = 'CPU Usage'; $config['os'][$os]['over'][2]['graph'] = 'device_mempool'; $config['os'][$os]['over'][2]['text'] = 'Memory Usage'; +$os = 'dell-rcs'; +$config['os'][$os]['text'] = 'Dell Remote Console'; +$config['os'][$os]['type'] = 'appliance'; +$config['os'][$os]['icon'] = 'dell'; +$config['os'][$os]['over'][0]['graph'] = 'device_bits'; +$config['os'][$os]['over'][0]['text'] = 'Device Traffic'; + $os = 'avaya-ers'; $config['os'][$os]['text'] = 'ERS Firmware'; $config['os'][$os]['type'] = 'network'; diff --git a/includes/discovery/os/dell-rcs.inc.php b/includes/discovery/os/dell-rcs.inc.php new file mode 100644 index 0000000000..f774aa2579 --- /dev/null +++ b/includes/discovery/os/dell-rcs.inc.php @@ -0,0 +1,28 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Neil Lathwood + * @author Neil Lathwood + */ + +if (str_contains($sysObjectId, '.1.3.6.1.4.1.10418.18.21.17')) { + $os = 'dell-rcs'; +} diff --git a/includes/polling/os/dell-rcs.inc.php b/includes/polling/os/dell-rcs.inc.php new file mode 100644 index 0000000000..8595a4a220 --- /dev/null +++ b/includes/polling/os/dell-rcs.inc.php @@ -0,0 +1,26 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Neil Lathwood + * @author Neil Lathwood + */ + +list($hardware, $version) = preg_split('/ /', preg_replace('/([\\\"]+)/', '', $poll_device['sysDescr'])); From 57c6f7693016d6262dcecb0df9f5e3f52274642d Mon Sep 17 00:00:00 2001 From: laf Date: Sun, 30 Oct 2016 20:10:26 +0000 Subject: [PATCH 2/3] Added unit tests --- tests/OSDiscoveryTest.php | 5 +++++ tests/snmpsim/dell-rcs.snmprec | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 tests/snmpsim/dell-rcs.snmprec diff --git a/tests/OSDiscoveryTest.php b/tests/OSDiscoveryTest.php index 4d841cdf8c..61a14cf19e 100644 --- a/tests/OSDiscoveryTest.php +++ b/tests/OSDiscoveryTest.php @@ -386,6 +386,11 @@ class DiscoveryTest extends \PHPUnit_Framework_TestCase $this->checkOS('deliberant'); } + public function testDellrcs() + { + $this->checkOS('dell-rcs'); + } + public function testDelllaser() { $this->checkOS('dell-laser'); diff --git a/tests/snmpsim/dell-rcs.snmprec b/tests/snmpsim/dell-rcs.snmprec new file mode 100644 index 0000000000..892721ecfa --- /dev/null +++ b/tests/snmpsim/dell-rcs.snmprec @@ -0,0 +1,2 @@ +1.3.6.1.2.1.1.1.0|4|\"1082DS *46\" +1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.10418.18.21.17 \ No newline at end of file From 685c9eb9b86ad389256308d93010bb84bb6fe0e1 Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Tue, 1 Nov 2016 09:38:41 -0500 Subject: [PATCH 3/3] str_contains -> starts_with --- includes/discovery/os/dell-rcs.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/discovery/os/dell-rcs.inc.php b/includes/discovery/os/dell-rcs.inc.php index f774aa2579..a584e054ef 100644 --- a/includes/discovery/os/dell-rcs.inc.php +++ b/includes/discovery/os/dell-rcs.inc.php @@ -23,6 +23,6 @@ * @author Neil Lathwood */ -if (str_contains($sysObjectId, '.1.3.6.1.4.1.10418.18.21.17')) { +if (starts_with($sysObjectId, '.1.3.6.1.4.1.10418.18.21.17')) { $os = 'dell-rcs'; }