From 69e9929ddba7443669e9871bbe59c69a3fd2042c Mon Sep 17 00:00:00 2001 From: sthen Date: Sat, 4 Jul 2015 20:14:28 +0100 Subject: [PATCH 1/3] Support Huawei UPS, tested with UPS5000 --- includes/defaults.inc.php | 1 + includes/definitions.inc.php | 9 +++++++++ includes/discovery/os/huaweiups.inc.php | 12 ++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 includes/discovery/os/huaweiups.inc.php diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index abeceee2e..8586266ee 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -575,6 +575,7 @@ $config['modules_compat']['rfc1628']['deltaups'] = 1; $config['modules_compat']['rfc1628']['poweralert'] = 1; $config['modules_compat']['rfc1628']['multimatic'] = 1; $config['modules_compat']['rfc1628']['webpower'] = 1; +$config['modules_compat']['rfc1628']['huaweiups'] = 1; # Enable daily updates $config['update'] = 1; diff --git a/includes/definitions.inc.php b/includes/definitions.inc.php index 52d24bbc1..3c551d571 100644 --- a/includes/definitions.inc.php +++ b/includes/definitions.inc.php @@ -1162,6 +1162,15 @@ $config['os'][$os]['text'] = "Multimatic UPS"; $config['os'][$os]['type'] = "power"; $config['os'][$os]['icon'] = "multimatic"; +// Huawei UPS +$os = "huaweiups"; +$config['os'][$os]['text'] = "Huawei UPS"; +$config['os'][$os]['group'] = "ups"; +$config['os'][$os]['type'] = "power"; +$config['os'][$os]['icon'] = "huawei"; +$config['os'][$os]['over'][0]['graph'] = "device_current"; +$config['os'][$os]['over'][0]['text'] = "Current"; + foreach ($config['os'] as $this_os => $blah) { if (isset($config['os'][$this_os]['group'])) diff --git a/includes/discovery/os/huaweiups.inc.php b/includes/discovery/os/huaweiups.inc.php new file mode 100644 index 000000000..6b7f4f38d --- /dev/null +++ b/includes/discovery/os/huaweiups.inc.php @@ -0,0 +1,12 @@ + From ffbe06f64bccdf2356f74f9b128a9c270392fb32 Mon Sep 17 00:00:00 2001 From: sthen Date: Sat, 4 Jul 2015 20:15:17 +0100 Subject: [PATCH 2/3] Check netmanplus UPS by OID as well as descr, tested with Netman 204 --- includes/discovery/os/netmanplus.inc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/discovery/os/netmanplus.inc.php b/includes/discovery/os/netmanplus.inc.php index 42e081971..969c8bdb2 100644 --- a/includes/discovery/os/netmanplus.inc.php +++ b/includes/discovery/os/netmanplus.inc.php @@ -3,6 +3,7 @@ if (!$os) { if (preg_match("/^NetMan.*plus/", $sysDescr)) { $os = "netmanplus"; } + if (strstr($sysObjectId, ".1.3.6.1.4.1.5491.6")) { $os = "netmanplus"; } } -?> \ No newline at end of file +?> From 75704eba8738117244d98925a327318f23c8db8a Mon Sep 17 00:00:00 2001 From: sthen Date: Sat, 4 Jul 2015 20:47:46 +0100 Subject: [PATCH 3/3] Use correct divisor for frequencies on Huawei UPS --- includes/discovery/frequencies/rfc1628.inc.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/includes/discovery/frequencies/rfc1628.inc.php b/includes/discovery/frequencies/rfc1628.inc.php index 58f1fd6e4..340d0a38d 100644 --- a/includes/discovery/frequencies/rfc1628.inc.php +++ b/includes/discovery/frequencies/rfc1628.inc.php @@ -15,6 +15,7 @@ if (isset($config['modules_compat']['rfc1628'][$device['os']]) && $config['modul $current = snmp_get($device, $freq_oid, "-Oqv") / 10; $type = "rfc1628"; $divisor = 10; + if ($device['os'] == "huaweiups") { $divisor = 100; }; $index = '3.2.0.'.$i; discover_sensor($valid['sensor'], 'frequency', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); } @@ -24,6 +25,7 @@ if (isset($config['modules_compat']['rfc1628'][$device['os']]) && $config['modul $current = snmp_get($device, $freq_oid, "-Oqv") / 10; $type = "rfc1628"; $divisor = 10; + if ($device['os'] == "huaweiups") { $divisor = 100; }; $index = '4.2.0'; discover_sensor($valid['sensor'], 'frequency', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); @@ -32,6 +34,7 @@ if (isset($config['modules_compat']['rfc1628'][$device['os']]) && $config['modul $current = snmp_get($device, $freq_oid, "-Oqv") / 10; $type = "rfc1628"; $divisor = 10; + if ($device['os'] == "huaweiups") { $divisor = 100; }; $index = '5.1.0'; discover_sensor($valid['sensor'], 'frequency', $device, $freq_oid, $index, $type, $descr, $divisor, '1', NULL, NULL, NULL, NULL, $current); }