From fbe2f94b5aad068a3dcb38e52cb9cbe153da7fe2 Mon Sep 17 00:00:00 2001 From: Calvario Date: Sat, 13 Jun 2015 10:11:47 +0200 Subject: [PATCH] Added UPS load support to Synology --- includes/discovery/load/dsm.inc.php | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 includes/discovery/load/dsm.inc.php diff --git a/includes/discovery/load/dsm.inc.php b/includes/discovery/load/dsm.inc.php new file mode 100644 index 000000000..0365eacd6 --- /dev/null +++ b/includes/discovery/load/dsm.inc.php @@ -0,0 +1,35 @@ + + * + * 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. + */ + +if ($device['os'] == "dsm") { + + echo "DSM UPS Load"; + + // UPS Device Manufacturer, example return : SNMPv2-SMI::enterprises.6574.4.1.2.0 = STRING: "American Power Conversion" + $ups_device_manufacturer_oid = '.1.3.6.1.4.1.6574.4.1.2.0'; + $ups_device_manufacturer = str_replace('"', '', snmp_get($device, $ups_device_manufacturer_oid, "-Oqv")); + // UPS Device Model, example return : SNMPv2-SMI::enterprises.6574.4.1.1.0 = STRING: "Back-UPS RS 900G" + $ups_device_model_oid = '.1.3.6.1.4.1.6574.4.1.1.0'; + $ups_device_model = str_replace('"', '', snmp_get($device, $ups_device_model_oid, "-Oqv")); + + + // UPS Load Value, example return : SNMPv2-SMI::enterprises.6574.4.2.12.1.0 = Opaque: Float: 4.000000 + $ups_load_oid = '.1.3.6.1.4.1.6574.4.2.12.1.0'; + $ups_load = snmp_get($device, $ups_load_oid, "-Oqv"); + if (is_numeric($ups_load)) { + discover_sensor($valid['sensor'], 'load', $device, $ups_load_oid, 'UPSLoad', $ups_device_manufacturer.' '.$ups_device_model, 'UPS Load', '1', '1', 0, NULL, NULL, 100, intval($ups_load)); + } +} + +