mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Added Huawei UPS2000 support (#10831)
* UPS2000 * tests * over * filter on sysDescr
This commit is contained in:
@@ -6,9 +6,13 @@ icon: huawei
|
||||
rfc1628_compat: true
|
||||
over:
|
||||
- { graph: device_current, text: Current }
|
||||
- { graph: device_voltage, text: Voltage }
|
||||
- { graph: device_load, text: Load }
|
||||
discovery:
|
||||
-
|
||||
sysDescr: Linux GSE200M
|
||||
sysDescr:
|
||||
- Linux GSE200M
|
||||
- UPS
|
||||
snmpget:
|
||||
oid: UPS-MIB::upsIdentManufacturer.0
|
||||
value: HUAWEI
|
||||
|
@@ -913,6 +913,9 @@ function get_device_divisor($device, $os_version, $sensor_type, $oid)
|
||||
}
|
||||
} elseif ($device['os'] == 'huaweiups') {
|
||||
if ($sensor_type == 'frequency') {
|
||||
if (starts_with($device['hardware'], "UPS2000")) {
|
||||
return 10;
|
||||
}
|
||||
return 100;
|
||||
}
|
||||
} elseif ($device['os'] == 'hpe-rtups') {
|
||||
|
21
includes/polling/os/huaweiups.inc.php
Normal file
21
includes/polling/os/huaweiups.inc.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS
|
||||
*
|
||||
* Copyright (c) 2016 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
||||
* 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.
|
||||
*/
|
||||
|
||||
$oids = ['upsIdentModel.0', 'upsIdentUPSSoftwareVersion.0'];
|
||||
$data = snmp_get_multi($device, $oids, '-OQUs', 'UPS-MIB');
|
||||
|
||||
if (!empty($data[0]['upsIdentModel'])) {
|
||||
$hardware = $data[0]['upsIdentModel'];
|
||||
}
|
||||
if (!empty($data[0]['upsIdentUPSSoftwareVersion'])) {
|
||||
$version = $data[0]['upsIdentUPSSoftwareVersion'];
|
||||
}
|
386
tests/data/huaweiups_ups2000.json
Normal file
386
tests/data/huaweiups_ups2000.json
Normal file
@@ -0,0 +1,386 @@
|
||||
{
|
||||
"os": {
|
||||
"discovery": {
|
||||
"devices": [
|
||||
{
|
||||
"sysName": "<private>",
|
||||
"sysObjectID": ".1.3.6.1.4.1.2011.6.174.4.1.2.4",
|
||||
"sysDescr": "SNMP Card for HUAWEI UPS2000",
|
||||
"sysContact": null,
|
||||
"version": null,
|
||||
"hardware": null,
|
||||
"features": null,
|
||||
"os": "huaweiups",
|
||||
"type": "power",
|
||||
"serial": null,
|
||||
"icon": "huawei.svg",
|
||||
"location": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"poller": {
|
||||
"devices": [
|
||||
{
|
||||
"sysName": "<private>",
|
||||
"sysObjectID": ".1.3.6.1.4.1.2011.6.174.4.1.2.4",
|
||||
"sysDescr": "SNMP Card for HUAWEI UPS2000",
|
||||
"sysContact": "<private>",
|
||||
"version": "V100R001C00SPC602",
|
||||
"hardware": "UPS2000 6kVA",
|
||||
"features": null,
|
||||
"os": "huaweiups",
|
||||
"type": "power",
|
||||
"serial": null,
|
||||
"icon": "huawei.svg",
|
||||
"location": "<private>"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"sensors": {
|
||||
"discovery": {
|
||||
"sensors": [
|
||||
{
|
||||
"sensor_deleted": 0,
|
||||
"sensor_class": "current",
|
||||
"poller_type": "snmp",
|
||||
"sensor_oid": ".1.3.6.1.2.1.33.1.4.4.1.3.1",
|
||||
"sensor_index": "1",
|
||||
"sensor_type": "rfc1628",
|
||||
"sensor_descr": "Output",
|
||||
"group": null,
|
||||
"sensor_divisor": 10,
|
||||
"sensor_multiplier": 1,
|
||||
"sensor_current": 7.2,
|
||||
"sensor_limit": null,
|
||||
"sensor_limit_warn": null,
|
||||
"sensor_limit_low": null,
|
||||
"sensor_limit_low_warn": null,
|
||||
"sensor_alert": 1,
|
||||
"sensor_custom": "No",
|
||||
"entPhysicalIndex": null,
|
||||
"entPhysicalIndex_measured": null,
|
||||
"sensor_prev": null,
|
||||
"user_func": null,
|
||||
"state_name": null
|
||||
},
|
||||
{
|
||||
"sensor_deleted": 0,
|
||||
"sensor_class": "current",
|
||||
"poller_type": "snmp",
|
||||
"sensor_oid": ".1.3.6.1.2.1.33.1.2.6.0",
|
||||
"sensor_index": "500",
|
||||
"sensor_type": "rfc1628",
|
||||
"sensor_descr": "Battery",
|
||||
"group": null,
|
||||
"sensor_divisor": 10,
|
||||
"sensor_multiplier": 1,
|
||||
"sensor_current": 0.4,
|
||||
"sensor_limit": null,
|
||||
"sensor_limit_warn": null,
|
||||
"sensor_limit_low": null,
|
||||
"sensor_limit_low_warn": null,
|
||||
"sensor_alert": 1,
|
||||
"sensor_custom": "No",
|
||||
"entPhysicalIndex": null,
|
||||
"entPhysicalIndex_measured": null,
|
||||
"sensor_prev": null,
|
||||
"user_func": null,
|
||||
"state_name": null
|
||||
},
|
||||
{
|
||||
"sensor_deleted": 0,
|
||||
"sensor_class": "frequency",
|
||||
"poller_type": "snmp",
|
||||
"sensor_oid": ".1.3.6.1.2.1.33.1.3.3.1.2.1",
|
||||
"sensor_index": "3.2.0.1",
|
||||
"sensor_type": "rfc1628",
|
||||
"sensor_descr": "Input",
|
||||
"group": null,
|
||||
"sensor_divisor": 100,
|
||||
"sensor_multiplier": 1,
|
||||
"sensor_current": 5,
|
||||
"sensor_limit": 5.25,
|
||||
"sensor_limit_warn": null,
|
||||
"sensor_limit_low": 4.75,
|
||||
"sensor_limit_low_warn": null,
|
||||
"sensor_alert": 1,
|
||||
"sensor_custom": "No",
|
||||
"entPhysicalIndex": null,
|
||||
"entPhysicalIndex_measured": null,
|
||||
"sensor_prev": null,
|
||||
"user_func": null,
|
||||
"state_name": null
|
||||
},
|
||||
{
|
||||
"sensor_deleted": 0,
|
||||
"sensor_class": "load",
|
||||
"poller_type": "snmp",
|
||||
"sensor_oid": ".1.3.6.1.2.1.33.1.4.4.1.5.1",
|
||||
"sensor_index": "501",
|
||||
"sensor_type": "rfc1628",
|
||||
"sensor_descr": "Percentage load",
|
||||
"group": null,
|
||||
"sensor_divisor": 1,
|
||||
"sensor_multiplier": 1,
|
||||
"sensor_current": 27,
|
||||
"sensor_limit": 80,
|
||||
"sensor_limit_warn": null,
|
||||
"sensor_limit_low": null,
|
||||
"sensor_limit_low_warn": null,
|
||||
"sensor_alert": 1,
|
||||
"sensor_custom": "No",
|
||||
"entPhysicalIndex": null,
|
||||
"entPhysicalIndex_measured": null,
|
||||
"sensor_prev": null,
|
||||
"user_func": null,
|
||||
"state_name": null
|
||||
},
|
||||
{
|
||||
"sensor_deleted": 0,
|
||||
"sensor_class": "power",
|
||||
"poller_type": "snmp",
|
||||
"sensor_oid": ".1.3.6.1.2.1.33.1.4.4.1.4.1",
|
||||
"sensor_index": "301",
|
||||
"sensor_type": "rfc1628",
|
||||
"sensor_descr": "Output",
|
||||
"group": null,
|
||||
"sensor_divisor": 1,
|
||||
"sensor_multiplier": 1,
|
||||
"sensor_current": 1,
|
||||
"sensor_limit": null,
|
||||
"sensor_limit_warn": null,
|
||||
"sensor_limit_low": null,
|
||||
"sensor_limit_low_warn": null,
|
||||
"sensor_alert": 1,
|
||||
"sensor_custom": "No",
|
||||
"entPhysicalIndex": null,
|
||||
"entPhysicalIndex_measured": null,
|
||||
"sensor_prev": null,
|
||||
"user_func": null,
|
||||
"state_name": null
|
||||
},
|
||||
{
|
||||
"sensor_deleted": 0,
|
||||
"sensor_class": "runtime",
|
||||
"poller_type": "snmp",
|
||||
"sensor_oid": ".1.3.6.1.2.1.33.1.2.2.0",
|
||||
"sensor_index": "100",
|
||||
"sensor_type": "rfc1628",
|
||||
"sensor_descr": "Time on battery",
|
||||
"group": null,
|
||||
"sensor_divisor": 60,
|
||||
"sensor_multiplier": 1,
|
||||
"sensor_current": 0,
|
||||
"sensor_limit": 2,
|
||||
"sensor_limit_warn": 1,
|
||||
"sensor_limit_low": 0,
|
||||
"sensor_limit_low_warn": 0,
|
||||
"sensor_alert": 1,
|
||||
"sensor_custom": "No",
|
||||
"entPhysicalIndex": null,
|
||||
"entPhysicalIndex_measured": null,
|
||||
"sensor_prev": null,
|
||||
"user_func": null,
|
||||
"state_name": null
|
||||
},
|
||||
{
|
||||
"sensor_deleted": 0,
|
||||
"sensor_class": "runtime",
|
||||
"poller_type": "snmp",
|
||||
"sensor_oid": ".1.3.6.1.2.1.33.1.2.3.0",
|
||||
"sensor_index": "200",
|
||||
"sensor_type": "rfc1628",
|
||||
"sensor_descr": "Estimated battery time remaining",
|
||||
"group": null,
|
||||
"sensor_divisor": 1,
|
||||
"sensor_multiplier": 1,
|
||||
"sensor_current": 4294967295,
|
||||
"sensor_limit": 10000,
|
||||
"sensor_limit_warn": null,
|
||||
"sensor_limit_low": 5,
|
||||
"sensor_limit_low_warn": 10,
|
||||
"sensor_alert": 1,
|
||||
"sensor_custom": "No",
|
||||
"entPhysicalIndex": null,
|
||||
"entPhysicalIndex_measured": null,
|
||||
"sensor_prev": null,
|
||||
"user_func": null,
|
||||
"state_name": null
|
||||
},
|
||||
{
|
||||
"sensor_deleted": 0,
|
||||
"sensor_class": "state",
|
||||
"poller_type": "snmp",
|
||||
"sensor_oid": ".1.3.6.1.2.1.33.1.4.1.0",
|
||||
"sensor_index": "0",
|
||||
"sensor_type": "upsOutputSourceState",
|
||||
"sensor_descr": "Output Source",
|
||||
"group": null,
|
||||
"sensor_divisor": 1,
|
||||
"sensor_multiplier": 1,
|
||||
"sensor_current": 3,
|
||||
"sensor_limit": null,
|
||||
"sensor_limit_warn": null,
|
||||
"sensor_limit_low": null,
|
||||
"sensor_limit_low_warn": null,
|
||||
"sensor_alert": 1,
|
||||
"sensor_custom": "No",
|
||||
"entPhysicalIndex": "0",
|
||||
"entPhysicalIndex_measured": null,
|
||||
"sensor_prev": null,
|
||||
"user_func": null,
|
||||
"state_name": "upsOutputSourceState"
|
||||
},
|
||||
{
|
||||
"sensor_deleted": 0,
|
||||
"sensor_class": "temperature",
|
||||
"poller_type": "snmp",
|
||||
"sensor_oid": ".1.3.6.1.2.1.33.1.2.7.0",
|
||||
"sensor_index": "0",
|
||||
"sensor_type": "rfc1628",
|
||||
"sensor_descr": "Battery",
|
||||
"group": null,
|
||||
"sensor_divisor": 1,
|
||||
"sensor_multiplier": 1,
|
||||
"sensor_current": 21,
|
||||
"sensor_limit": 41,
|
||||
"sensor_limit_warn": null,
|
||||
"sensor_limit_low": 11,
|
||||
"sensor_limit_low_warn": null,
|
||||
"sensor_alert": 1,
|
||||
"sensor_custom": "No",
|
||||
"entPhysicalIndex": null,
|
||||
"entPhysicalIndex_measured": null,
|
||||
"sensor_prev": null,
|
||||
"user_func": null,
|
||||
"state_name": null
|
||||
},
|
||||
{
|
||||
"sensor_deleted": 0,
|
||||
"sensor_class": "voltage",
|
||||
"poller_type": "snmp",
|
||||
"sensor_oid": ".1.3.6.1.2.1.33.1.4.4.1.2.1",
|
||||
"sensor_index": "1",
|
||||
"sensor_type": "rfc1628",
|
||||
"sensor_descr": "Output",
|
||||
"group": null,
|
||||
"sensor_divisor": 1,
|
||||
"sensor_multiplier": 1,
|
||||
"sensor_current": 230,
|
||||
"sensor_limit": 264.5,
|
||||
"sensor_limit_warn": null,
|
||||
"sensor_limit_low": 195.5,
|
||||
"sensor_limit_low_warn": null,
|
||||
"sensor_alert": 1,
|
||||
"sensor_custom": "No",
|
||||
"entPhysicalIndex": null,
|
||||
"entPhysicalIndex_measured": null,
|
||||
"sensor_prev": null,
|
||||
"user_func": null,
|
||||
"state_name": null
|
||||
},
|
||||
{
|
||||
"sensor_deleted": 0,
|
||||
"sensor_class": "voltage",
|
||||
"poller_type": "snmp",
|
||||
"sensor_oid": ".1.3.6.1.2.1.33.1.3.3.1.3.1",
|
||||
"sensor_index": "101",
|
||||
"sensor_type": "rfc1628",
|
||||
"sensor_descr": "Input",
|
||||
"group": null,
|
||||
"sensor_divisor": 1,
|
||||
"sensor_multiplier": 1,
|
||||
"sensor_current": 233,
|
||||
"sensor_limit": 267.95,
|
||||
"sensor_limit_warn": null,
|
||||
"sensor_limit_low": 198.05,
|
||||
"sensor_limit_low_warn": null,
|
||||
"sensor_alert": 1,
|
||||
"sensor_custom": "No",
|
||||
"entPhysicalIndex": null,
|
||||
"entPhysicalIndex_measured": null,
|
||||
"sensor_prev": null,
|
||||
"user_func": null,
|
||||
"state_name": null
|
||||
},
|
||||
{
|
||||
"sensor_deleted": 0,
|
||||
"sensor_class": "voltage",
|
||||
"poller_type": "snmp",
|
||||
"sensor_oid": ".1.3.6.1.2.1.33.1.5.3.1.2.1",
|
||||
"sensor_index": "201",
|
||||
"sensor_type": "rfc1628",
|
||||
"sensor_descr": "Bypass",
|
||||
"group": null,
|
||||
"sensor_divisor": 1,
|
||||
"sensor_multiplier": 1,
|
||||
"sensor_current": 233,
|
||||
"sensor_limit": 267.95,
|
||||
"sensor_limit_warn": null,
|
||||
"sensor_limit_low": 198.05,
|
||||
"sensor_limit_low_warn": null,
|
||||
"sensor_alert": 1,
|
||||
"sensor_custom": "No",
|
||||
"entPhysicalIndex": null,
|
||||
"entPhysicalIndex_measured": null,
|
||||
"sensor_prev": null,
|
||||
"user_func": null,
|
||||
"state_name": null
|
||||
}
|
||||
],
|
||||
"state_indexes": [
|
||||
{
|
||||
"state_name": "upsOutputSourceState",
|
||||
"state_descr": "Other",
|
||||
"state_draw_graph": 0,
|
||||
"state_value": 1,
|
||||
"state_generic_value": 3
|
||||
},
|
||||
{
|
||||
"state_name": "upsOutputSourceState",
|
||||
"state_descr": "None",
|
||||
"state_draw_graph": 0,
|
||||
"state_value": 2,
|
||||
"state_generic_value": 3
|
||||
},
|
||||
{
|
||||
"state_name": "upsOutputSourceState",
|
||||
"state_descr": "Normal",
|
||||
"state_draw_graph": 0,
|
||||
"state_value": 3,
|
||||
"state_generic_value": 0
|
||||
},
|
||||
{
|
||||
"state_name": "upsOutputSourceState",
|
||||
"state_descr": "Bypass",
|
||||
"state_draw_graph": 0,
|
||||
"state_value": 4,
|
||||
"state_generic_value": 2
|
||||
},
|
||||
{
|
||||
"state_name": "upsOutputSourceState",
|
||||
"state_descr": "Battery",
|
||||
"state_draw_graph": 0,
|
||||
"state_value": 5,
|
||||
"state_generic_value": 2
|
||||
},
|
||||
{
|
||||
"state_name": "upsOutputSourceState",
|
||||
"state_descr": "Booster",
|
||||
"state_draw_graph": 0,
|
||||
"state_value": 6,
|
||||
"state_generic_value": 2
|
||||
},
|
||||
{
|
||||
"state_name": "upsOutputSourceState",
|
||||
"state_descr": "Reducer",
|
||||
"state_draw_graph": 0,
|
||||
"state_value": 7,
|
||||
"state_generic_value": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
"poller": "matches discovery"
|
||||
}
|
||||
}
|
56
tests/snmpsim/huaweiups_ups2000.snmprec
Normal file
56
tests/snmpsim/huaweiups_ups2000.snmprec
Normal file
@@ -0,0 +1,56 @@
|
||||
1.3.6.1.2.1.1.1.0|4|SNMP Card for HUAWEI UPS2000
|
||||
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.2011.6.174.4.1.2.4
|
||||
1.3.6.1.2.1.1.3.0|67|3239276937
|
||||
1.3.6.1.2.1.1.4.0|4|<private>
|
||||
1.3.6.1.2.1.1.5.0|4|<private>
|
||||
1.3.6.1.2.1.1.6.0|4|<private>
|
||||
1.3.6.1.2.1.11.1.0|65|11440
|
||||
1.3.6.1.2.1.11.2.0|65|11371
|
||||
1.3.6.1.2.1.11.3.0|65|0
|
||||
1.3.6.1.2.1.11.4.0|65|44
|
||||
1.3.6.1.2.1.11.5.0|65|0
|
||||
1.3.6.1.2.1.11.6.0|65|0
|
||||
1.3.6.1.2.1.11.8.0|65|0
|
||||
1.3.6.1.2.1.11.9.0|65|0
|
||||
1.3.6.1.2.1.11.10.0|65|0
|
||||
1.3.6.1.2.1.11.11.0|65|0
|
||||
1.3.6.1.2.1.11.12.0|65|0
|
||||
1.3.6.1.2.1.11.13.0|65|54971
|
||||
1.3.6.1.2.1.11.14.0|65|0
|
||||
1.3.6.1.2.1.11.15.0|65|7014
|
||||
1.3.6.1.2.1.11.16.0|65|63
|
||||
1.3.6.1.2.1.11.17.0|65|0
|
||||
1.3.6.1.2.1.11.18.0|65|0
|
||||
1.3.6.1.2.1.11.19.0|65|0
|
||||
1.3.6.1.2.1.11.20.0|65|0
|
||||
1.3.6.1.2.1.11.21.0|65|0
|
||||
1.3.6.1.2.1.11.22.0|65|0
|
||||
1.3.6.1.2.1.11.24.0|65|0
|
||||
1.3.6.1.2.1.11.25.0|65|0
|
||||
1.3.6.1.2.1.11.26.0|65|0
|
||||
1.3.6.1.2.1.11.27.0|65|0
|
||||
1.3.6.1.2.1.11.28.0|65|11373
|
||||
1.3.6.1.2.1.11.29.0|65|0
|
||||
1.3.6.1.2.1.11.30.0|2|2
|
||||
1.3.6.1.2.1.11.31.0|65|0
|
||||
1.3.6.1.2.1.11.32.0|65|0
|
||||
1.3.6.1.2.1.33.1.1.1.0|4|HUAWEI
|
||||
1.3.6.1.2.1.33.1.1.2.0|4|UPS2000 6kVA
|
||||
1.3.6.1.2.1.33.1.1.3.0|4|V100R001C00SPC602
|
||||
1.3.6.1.2.1.33.1.2.1.0|66|2
|
||||
1.3.6.1.2.1.33.1.2.2.0|66|0
|
||||
1.3.6.1.2.1.33.1.2.3.0|66|4294967295
|
||||
1.3.6.1.2.1.33.1.2.4.0|66|100
|
||||
1.3.6.1.2.1.33.1.2.5.0|66|2707
|
||||
1.3.6.1.2.1.33.1.2.6.0|2|4
|
||||
1.3.6.1.2.1.33.1.2.7.0|2|21
|
||||
1.3.6.1.2.1.33.1.3.3.1.2.1|2|500
|
||||
1.3.6.1.2.1.33.1.3.3.1.3.1|2|233
|
||||
1.3.6.1.2.1.33.1.4.1.0|2|3
|
||||
1.3.6.1.2.1.33.1.4.2.0|66|500
|
||||
1.3.6.1.2.1.33.1.4.4.1.2.1|2|230
|
||||
1.3.6.1.2.1.33.1.4.4.1.3.1|2|72
|
||||
1.3.6.1.2.1.33.1.4.4.1.4.1|2|1
|
||||
1.3.6.1.2.1.33.1.4.4.1.5.1|2|27
|
||||
1.3.6.1.2.1.33.1.5.1.0|66|500
|
||||
1.3.6.1.2.1.33.1.5.3.1.2.1|2|233
|
Reference in New Issue
Block a user