From c0fc3e038123d7a002f513b9484555fe4f8c54b7 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 5 Sep 2017 18:03:30 +0200 Subject: [PATCH 01/26] main.c : update usage message with hints about running as unprivileged user --- drivers/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/main.c b/drivers/main.c index 6c0f40af7b..6c181a70a9 100644 --- a/drivers/main.c +++ b/drivers/main.c @@ -98,7 +98,11 @@ static void help_msg(void) printf(" -s - configure directly from cmd line arguments\n"); printf(" - note: must specify all driver parameters with successive -x\n"); - printf(" - note: at least 'port' variable should be set\n\n"); + printf(" - note: at least 'port' variable should be set\n"); + printf(" - note: to explore the current values on a device from an\n"); + printf(" unprivileged user account (with sufficient media access in\n"); + printf(" the OS - e.g. to query networked devices), you can specify\n"); + printf(" '-d 1' argument and `export NUT_STATEPATH=/tmp` beforehand\n\n"); printf(" -V - print version, then exit\n"); printf(" -L - print parseable list of driver variables\n"); From d7c728c44642b2e8e8128d8056d6a6bf15d2fe9d Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 6 Sep 2017 08:14:08 +0200 Subject: [PATCH 02/26] common.c : altpidpath() : support priority of an envvar, like statepath does --- common/common.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/common/common.c b/common/common.c index 281865e855..cfdc7786fe 100644 --- a/common/common.c +++ b/common/common.c @@ -375,13 +375,27 @@ const char * dflt_statepath(void) return path; } -/* Return the alternate path for pid files */ +/* Return the alternate path for pid files, for processes running as non-root + * Per documentation and configure script, the fallback value is the + * state-file path as the daemon and drivers can write there too. + * Note that this differs from PIDPATH that higher-privileged daemons, such + * as upsmon, tend to use. + */ const char * altpidpath(void) { + const char * path; + + if ((path = getenv("NUT_ALTPIDPATH")) == NULL) + path = getenv("NUT_STATEPATH"); + + if (path != NULL) + return path; + #ifdef ALTPIDPATH return ALTPIDPATH; #else - return dflt_statepath(); +/* We assume, here and elsewhere, that at least STATEPATH is always defined */ + return STATEPATH; #endif } From f7f9dfe6a9283b903ee85b20d03f46d0c972dd85 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 6 Sep 2017 08:35:39 +0200 Subject: [PATCH 03/26] common.c : dflt_statepath() / altpidpath() : support defined-but-empty envvars to have same effect as not-defined --- common/common.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common/common.c b/common/common.c index cfdc7786fe..85f871880a 100644 --- a/common/common.c +++ b/common/common.c @@ -369,7 +369,8 @@ const char * dflt_statepath(void) { const char * path; - if ((path = getenv("NUT_STATEPATH")) == NULL) + path = getenv("NUT_STATEPATH"); + if ( (path == NULL) || (*path == '\0') ) path = STATEPATH; return path; @@ -385,10 +386,11 @@ const char * altpidpath(void) { const char * path; - if ((path = getenv("NUT_ALTPIDPATH")) == NULL) + path = getenv("NUT_ALTPIDPATH"); + if ( (path == NULL) || (*path == '\0') ) path = getenv("NUT_STATEPATH"); - if (path != NULL) + if ( (path != NULL) && (*path != '\0') ) return path; #ifdef ALTPIDPATH From 09ac80a1a7881ca540f4e95bbf026ddb14b7f36a Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 17 Sep 2017 19:37:57 +0200 Subject: [PATCH 04/26] configure.ac : look for CPPUNIT after detecting pkg-config presence, can help vs. issue #478 --- configure.ac | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index 063278c0ba..967019f129 100644 --- a/configure.ac +++ b/configure.ac @@ -155,18 +155,6 @@ AC_CHECK_FUNCS(vsnprintf snprintf, [], [ AC_REPLACE_FUNCS(setenv strerror atexit) -dnl -dnl Tests for CppUnit availability and usability -dnl Using CppUnit implies C++ support! -dnl Theoretically, libcppunit-dev will pull up to g++, through libstdc++... -dnl AM_PATH_CPPUNIT(1.9.6) - -PKG_CHECK_MODULES(CPPUNIT, cppunit, have_cppunit=yes, have_cppunit=no) -if test "${have_cppunit}" != "yes" ; then - AC_MSG_WARN([libcppunit not found.]) -fi -AM_CONDITIONAL(HAVE_CPPUNIT, test "${have_cppunit}" = "yes") - dnl dnl Only use these when compiling with gcc dnl @@ -1218,6 +1206,18 @@ else fi AM_CONDITIONAL(HAVE_SYSTEMD, test "$systemdsystemunitdir" != "") +dnl +dnl Tests for CppUnit availability and usability +dnl Using CppUnit implies C++ support! +dnl Theoretically, libcppunit-dev will pull up to g++, through libstdc++... +dnl AM_PATH_CPPUNIT(1.9.6) + +PKG_CHECK_MODULES(CPPUNIT, cppunit, have_cppunit=yes, have_cppunit=no) +if test "${have_cppunit}" != "yes" ; then + AC_MSG_WARN([libcppunit not found.]) +fi +AM_CONDITIONAL(HAVE_CPPUNIT, test "${have_cppunit}" = "yes") + AC_MSG_CHECKING(whether to install Augeas configuration-management lenses) AC_ARG_WITH(augeas-lenses-dir, AS_HELP_STRING([--with-augeas-lenses-dir=PATH], [where to install Augeas configuration-management lenses (/usr/share/augeas/lenses{/dist,/})]), From 418e36bd16156453504201092e368fa8f1ec751a Mon Sep 17 00:00:00 2001 From: Spiros Ioannou Date: Thu, 21 Sep 2017 07:41:17 -0400 Subject: [PATCH 05/26] phoenixcontact_modbus: fix stale data detection Also mark driver as DRV_BETA Source: http://lists.alioth.debian.org/pipermail/nut-upsdev/2017-September/007331.html --- drivers/phoenixcontact_modbus.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/phoenixcontact_modbus.c b/drivers/phoenixcontact_modbus.c index 84f5a2ea0d..a9b112b6a1 100644 --- a/drivers/phoenixcontact_modbus.c +++ b/drivers/phoenixcontact_modbus.c @@ -40,7 +40,7 @@ upsdrv_info_t upsdrv_info = { DRIVER_NAME, DRIVER_VERSION, "Spiros Ioannou \n", - DRV_EXPERIMENTAL, + DRV_BETA, {NULL} }; @@ -57,6 +57,8 @@ void upsdrv_initinfo(void) void upsdrv_updateinfo(void) { + errcount = 0; + upsdebugx(2, "upsdrv_updateinfo"); uint16_t tab_reg[64]; @@ -107,6 +109,9 @@ void upsdrv_updateinfo(void) alarm_set("Inconsistent technology"); if (CHECK_BIT(tab_reg[0], 11)) alarm_set("Overload Cutoff"); + /* We don't use those low-battery indicators below. + * No info or configuration exists for those alarm low-bat + */ if (CHECK_BIT(tab_reg[0], 12)) alarm_set("Low Battery (Voltage)"); if (CHECK_BIT(tab_reg[0], 13)) @@ -115,11 +120,14 @@ void upsdrv_updateinfo(void) alarm_set("Low Battery (Time)"); if (CHECK_BIT(tab_reg[0], 16)) alarm_set("Low Battery (Service)"); - alarm_commit(); - status_commit(); - if (errcount == 0) + if (errcount == 0) { + alarm_commit(); + status_commit(); dstate_dataok(); + } + else + dstate_datastale(); } @@ -168,6 +176,7 @@ void upsdrv_cleanup(void) } } +/* Modbus Read Input Registers */ static int mrir(modbus_t * ctx, int addr, int nb, uint16_t * dest) { int r; @@ -176,6 +185,5 @@ static int mrir(modbus_t * ctx, int addr, int nb, uint16_t * dest) upslogx(LOG_ERR, "mrir: modbus_read_input_registers(addr:%d, count:%d): %s (%s)", addr, nb, modbus_strerror(errno), device_path); errcount++; } - errcount = 0; return r; } From 4a7c5d003cae22435805545e62b190a6d3752de4 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 17 Sep 2017 20:09:32 +0200 Subject: [PATCH 06/26] Improve configure script and recipe for CPPUNIT and C++11 detection * Detect C++11 support and its use for CPPUNIT tests through configure.ac - should address issue #472 * Report after detecting C++11 support, presence of libcppunit, and request for valgrind, whether we'd build the cppunit tests * Update relevant comments in configure.ac --- configure.ac | 64 +++++++++++++++++++++++++++++++++++++++++++---- tests/Makefile.am | 6 +---- 2 files changed, 60 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 967019f129..620ffdb250 100644 --- a/configure.ac +++ b/configure.ac @@ -104,10 +104,12 @@ AC_CONFIG_LIBOBJ_DIR([common]) dnl +------------------------------------------------------------------- AC_PROG_CC +AC_PROG_CC_C99 dnl Needed for per-target flags AM_PROG_CC_C_O AC_PROG_CPP AC_PROG_CXX +AC_PROG_CXX_C_O AC_PROG_INSTALL AC_PROG_MKDIR_P AC_PROG_LN_S @@ -1207,16 +1209,61 @@ fi AM_CONDITIONAL(HAVE_SYSTEMD, test "$systemdsystemunitdir" != "") dnl -dnl Tests for CppUnit availability and usability +dnl Tests for CppUnit availability and usability (will be built if we can, +dnl and if valgrind is enabled for this configuration - reported below). dnl Using CppUnit implies C++ support! dnl Theoretically, libcppunit-dev will pull up to g++, through libstdc++... dnl AM_PATH_CPPUNIT(1.9.6) -PKG_CHECK_MODULES(CPPUNIT, cppunit, have_cppunit=yes, have_cppunit=no) -if test "${have_cppunit}" != "yes" ; then - AC_MSG_WARN([libcppunit not found.]) -fi +dnl # Tests with gcc-4.8 require this C++11 option to be provided explicitly +dnl # gcc-4.6 does not support this yet; newer gcc's should be ok by default. +dnl # Could use `AX_CXX_COMPILE_STDCXX_11([noext], [optional])` if it were +dnl # available everywhere. Or AX_CHECK_COMPILE_FLAG if it was ubiquitous: +dnl ###AX_CHECK_COMPILE_FLAG([-std=c++11], +dnl ### [CXXFLAGS="$CXXFLAGS -std=c++11" +dnl ### HAVE_CXX11=1], +dnl ### [HAVE_CXX11=0]) + +AC_MSG_CHECKING(for C++11 support in current compiler) +my_CXXFLAGS="$CXXFLAGS" +AC_LANG_PUSH([C++]) + +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include +#if __cplusplus < 201103L + #error This library needs at least a C++11 compliant compiler +#endif +]], [[printf("%ld\n", __cplusplus);]]) +], + [AC_MSG_RESULT([yes, out of the box]) + HAVE_CXX11=1], + [CXXFLAGS="$CXXFLAGS -std=c++11" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include +#if __cplusplus < 201103L + #error This library needs at least a C++11 compliant compiler +#endif + ]], [[printf("%ld\n", __cplusplus);]]) + ], + [AC_MSG_RESULT([yes, GCC-style]) + HAVE_CXX11=1], + [AC_MSG_RESULT([no]) + CXXFLAGS="$my_CXXFLAGS" + HAVE_CXX11=0])]) +AC_LANG_POP([C++]) + +have_cppunit="no" +CPPUNIT_NUT_CXXFLAGS="" +AS_IF([test "${HAVE_CXX11}" = 1], + [PKG_CHECK_MODULES(CPPUNIT, cppunit, have_cppunit=yes, have_cppunit=no) + if test "${have_cppunit}" != "yes" ; then + AC_MSG_WARN([libcppunit not found - those C++ tests will not be built.]) + else + AS_IF([test -n "$CXX"],[AS_IF([$CXX --version 2>&1 | grep 'Free Software Foundation' > /dev/null], + [CPPUNIT_NUT_CXXFLAGS="-g -O0"])]) + fi]) AM_CONDITIONAL(HAVE_CPPUNIT, test "${have_cppunit}" = "yes") +AC_DEFINE_UNQUOTED(CPPUNIT_NUT_CXXFLAGS, $CPPUNIT_NUT_CXXFLAGS, [Compiler flags for cppunit tests]) AC_MSG_CHECKING(whether to install Augeas configuration-management lenses) AC_ARG_WITH(augeas-lenses-dir, @@ -1389,6 +1436,13 @@ fi AM_CONDITIONAL([HAVE_VALGRIND], [test "x${VALGRIND}" != "xnone"]) AM_CONDITIONAL([WITH_VALGRIND], [test "x${with_valgrind}" = "xyes"]) +AC_MSG_CHECKING([whether to build cppunit tests using valgrind support]) +if test "x${with_valgrind}" = xyes && test "x${have_cppunit}" = xyes ; then + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + dnl expand ${sysconfdir} and write it out conftemp="${sysconfdir}" eval conftemp=\"${conftemp}\" diff --git a/tests/Makefile.am b/tests/Makefile.am index e44bb084e8..5f39fac799 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,9 +1,5 @@ # Network UPS Tools: tests -# Tests with gcc-4.8 require this C++11 option to be provided explicitly -# gcc-4.6 does not support this yet; newer gcc's should be ok by default -CPPUNIT_NUT_CFLAGS = -g -O0 -std=c++11 - if HAVE_CPPUNIT TESTS = cppunittest @@ -15,7 +11,7 @@ check-local: $(check_PROGRAMS) RES=0; for P in $^ ; do $(VALGRIND) ./$$P || { RES=$$? ; echo "FAILED: $(VALGRIND) ./$$P" >&2; }; done; exit $$RES endif -cppunittest_CXXFLAGS = $(CPPUNIT_CFLAGS) $(CPPUNIT_NUT_CFLAGS) +cppunittest_CXXFLAGS = $(CPPUNIT_CFLAGS) $(CPPUNIT_CXXFLAGS) $(CPPUNIT_NUT_CXXFLAGS) $(CXXFLAGS) cppunittest_LDFLAGS = $(CPPUNIT_LIBS) cppunittest_LDADD = ../clients/libnutclient.la From 4467dd06b820ad6cab6609d34ab795d842ca7709 Mon Sep 17 00:00:00 2001 From: Charles Lepple Date: Sun, 8 Oct 2017 20:28:56 -0400 Subject: [PATCH 07/26] dummy-ups: last state should be "OB LB" to match text Also corrected a typo. --- docs/man/dummy-ups.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/man/dummy-ups.txt b/docs/man/dummy-ups.txt index 5723df49db..4b4d4d16f7 100644 --- a/docs/man/dummy-ups.txt +++ b/docs/man/dummy-ups.txt @@ -33,7 +33,7 @@ Repeater Mode In this mode, *dummy-ups* acts as a NUT client, simply forwarding data. This can be useful for supervision purposes. This mode can also allow some load sharing between several `upsd` instances communicating with ultimate -NUT clients, wit a "central" one using a point-to-point communication with +NUT clients, with a "central" one using a point-to-point communication with the UPS. This arrangement can also help with networked UPSes, whose network management cards can be overwhelmed with a farm of servers directly polling SNMP or other protocols every few seconds. @@ -87,7 +87,7 @@ between "OL", "OB" and "OB LB" every minute: TIMER 60 ups.status: OB TIMER 60 - ups.status: LB + ups.status: OB LB TIMER 60 It is wise to end the script with a `TIMER` keyword. Otherwise *dummy-ups* From 715120929f663f930c72669daa133657f400559e Mon Sep 17 00:00:00 2001 From: Charles Lepple Date: Sun, 8 Oct 2017 20:31:38 -0400 Subject: [PATCH 08/26] tripplite_usb: update man page * Fix link to tripplitesu(8) * Add 3005 protocol * Update protocol variable name --- docs/man/tripplite_usb.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/man/tripplite_usb.txt b/docs/man/tripplite_usb.txt index 1d67caafac..30f9430bcc 100644 --- a/docs/man/tripplite_usb.txt +++ b/docs/man/tripplite_usb.txt @@ -20,9 +20,9 @@ the devices supported by tripplite_usb have product ID 0001, and the newer units (such as those with "LCD" in the model name) with product ID 2001 require the linkman:usbhid-ups[8] driver instead. Please report success or failure to the nut-upsuser mailing list. A key piece of information is the protocol -number, returned in `ups.debug.0`. Also, be sure to turn on debugging ('-DDD') +number, returned in `ups.firmware.aux`. Also, be sure to turn on debugging ('-DDD') for more informative log messages. If your Tripp Lite UPS uses a serial port, -you may wish to investigate the linkman:tripplite[8] or linkman:tripplite_su[8] +you may wish to investigate the linkman:tripplite[8] or linkman:tripplitesu[8] driver. This driver has been tested with the following models: @@ -43,6 +43,7 @@ following protocols: * Protocol 1001 * Protocol 2001 * Protocol 3003 + * Protocol 3005 On the other hand, if the web page for your UPS on the Tripp-Lite website says "HID-compliant USB port also enables direct integration with built-in power From 30a711a81f5f817ff02340cc8ec1d47064a7b8c9 Mon Sep 17 00:00:00 2001 From: Charles Lepple Date: Sun, 8 Oct 2017 20:40:19 -0400 Subject: [PATCH 09/26] belkin/belkinunv: add links to man pages for other Belkin drivers --- docs/man/belkin.txt | 11 +++++++++++ docs/man/belkinunv.txt | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/docs/man/belkin.txt b/docs/man/belkin.txt index 495201e8cf..5ddeb7f5c6 100644 --- a/docs/man/belkin.txt +++ b/docs/man/belkin.txt @@ -20,6 +20,10 @@ Other similar models such as the 425 and 625 should also work. The Trust UPS and older Belkin units are not supported. +This driver only supports serial connections. If your UPS has a USB port, +please consult the Hardware Compatibility List (HCL) to see which of the USB +drivers you should use. + EXTRA ARGUMENTS --------------- @@ -44,6 +48,13 @@ The core driver: ~~~~~~~~~~~~~~~~ linkman:nutupsdrv[8] +Other Belkin drivers: +~~~~~~~~~~~~~~~~~~~~~ +linkman:belkinunv[8], +linkman:blazer_ser[8], +linkman:blazer_usb[8], +linkman:usbhid-ups[8] + Internet resources: ~~~~~~~~~~~~~~~~~~~ The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/belkinunv.txt b/docs/man/belkinunv.txt index cc8bb995e1..893b7b85b1 100644 --- a/docs/man/belkinunv.txt +++ b/docs/man/belkinunv.txt @@ -12,6 +12,10 @@ This man page only documents the hardware-specific features of the belkin driver. For information about the core driver, see linkman:nutupsdrv[8]. +This driver only supports serial connections. If your UPS has a USB port, +please consult the Hardware Compatibility List (HCL) to see which of the USB +drivers you should use. + SUPPORTED HARDWARE ------------------ The belkinunv driver is known to work with the Belkin Universal UPS @@ -330,6 +334,13 @@ The core driver: ~~~~~~~~~~~~~~~~ linkman:nutupsdrv[8] +Other Belkin drivers: +~~~~~~~~~~~~~~~~~~~~~ +linkman:belkinunv[8], +linkman:blazer_ser[8], +linkman:blazer_usb[8], +linkman:usbhid-ups[8] + Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ From 80f6d20c569ea764f51b2299bf8393bc0e61b836 Mon Sep 17 00:00:00 2001 From: Charles Lepple Date: Sun, 8 Oct 2017 20:45:15 -0400 Subject: [PATCH 10/26] powerpanel: emphasize that this driver is serial-only Apparently, the PowerPanel Plus vendor tool also has USB support. --- docs/man/powerpanel.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/man/powerpanel.txt b/docs/man/powerpanel.txt index 6ba2b6ea66..1cfe18cdb9 100644 --- a/docs/man/powerpanel.txt +++ b/docs/man/powerpanel.txt @@ -4,7 +4,7 @@ POWERPANEL(8) NAME ---- -powerpanel - Driver for PowerPanel Plus compatible UPS equipment +powerpanel - Driver for serial PowerPanel Plus compatible UPS equipment NOTE ---- @@ -18,6 +18,10 @@ This driver supports CyberPower BC1200, PR2200 and many other similar devices, both for the text and binary protocols. The driver will autodetect which protocol is used. +If your Cyber Power Systems UPS has a USB port, you may wish to use the +linkman:usbhid-ups[8] driver. The linkman:snmp-ups[8] driver supports several +network cards via SNMP. + EXTRA ARGUMENTS --------------- This driver supports the following optional settings in linkman:ups.conf[5]: @@ -133,6 +137,11 @@ The core driver: ~~~~~~~~~~~~~~~~ linkman:nutupsdrv[8] +Other drivers: +~~~~~~~~~~~~~~ +linkman:usbhid-ups[8], +linkman:snmp-ups[8] + Internet resources: ~~~~~~~~~~~~~~~~~~~ The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ From 2c4d731ce9922e0b5e7ad34dc51762a1e63515dd Mon Sep 17 00:00:00 2001 From: Charles Lepple Date: Sun, 8 Oct 2017 21:54:54 -0400 Subject: [PATCH 11/26] hid-subdrivers.txt: clarify Tripp-Lite USB reference Closes: https://github.com/networkupstools/nut/issues/452 --- docs/hid-subdrivers.txt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/hid-subdrivers.txt b/docs/hid-subdrivers.txt index 1ec731d4fb..52b565721c 100644 --- a/docs/hid-subdrivers.txt +++ b/docs/hid-subdrivers.txt @@ -9,9 +9,9 @@ different classes (audio, imaging, mass storage etc). Almost all UPS devices belong to the "HID" class, which means "Human Interface Device", and also includes things like keyboards and mice. What HID devices have in common is a particular (and very flexible) interface -for reading and writing information (such as x/y coordinates and -button states, in case of a mouse, or voltages and status information, -in case of a UPS). +for reading and writing information (such as X/Y coordinates and +button states, in the case of a mouse, or voltages and status information, +in the case of a UPS). The NUT "usbhid-ups" driver is a meta-driver that handles all HID UPS devices. It consists of a core driver that handles most of the work of @@ -20,13 +20,14 @@ specific UPS manufacturers (MGE, APC, and Belkin are currently supported). Adding support for a new HID UPS device is easy, because it requires only the creation of a new sub-driver. -There are a few USB UPS devices that are not HID devices. These +There are a few USB UPS devices that are not true HID devices. These devices typically implement some version of the manufacturer's serial protocol over USB (which is a really dumb idea, by the way). An -example is the Tripplite USB. Such devices are *not* supported by the -usbhid-ups driver, and are not covered in this document. If you need to -add support for such a device, read new-drivers.txt and see the -tripplite_usb driver for inspiration. +example is the original Tripplite USB interface (USB idProduct = 0001). Its HID +descriptor is only 52 bytes long (compared to several hundred bytes for a true +PDC HID UPS). Such devices are *not* supported by the usbhid-ups driver, and +are not covered in this document. If you need to add support for such a device, +read new-drivers.txt and see the "tripplite_usb" driver for inspiration. HID Usage Tree ~~~~~~~~~~~~~~ From 5c9b57f105f5e81334450c378499bbb0c8ec74e4 Mon Sep 17 00:00:00 2001 From: Charles Lepple Date: Sun, 8 Oct 2017 22:08:36 -0400 Subject: [PATCH 12/26] hid-subdrivers.txt: fix explore command line Also reformat some surrounding text. Closes: https://github.com/networkupstools/nut/issues/436 --- docs/hid-subdrivers.txt | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/docs/hid-subdrivers.txt b/docs/hid-subdrivers.txt index 52b565721c..2a1b79e1ff 100644 --- a/docs/hid-subdrivers.txt +++ b/docs/hid-subdrivers.txt @@ -133,7 +133,7 @@ Writing a subdriver In preparation for writing a subdriver for a device that is currently unsupported, run usbhid-ups with the following command line: - drivers/usbhid-ups -DD -u root -x explore -x vendorid=XXXX auto + drivers/usbhid-ups -DD -u root -x explore -x vendorid=XXXX -x port=auto -s ups (substitute your device's 4-digit VendorID instead of "XXXX"). This will produce a bunch of debugging information, including a number @@ -141,12 +141,14 @@ of lines starting with "Path:" that describe the device's usage tree. This information forms the initial basis for a new subdriver. You should save this information to a file, e.g. - drivers/usbhid-ups -DD -u root -x explore -x vendorid=XXXX auto >& /tmp/info + + drivers/usbhid-ups -DD -u root -x explore -x vendorid=XXXX \ + -x port=auto -s ups 2>&1 | tee /tmp/info You can create an initial "stub" subdriver for your device by using script scripts/subdriver/gen-usbhid-subdriver.sh. Note: this only creates a "stub" and needs to be further customized to be useful (see -CUSTOMIZATION below). +"Customization" below). Use the script as follows: @@ -161,14 +163,18 @@ and digits, and use natural capitalization such as "Belkin" (not information. You should put the generated files into the drivers/ subdirectory, and -update usbhid-ups.c by adding the appropriate #include line and by -updating the definition of subdriver_list in usbhid-ups.c. You must -also add the subdriver to USBHID_UPS_SUBDRIVERS in drivers/Makefile.am -and call "autoreconf" and/or "./configure" from the top level NUT directory. -You can then recompile usbhid-ups, and start experimenting with the new +update `usbhid-ups.c` by adding the appropriate `#include` line and by +updating the definition of `subdriver_list` in `usbhid-ups.c`. You must +also add the subdriver to USBHID_UPS_SUBDRIVERS in `drivers/Makefile.am` +and call `autoreconf` and/or `./configure` from the top-level NUT directory. +You can then recompile `usbhid-ups`, and start experimenting with the new subdriver. -CUSTOMIZATION: The initially generated subdriver code is only a stub, + +Customization +~~~~~~~~~~~~~ + +The initially generated subdriver code is only a stub, and will not implement any useful functionality (in particular, it will be unable to shut down the UPS). In the beginning, it simply attempts to monitor some UPS variables. To make this driver useful, @@ -176,7 +182,7 @@ you must examine the NUT variables of the form "unmapped.*" in the hid_info_t data structure, and map them to actual NUT variables and instant commands. There are currently no step-by-step instructions for how to do this. Please look at the files to see how the currently implemented -subdrivers are written.: +subdrivers are written: - apc-hid.c/h - belkin-hid.c/h From e94d741d3049189ea07f3cafd7fa0b6c8ef1eda0 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 11 Oct 2017 08:02:37 +0200 Subject: [PATCH 13/26] eaton-pdu-marlin-mib.c : line-breaks for readability and 80-col standard --- drivers/eaton-pdu-marlin-mib.c | 476 ++++++++++++++++++++++----------- 1 file changed, 323 insertions(+), 153 deletions(-) diff --git a/drivers/eaton-pdu-marlin-mib.c b/drivers/eaton-pdu-marlin-mib.c index bd1f623974..fffa45b611 100644 --- a/drivers/eaton-pdu-marlin-mib.c +++ b/drivers/eaton-pdu-marlin-mib.c @@ -258,23 +258,31 @@ static snmp_info_t eaton_marlin_mib[] = { */ /* Note: the below gives the number of input, not the number of phase(s)! */ /* inputCount.0; Value (Integer): 1 - { "input.phases", 0, 1, ".1.3.6.1.4.1.534.6.6.7.1.2.1.20.0", NULL, SU_FLAG_STATIC | SU_FLAG_SETINT, NULL, &input_phases }, */ + { "input.phases", 0, 1, ".1.3.6.1.4.1.534.6.6.7.1.2.1.20.0", + NULL, SU_FLAG_STATIC | SU_FLAG_SETINT, NULL, &input_phases }, */ /* Note: for daisychain mode, we must handle phase(s) per device, not as a whole */ /* inputType.%i.1 = INTEGER: singlePhase (1) */ - { "input.phases", 0, 1, ".1.3.6.1.4.1.534.6.6.7.3.1.1.2.%i.1", NULL, SU_FLAG_STATIC, &marlin_input_type_info[0], NULL }, + { "input.phases", 0, 1, ".1.3.6.1.4.1.534.6.6.7.3.1.1.2.%i.1", + NULL, SU_FLAG_STATIC, &marlin_input_type_info[0], NULL }, /* Frequency is measured globally */ { "input.frequency", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.3.1.1.3.%i.1", NULL, 0, NULL, NULL }, - { "input.frequency.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.1.1.4.%i.1", NULL, SU_FLAG_OK, &marlin_threshold_frequency_status_info[0], NULL }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.1.1.4.%i.1", NULL, SU_FLAG_OK, &marlin_threshold_frequency_alarm_info[0], NULL }, + { "input.frequency.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.1.1.4.%i.1", + NULL, SU_FLAG_OK, &marlin_threshold_frequency_status_info[0], NULL }, + { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.1.1.4.%i.1", + NULL, SU_FLAG_OK, &marlin_threshold_frequency_alarm_info[0], NULL }, /* inputCurrentPercentLoad (measured globally) * Current percent load, based on the rated current capacity */ /* FIXME: input.load is mapped on input.L1.load for both single and 3phase !!! */ - { "input.load", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.3.1.11.%i.1.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "input.L1.load", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.3.1.11.%i.1.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "input.L2.load", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.3.1.11.%i.1.2", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "input.L3.load", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.3.1.11.%i.1.3", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "input.load", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.3.1.11.%i.1.1", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "input.L1.load", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.3.1.11.%i.1.1", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "input.L2.load", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.3.1.11.%i.1.2", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "input.L3.load", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.3.1.11.%i.1.3", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, /* FIXME: * - Voltage is only measured per phase, as mV! @@ -285,117 +293,205 @@ static snmp_info_t eaton_marlin_mib[] = { * INTEGER {singlePhase (1),phase1toN (2),phase2toN (3),phase3toN (4),phase1to2 (5),phase2to3 (6),phase3to1 (7) * => RFC input.Lx.voltage.context */ { "input.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.%i.1.1", NULL, 0, NULL, NULL }, - { "input.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.1", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.1", NULL, SU_FLAG_OK, &marlin_threshold_voltage_alarms_info[0], NULL }, - { "input.voltage.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.voltage.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.voltage.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.voltage.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.1", + NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, + { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.1", + NULL, SU_FLAG_OK, &marlin_threshold_voltage_alarms_info[0], NULL }, + { "input.voltage.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.%i.1.1", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.voltage.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.%i.1.1", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.voltage.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.%i.1.1", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.voltage.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.%i.1.1", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, { "input.L1.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.%i.1.1", NULL, 0, NULL, NULL }, - { "input.L1.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.1", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, - { "L1.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.1", NULL, SU_FLAG_OK, &marlin_threshold_voltage_alarms_info[0], NULL }, - { "input.L1.voltage.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L1.voltage.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L1.voltage.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L1.voltage.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L1.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.1", + NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, + { "L1.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.1", + NULL, SU_FLAG_OK, &marlin_threshold_voltage_alarms_info[0], NULL }, + { "input.L1.voltage.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.%i.1.1", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L1.voltage.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.%i.1.1", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L1.voltage.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.%i.1.1", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L1.voltage.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.%i.1.1", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, { "input.L2.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.%i.1.2", NULL, 0, NULL, NULL }, - { "input.L2.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.2", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, - { "L2.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.2", NULL, SU_FLAG_OK, &marlin_threshold_voltage_alarms_info[0], NULL }, - { "input.L2.voltage.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.%i.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L2.voltage.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.%i.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L2.voltage.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.%i.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L2.voltage.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.%i.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L2.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.2", + NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, + { "L2.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.2", + NULL, SU_FLAG_OK, &marlin_threshold_voltage_alarms_info[0], NULL }, + { "input.L2.voltage.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.%i.1.2", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L2.voltage.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.%i.1.2", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L2.voltage.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.%i.1.2", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L2.voltage.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.%i.1.2", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, { "input.L3.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.%i.1.3", NULL, 0, NULL, NULL }, - { "input.L3.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.3", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, - { "L3.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.3", NULL, SU_FLAG_OK, &marlin_threshold_voltage_alarms_info[0], NULL }, - { "input.L3.voltage.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.%i.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L3.voltage.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.%i.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L3.voltage.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.%i.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L3.voltage.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.%i.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L3.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.3", + NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, + { "L3.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.3", + NULL, SU_FLAG_OK, &marlin_threshold_voltage_alarms_info[0], NULL }, + { "input.L3.voltage.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.%i.1.3", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L3.voltage.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.%i.1.3", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L3.voltage.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.%i.1.3", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L3.voltage.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.%i.1.3", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, /* FIXME: * - input.current is mapped on input.L1.current for both single and 3phase !!! */ - { "input.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.%i.1.1", NULL, 0, NULL, NULL }, - { "input.current.nominal", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.%i.1.1", NULL, 0, NULL, NULL }, - { "input.current.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.1", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.1", NULL, SU_FLAG_OK, &marlin_threshold_current_alarms_info[0], NULL }, - { "input.current.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.current.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.current.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.current.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.%i.1.1", + NULL, 0, NULL, NULL }, + { "input.current.nominal", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.%i.1.1", + NULL, 0, NULL, NULL }, + { "input.current.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.1", + NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, + { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.1", + NULL, SU_FLAG_OK, &marlin_threshold_current_alarms_info[0], NULL }, + { "input.current.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.%i.1.1", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.current.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.%i.1.1", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.current.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.%i.1.1", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.current.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.%i.1.1", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, { "input.L1.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.0.1.1", NULL, 0, NULL, NULL }, - { "input.L1.current.nominal", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.%i.1.1", NULL, 0, NULL, NULL }, - { "input.L1.current.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.1", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, - { "L1.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.1", NULL, SU_FLAG_OK, &marlin_threshold_current_alarms_info[0], NULL }, - { "input.L1.current.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L1.current.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L1.current.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L1.current.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L1.current.nominal", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.%i.1.1", + NULL, 0, NULL, NULL }, + { "input.L1.current.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.1", + NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, + { "L1.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.1", + NULL, SU_FLAG_OK, &marlin_threshold_current_alarms_info[0], NULL }, + { "input.L1.current.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.%i.1.1", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L1.current.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.%i.1.1", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L1.current.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.%i.1.1", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L1.current.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.%i.1.1", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, { "input.L2.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.%i.1.2", NULL, 0, NULL, NULL }, - { "input.L2.current.nominal", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.%i.1.2", NULL, 0, NULL, NULL }, - { "input.L2.current.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.2", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, - { "L2.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.2", NULL, SU_FLAG_OK, &marlin_threshold_current_alarms_info[0], NULL }, - { "input.L2.current.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.%i.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L2.current.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.%i.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L2.current.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.%i.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L2.current.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.%i.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L2.current.nominal", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.%i.1.2", + NULL, 0, NULL, NULL }, + { "input.L2.current.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.2", + NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, + { "L2.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.2", + NULL, SU_FLAG_OK, &marlin_threshold_current_alarms_info[0], NULL }, + { "input.L2.current.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.%i.1.2", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L2.current.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.%i.1.2", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L2.current.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.%i.1.2", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L2.current.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.%i.1.2", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, { "input.L3.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.%i.1.3", NULL, 0, NULL, NULL }, - { "input.L3.current.nominal", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.%i.1.3", NULL, 0, NULL, NULL }, - { "input.L3.current.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.3", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, - { "L3.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.3", NULL, SU_FLAG_OK, &marlin_threshold_current_alarms_info[0], NULL }, - { "input.L3.current.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.%i.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L3.current.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.%i.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L3.current.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.%i.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L3.current.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.%i.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L3.current.nominal", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.%i.1.3", + NULL, 0, NULL, NULL }, + { "input.L3.current.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.3", + NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, + { "L3.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.3", + NULL, SU_FLAG_OK, &marlin_threshold_current_alarms_info[0], NULL }, + { "input.L3.current.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.%i.1.3", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L3.current.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.%i.1.3", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L3.current.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.%i.1.3", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "input.L3.current.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.%i.1.3", + NULL, SU_FLAG_NEGINVALID, NULL, NULL }, /* Sum of all phases realpower, valid for Shark 1ph/3ph only */ - { "input.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.5.1.4.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_UNIQUE | SU_FLAG_OK, NULL, NULL }, + { "input.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.5.1.4.%i.1", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_UNIQUE | SU_FLAG_OK, NULL, NULL }, /* Fallback 1: Sum of all phases realpower, valid for Marlin 3ph only */ - { "input.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.4.%i.1.4", NULL, SU_FLAG_NEGINVALID | SU_FLAG_UNIQUE | SU_FLAG_OK, NULL, NULL }, + { "input.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.4.%i.1.4", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_UNIQUE | SU_FLAG_OK, NULL, NULL }, /* Fallback 2: Sum of the phase realpower, valid for Marlin 1ph only */ - { "input.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.4.%i.1.2", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "input.L1.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.4.%i.1.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "input.L2.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.4.%i.1.2", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "input.L3.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.4.%i.1.3", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "input.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.4.%i.1.2", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "input.L1.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.4.%i.1.1", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "input.L2.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.4.%i.1.2", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "input.L3.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.4.%i.1.3", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, /* Sum of all phases apparent power, valid for Shark 1ph/3ph only */ - { "input.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.5.1.3.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_UNIQUE | SU_FLAG_OK, NULL, NULL }, + { "input.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.5.1.3.%i.1", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_UNIQUE | SU_FLAG_OK, NULL, NULL }, /* Fallback 1: Sum of all phases realpower, valid for Marlin 3ph only */ - { "input.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.%i.1.4", NULL, SU_FLAG_NEGINVALID | SU_FLAG_UNIQUE | SU_FLAG_OK, NULL, NULL }, + { "input.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.%i.1.4", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_UNIQUE | SU_FLAG_OK, NULL, NULL }, /* Fallback 2: Sum of the phase realpower, valid for Marlin 1ph only */ - { "input.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.%i.1.2", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "input.L1.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.%i.1.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "input.L2.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.%i.1.2", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "input.L3.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.%i.1.3", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "input.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.%i.1.2", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "input.L1.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.%i.1.1", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "input.L2.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.%i.1.2", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "input.L3.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.%i.1.3", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, /* Ambient collection */ - { "ambient.present", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.1.1.3.%i.1", NULL, SU_FLAG_OK, &marlin_ambient_presence_info[0], NULL }, - { "ambient.temperature.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.1.1.5.%i.1", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.1.1.5.%i.1", NULL, SU_FLAG_OK, &marlin_threshold_temperature_alarms_info[0], NULL }, - { "ambient.temperature", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.4.%i.1", NULL, SU_FLAG_OK, NULL, NULL }, + { "ambient.present", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.1.1.3.%i.1", + NULL, SU_FLAG_OK, &marlin_ambient_presence_info[0], NULL }, + { "ambient.temperature.status", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.7.1.1.5.%i.1", + NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, + { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.1.1.5.%i.1", + NULL, SU_FLAG_OK, &marlin_threshold_temperature_alarms_info[0], NULL }, + { "ambient.temperature", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.4.%i.1", + NULL, SU_FLAG_OK, NULL, NULL }, /* Low and high threshold use the respective critical levels */ - { "ambient.temperature.low", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.7.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "ambient.temperature.low.critical", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.7.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "ambient.temperature.low.warning", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.6.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "ambient.temperature.high", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.9.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "ambient.temperature.high.warning", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.8.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "ambient.temperature.high.critical", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.9.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "ambient.humidity.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.2.1.5.%i.1", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.2.1.5.%i.1", NULL, SU_FLAG_OK, &marlin_threshold_humidity_alarms_info[0], NULL }, - { "ambient.humidity", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.4.%i.1", NULL, SU_FLAG_OK, NULL, NULL }, + { "ambient.temperature.low", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.7.%i.1", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "ambient.temperature.low.critical", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.7.%i.1", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "ambient.temperature.low.warning", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.6.%i.1", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "ambient.temperature.high", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.9.%i.1", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "ambient.temperature.high.warning", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.8.%i.1", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "ambient.temperature.high.critical", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.9.%i.1", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "ambient.humidity.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.2.1.5.%i.1", + NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, + { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.2.1.5.%i.1", + NULL, SU_FLAG_OK, &marlin_threshold_humidity_alarms_info[0], NULL }, + { "ambient.humidity", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.4.%i.1", + NULL, SU_FLAG_OK, NULL, NULL }, /* Low and high threshold use the respective critical levels */ - { "ambient.humidity.low", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.7.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "ambient.humidity.low.warning", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.6.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "ambient.humidity.low.critical", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.7.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "ambient.humidity.high", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.9.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "ambient.humidity.high.warning", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.8.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "ambient.humidity.high.critical", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.9.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "ambient.humidity.low", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.7.%i.1", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "ambient.humidity.low.warning", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.6.%i.1", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "ambient.humidity.low.critical", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.7.%i.1", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "ambient.humidity.high", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.9.%i.1", NULL, + SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "ambient.humidity.high.warning", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.8.%i.1", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "ambient.humidity.high.critical", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.9.%i.1", + NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, /* Dry contacts on TH module */ - { "ambient.contacts.1.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.3.1.4.%i.1", NULL, SU_FLAG_OK, &marlin_ambient_drycontacts_info[0], NULL }, - { "ambient.contacts.2.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.3.1.4.%i.2", NULL, SU_FLAG_OK, &marlin_ambient_drycontacts_info[0], NULL }, + { "ambient.contacts.1.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.3.1.4.%i.1", + NULL, SU_FLAG_OK, &marlin_ambient_drycontacts_info[0], NULL }, + { "ambient.contacts.2.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.3.1.4.%i.2", + NULL, SU_FLAG_OK, &marlin_ambient_drycontacts_info[0], NULL }, /* Outlet collection */ { "outlet.id", 0, 1, NULL, "0", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, { "outlet.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, NULL, "All outlets", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, - { "outlet.count", 0, 1, ".1.3.6.1.4.1.534.6.6.7.1.2.1.22.%i", "0", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + { "outlet.count", 0, 1, ".1.3.6.1.4.1.534.6.6.7.1.2.1.22.%i", + "0", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, /* The below ones are the same as the input.* equivalent */ /* FIXME: transition period, TO BE REMOVED, moved to input.* */ { "outlet.frequency", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.3.1.1.3.%i.1", NULL, 0, NULL, NULL }, @@ -412,37 +508,65 @@ static snmp_info_t eaton_marlin_mib[] = { { "outlet.%i.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.6.1.2.%i.%i", NULL, SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, &marlin_outlet_status_info[0], NULL }, /* Numeric identifier of the outlet, tied to the whole unit */ - { "outlet.%i.id", 0, 1, NULL, "%i", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.id", 0, 1, NULL, "%i", + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, /* outletID: Outlet physical name, related to its number in the group - ex: 1rst outlet of the second group (B) is B1 */ - { "outlet.%i.name", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.1.1.2.%i.%i", NULL, SU_FLAG_STATIC | SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + * ex: first outlet of the second group (B) is B1 */ + { "outlet.%i.name", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.1.1.2.%i.%i", + NULL, SU_FLAG_STATIC | SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, /* FIXME: the last part of the OID gives the group number (i.e. %i.1 means "group 1") * Need to address that, without multiple declaration (%i.%i, SU_OUTLET | SU_OUTLET_GROUP)? */ - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.1", NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.2", NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.3", NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.4", NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.5", NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.6", NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.4.1.3.%i.%i", NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.current.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.4.1.4.%i.%i", NULL, SU_OUTLET | SU_TYPE_DAISY_1, &marlin_threshold_status_info[0], NULL }, - { "outlet.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.4.1.4.%i.%i", NULL, SU_OUTLET | SU_TYPE_DAISY_1, &marlin_threshold_current_alarms_info[0], NULL }, - { "outlet.%i.current.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.4.1.5.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.current.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.4.1.6.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.current.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.4.1.7.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.current.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.4.1.8.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.6.5.1.3.%i.%i", NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.3.1.2.%i.%i", NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.3.1.3.%i.%i", NULL, SU_OUTLET | SU_TYPE_DAISY_1, &marlin_threshold_status_info[0], NULL }, - { "outlet.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.3.1.3.%i.%i", NULL, SU_OUTLET | SU_TYPE_DAISY_1, &marlin_threshold_voltage_alarms_info[0], NULL }, - { "outlet.%i.voltage.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.3.1.4.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.voltage.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.3.1.5.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.voltage.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.3.1.6.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.voltage.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.3.1.7.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.6.5.1.2.%i.%i", NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.1", + NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.2", + NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.3", + NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.4", + NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.5", + NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.6", + NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.4.1.3.%i.%i", + NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.current.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.4.1.4.%i.%i", + NULL, SU_OUTLET | SU_TYPE_DAISY_1, &marlin_threshold_status_info[0], NULL }, + { "outlet.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.4.1.4.%i.%i", + NULL, SU_OUTLET | SU_TYPE_DAISY_1, &marlin_threshold_current_alarms_info[0], NULL }, + { "outlet.%i.current.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.4.1.5.%i.%i", + NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.current.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.4.1.6.%i.%i", + NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.current.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.4.1.7.%i.%i", + NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.current.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.4.1.8.%i.%i", + NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.6.5.1.3.%i.%i", + NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.3.1.2.%i.%i", + NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.3.1.3.%i.%i", + NULL, SU_OUTLET | SU_TYPE_DAISY_1, &marlin_threshold_status_info[0], NULL }, + { "outlet.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.3.1.3.%i.%i", + NULL, SU_OUTLET | SU_TYPE_DAISY_1, &marlin_threshold_voltage_alarms_info[0], NULL }, + { "outlet.%i.voltage.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.3.1.4.%i.%i", + NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.voltage.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.3.1.5.%i.%i", + NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.voltage.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.3.1.6.%i.%i", + NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.voltage.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.3.1.7.%i.%i", + NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.6.5.1.2.%i.%i", + NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, /* FIXME: handle non switchable units (only measurements), which do not expose this OID */ - { "outlet.%i.switchable", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.6.1.3.%i.%i", "no", SU_FLAG_STATIC | SU_OUTLET | SU_FLAG_OK | SU_TYPE_DAISY_1, &marlin_outlet_switchability_info[0], NULL }, - { "outlet.%i.type", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.1.1.5.%i.%i", "unknown", SU_FLAG_STATIC | SU_OUTLET | SU_TYPE_DAISY_1, &marlin_outlet_type_info[0], NULL }, + { "outlet.%i.switchable", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.6.1.3.%i.%i", + "no", SU_FLAG_STATIC | SU_OUTLET | SU_FLAG_OK | SU_TYPE_DAISY_1, + &marlin_outlet_switchability_info[0], NULL }, + { "outlet.%i.type", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.1.1.5.%i.%i", + "unknown", SU_FLAG_STATIC | SU_OUTLET | SU_TYPE_DAISY_1, &marlin_outlet_type_info[0], NULL }, + /* TODO: handle statistics * outletWh.0.1 @@ -450,53 +574,93 @@ static snmp_info_t eaton_marlin_mib[] = { */ /* Outlet groups collection */ - { "outlet.group.count", 0, 1, ".1.3.6.1.4.1.534.6.6.7.1.2.1.21.%i", "0", SU_FLAG_STATIC | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.count", 0, 1, ".1.3.6.1.4.1.534.6.6.7.1.2.1.21.%i", + "0", SU_FLAG_STATIC | SU_TYPE_DAISY_1, NULL, NULL }, /* outlet groups template definition * Indexes start from 1, ie outlet.group.1 => .1 */ /* Note: the first definition is used to determine the base index (ie 0 or 1) */ /* groupID.0.1 = OctetString: A */ - { "outlet.group.%i.id", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.1.1.2.%i.%i", NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.%i.id", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.1.1.2.%i.%i", + NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* groupName.0.1 = OctetString: Factory Group 1 */ /* FIXME: SU_FLAG_SEMI_STATIC or SU_FLAG_SETTING => refreshed from time to time or upon call to setvar */ - { "outlet.group.%i.name", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.1.1.3.%i.%i", NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.%i.name", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.5.1.1.3.%i.%i", + NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* groupType.0.1 = Integer: outletSection (4) */ - { "outlet.group.%i.type", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.1.1.4.%i.%i", NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, &marlin_outlet_group_type_info[0], NULL }, - { "outlet.group.%i.phase", 0, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.1.1.2.%i.%i", NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, &marlin_outlet_group_phase_info[0], NULL }, + { "outlet.group.%i.type", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.1.1.4.%i.%i", + NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, + &marlin_outlet_group_type_info[0], NULL }, + { "outlet.group.%i.phase", 0, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.1.1.2.%i.%i", + NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, + &marlin_outlet_group_phase_info[0], NULL }, /* groupControlStatus.0.1 = Integer: on (1) */ { "outlet.group.%i.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.6.1.2.%i.%i", - NULL, SU_FLAG_OK | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, &marlin_outletgroups_status_info[0], NULL }, + NULL, SU_FLAG_OK | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, + &marlin_outletgroups_status_info[0], NULL }, /* groupChildCount.0.1 = Integer: 12 */ - { "outlet.group.%i.count", 0, 1, ".1.3.6.1.4.1.534.6.6.7.5.1.1.6.%i.%i", NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.%i.count", 0, 1, ".1.3.6.1.4.1.534.6.6.7.5.1.1.6.%i.%i", + NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* groupVoltage.0.1 = Integer: 243080 */ - { "outlet.group.%i.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.3.1.3.%i.%i", NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.%i.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.3.1.3.%i.%i", + NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* groupVoltageThStatus.0.1 = Integer: good (0) */ - { "outlet.group.%i.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.3.1.4.%i.%i", NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, &marlin_threshold_status_info[0], NULL }, - { "outlet.group.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.3.1.4.%i.%i", NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, &marlin_threshold_voltage_alarms_info[0], NULL }, - { "outlet.group.%i.voltage.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.3.1.5.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.group.%i.voltage.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.3.1.6.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.group.%i.voltage.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.3.1.7.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.group.%i.voltage.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.3.1.8.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.%i.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.5.3.1.4.%i.%i", + NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, &marlin_threshold_status_info[0], NULL }, + { "outlet.group.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.5.3.1.4.%i.%i", + NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, &marlin_threshold_voltage_alarms_info[0], NULL }, + { "outlet.group.%i.voltage.low.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.5.3.1.5.%i.%i", + NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.%i.voltage.low.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.5.3.1.6.%i.%i", + NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.%i.voltage.high.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.5.3.1.7.%i.%i", + NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.%i.voltage.high.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.5.3.1.8.%i.%i", + NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* groupCurrent.0.1 = Integer: 0 */ - { "outlet.group.%i.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.4.1.3.%i.%i", NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.%i.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.4.1.3.%i.%i", + NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* groupCurrentCapacity.0.1 = Integer: 16000 */ - { "outlet.group.%i.current.nominal", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.4.1.2.%i.%i", NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.%i.current.nominal", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.4.1.2.%i.%i", + NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* groupCurrentThStatus.0.1 = Integer: good (0) */ - { "outlet.group.%i.current.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.4.1.4.%i.%i", NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, &marlin_threshold_status_info[0], NULL }, - { "outlet.group.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.4.1.4.%i.%i", NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, &marlin_threshold_current_alarms_info[0], NULL }, + { "outlet.group.%i.current.status", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.5.4.1.4.%i.%i", + NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, &marlin_threshold_status_info[0], NULL }, + { "outlet.group.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.5.4.1.4.%i.%i", + NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, &marlin_threshold_current_alarms_info[0], NULL }, /* groupCurrentPercentLoad.0.1 = Integer: 0 */ - { "outlet.group.%i.load", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.5.4.1.10.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.%i.load", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.5.4.1.10.%i.%i", + NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* groupCurrentThLowerWarning.0.1 = Integer: 0 */ - { "outlet.group.%i.current.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.4.1.5.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.%i.current.low.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.5.4.1.5.%i.%i", + NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* groupCurrentThLowerCritical.0.1 = Integer: -1 */ - { "outlet.group.%i.current.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.4.1.6.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.%i.current.low.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.5.4.1.6.%i.%i", + NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* groupCurrentThUpperWarning.0.1 = Integer: 12800 */ - { "outlet.group.%i.current.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.4.1.7.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.%i.current.high.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.5.4.1.7.%i.%i", + NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* groupCurrentThUpperCritical.0.1 = Integer: 16000 */ - { "outlet.group.%i.current.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.4.1.8.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.%i.current.high.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.5.4.1.8.%i.%i", + NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* groupWatts.0.1 = Integer: 2670 */ - { "outlet.group.%i.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.5.5.1.3.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.%i.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.5.5.1.3.%i.%i", + NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* groupVA.0.1 = Integer: 3132 */ - { "outlet.group.%i.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.5.5.1.2.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.%i.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.5.5.1.2.%i.%i", + NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* instant commands. */ /* Notes: @@ -511,19 +675,25 @@ static snmp_info_t eaton_marlin_mib[] = { { "outlet.load.cycle", 0, DO_CYCLE, AR_OID_OUTLET_STATUS ".0", NULL, SU_TYPE_CMD, NULL, NULL }, */ /* TODO: handle delays */ - { "outlet.%i.load.off", 0, 0, ".1.3.6.1.4.1.534.6.6.7.6.6.1.3.%i.%i", NULL, SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.load.on", 0, 0, ".1.3.6.1.4.1.534.6.6.7.6.6.1.4.%i.%i", NULL, SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.load.cycle", 0, 0, ".1.3.6.1.4.1.534.6.6.7.6.6.1.5.%i.%i", NULL, SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.load.off", 0, 0, ".1.3.6.1.4.1.534.6.6.7.6.6.1.3.%i.%i", + NULL, SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.load.on", 0, 0, ".1.3.6.1.4.1.534.6.6.7.6.6.1.4.%i.%i", + NULL, SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.load.cycle", 0, 0, ".1.3.6.1.4.1.534.6.6.7.6.6.1.5.%i.%i", + NULL, SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, /* TODO: handle delays * 0-n :Time in seconds until the group command is issued * -1:Cancel a pending group-level Off/On/Reboot command */ /* groupControlOffCmd.0.1 = Integer: -1 */ - { "outlet.group.%i.load.off", 0, 0, ".1.3.6.1.4.1.534.6.6.7.5.6.1.3.%i.%i", NULL, SU_TYPE_CMD | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.%i.load.off", 0, 0, ".1.3.6.1.4.1.534.6.6.7.5.6.1.3.%i.%i", + NULL, SU_TYPE_CMD | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* groupControl0nCmd.0.1 = Integer: -1 */ - { "outlet.group.%i.load.on", 0, 0, ".1.3.6.1.4.1.534.6.6.7.5.6.1.4.%i.%i", NULL, SU_TYPE_CMD | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.%i.load.on", 0, 0, ".1.3.6.1.4.1.534.6.6.7.5.6.1.4.%i.%i", + NULL, SU_TYPE_CMD | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* groupControlRebootCmd.0.1 = Integer: -1 */ - { "outlet.group.%i.load.cycle", 0, 0, ".1.3.6.1.4.1.534.6.6.7.5.6.1.5.%i.%i", NULL, SU_TYPE_CMD | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.%i.load.cycle", 0, 0, ".1.3.6.1.4.1.534.6.6.7.5.6.1.5.%i.%i", + NULL, SU_TYPE_CMD | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, // FIXME: miss load.{on,off}.delay From 32f5e631e220129cab45d39ac8cf7cbf24ac5114 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Wed, 11 Oct 2017 08:21:10 +0200 Subject: [PATCH 14/26] eaton-pdu-marlin-mib.c : line-breaks for readability and 80-col standard - pass 2 --- drivers/eaton-pdu-marlin-mib.c | 503 ++++++++++++++++++++++----------- 1 file changed, 338 insertions(+), 165 deletions(-) diff --git a/drivers/eaton-pdu-marlin-mib.c b/drivers/eaton-pdu-marlin-mib.c index fffa45b611..de943679fd 100644 --- a/drivers/eaton-pdu-marlin-mib.c +++ b/drivers/eaton-pdu-marlin-mib.c @@ -210,13 +210,16 @@ static snmp_info_t eaton_marlin_mib[] = { /* Device collection */ { "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "EATON", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, - { "device.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.1.2.1.2.%i", + { "device.model", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.1.2.1.2.%i", "Eaton Powerware ePDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, - { "device.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.1.2.1.4.%i", + { "device.serial", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.1.2.1.4.%i", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, { "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, - { "device.part", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.1.2.1.3.%i", + { "device.part", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.1.2.1.3.%i", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, /* For daisychain, there is only 1 physical interface! */ { "device.macaddr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.2.2.1.6.2", @@ -225,29 +228,35 @@ static snmp_info_t eaton_marlin_mib[] = { * Notes: this definition is used to: * - estimate the number of devices, based on the below OID iteration capabilities * - determine the base index of the SNMP OID (ie 0 or 1) */ - { "device.count", 0, 1, ".1.3.6.1.4.1.534.6.6.7.1.2.1.2.%i", "1", SU_FLAG_STATIC, NULL, NULL /* devices_count */ }, + { "device.count", 0, 1, ".1.3.6.1.4.1.534.6.6.7.1.2.1.2.%i", + "1", SU_FLAG_STATIC, NULL, NULL /* devices_count */ }, /* UPS collection */ { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "EATON", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, - { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, "1.3.6.1.4.1.534.6.6.7.1.2.1.2.%i", + { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, + "1.3.6.1.4.1.534.6.6.7.1.2.1.2.%i", "Eaton Powerware ePDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, /* FIXME: use unitName.0 (ePDU)? * { "ups.id", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_DEVICE_NAME, "unknown", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, */ - { "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.1.2.1.4.%i", + { "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.1.2.1.4.%i", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, - { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.1.2.1.5.%i", + { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.1.2.1.5.%i", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, { "ups.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, /* FIXME: needs a date reformating callback * 2011-8-29,16:27:25.0,+1:0 * Hex-STRING: 07 DB 08 1D 10 0C 36 00 2B 01 00 00 - * { "ups.date", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.1.2.1.8.0", + * { "ups.date", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.1.2.1.8.0", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, - * { "ups.time", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.1.2.1.8.0", + * { "ups.time", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.1.2.1.8.0", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, */ @@ -266,10 +275,13 @@ static snmp_info_t eaton_marlin_mib[] = { NULL, SU_FLAG_STATIC, &marlin_input_type_info[0], NULL }, /* Frequency is measured globally */ - { "input.frequency", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.3.1.1.3.%i.1", NULL, 0, NULL, NULL }, - { "input.frequency.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.1.1.4.%i.1", + { "input.frequency", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.3.1.1.3.%i.1", + NULL, 0, NULL, NULL }, + { "input.frequency.status", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.3.1.1.4.%i.1", NULL, SU_FLAG_OK, &marlin_threshold_frequency_status_info[0], NULL }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.1.1.4.%i.1", + { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.3.1.1.4.%i.1", NULL, SU_FLAG_OK, &marlin_threshold_frequency_alarm_info[0], NULL }, /* inputCurrentPercentLoad (measured globally) @@ -292,120 +304,186 @@ static snmp_info_t eaton_marlin_mib[] = { * This is depending on OID inputVoltageMeasType * INTEGER {singlePhase (1),phase1toN (2),phase2toN (3),phase3toN (4),phase1to2 (5),phase2to3 (6),phase3to1 (7) * => RFC input.Lx.voltage.context */ - { "input.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.%i.1.1", NULL, 0, NULL, NULL }, - { "input.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.1", + { "input.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.%i.1.1", + NULL, 0, NULL, NULL }, + { "input.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.1", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.1", + { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.1", NULL, SU_FLAG_OK, &marlin_threshold_voltage_alarms_info[0], NULL }, - { "input.voltage.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.%i.1.1", + { "input.voltage.low.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.voltage.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.%i.1.1", + { "input.voltage.low.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.voltage.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.%i.1.1", + { "input.voltage.high.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.voltage.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.%i.1.1", + { "input.voltage.high.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L1.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.%i.1.1", NULL, 0, NULL, NULL }, - { "input.L1.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.1", + { "input.L1.voltage", 0, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.%i.1.1", + NULL, 0, NULL, NULL }, + { "input.L1.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.1", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, - { "L1.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.1", + { "L1.alarm", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.1", NULL, SU_FLAG_OK, &marlin_threshold_voltage_alarms_info[0], NULL }, - { "input.L1.voltage.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.%i.1.1", + { "input.L1.voltage.low.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L1.voltage.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.%i.1.1", + { "input.L1.voltage.low.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L1.voltage.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.%i.1.1", + { "input.L1.voltage.high.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L1.voltage.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.%i.1.1", + { "input.L1.voltage.high.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L2.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.%i.1.2", NULL, 0, NULL, NULL }, - { "input.L2.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.2", + { "input.L2.voltage", 0, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.%i.1.2", + NULL, 0, NULL, NULL }, + { "input.L2.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.2", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, - { "L2.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.2", + { "L2.alarm", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.2", NULL, SU_FLAG_OK, &marlin_threshold_voltage_alarms_info[0], NULL }, - { "input.L2.voltage.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.%i.1.2", + { "input.L2.voltage.low.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.%i.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L2.voltage.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.%i.1.2", + { "input.L2.voltage.low.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.%i.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L2.voltage.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.%i.1.2", + { "input.L2.voltage.high.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.%i.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L2.voltage.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.%i.1.2", + { "input.L2.voltage.high.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.%i.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L3.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.%i.1.3", NULL, 0, NULL, NULL }, - { "input.L3.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.3", + { "input.L3.voltage", 0, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.%i.1.3", + NULL, 0, NULL, NULL }, + { "input.L3.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.3", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, - { "L3.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.3", + { "L3.alarm", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.3", NULL, SU_FLAG_OK, &marlin_threshold_voltage_alarms_info[0], NULL }, - { "input.L3.voltage.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.%i.1.3", + { "input.L3.voltage.low.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.%i.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L3.voltage.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.%i.1.3", + { "input.L3.voltage.low.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.%i.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L3.voltage.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.%i.1.3", + { "input.L3.voltage.high.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.%i.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L3.voltage.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.%i.1.3", + { "input.L3.voltage.high.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.%i.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, /* FIXME: * - input.current is mapped on input.L1.current for both single and 3phase !!! */ - { "input.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.%i.1.1", + { "input.current", 0, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.%i.1.1", NULL, 0, NULL, NULL }, - { "input.current.nominal", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.%i.1.1", + { "input.current.nominal", 0, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.%i.1.1", NULL, 0, NULL, NULL }, - { "input.current.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.1", + { "input.current.status", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.1", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.1", + { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.1", NULL, SU_FLAG_OK, &marlin_threshold_current_alarms_info[0], NULL }, - { "input.current.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.%i.1.1", + { "input.current.low.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.current.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.%i.1.1", + { "input.current.low.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.current.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.%i.1.1", + { "input.current.high.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.current.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.%i.1.1", + { "input.current.high.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L1.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.0.1.1", NULL, 0, NULL, NULL }, - { "input.L1.current.nominal", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.%i.1.1", + { "input.L1.current", 0, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.0.1.1", + NULL, 0, NULL, NULL }, + { "input.L1.current.nominal", 0, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.%i.1.1", NULL, 0, NULL, NULL }, - { "input.L1.current.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.1", + { "input.L1.current.status", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.1", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, - { "L1.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.1", + { "L1.alarm", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.1", NULL, SU_FLAG_OK, &marlin_threshold_current_alarms_info[0], NULL }, - { "input.L1.current.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.%i.1.1", + { "input.L1.current.low.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L1.current.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.%i.1.1", + { "input.L1.current.low.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L1.current.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.%i.1.1", + { "input.L1.current.high.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L1.current.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.%i.1.1", + { "input.L1.current.high.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.%i.1.1", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L2.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.%i.1.2", NULL, 0, NULL, NULL }, - { "input.L2.current.nominal", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.%i.1.2", + { "input.L2.current", 0, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.%i.1.2", + NULL, 0, NULL, NULL }, + { "input.L2.current.nominal", 0, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.%i.1.2", NULL, 0, NULL, NULL }, - { "input.L2.current.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.2", + { "input.L2.current.status", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.2", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, - { "L2.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.2", + { "L2.alarm", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.2", NULL, SU_FLAG_OK, &marlin_threshold_current_alarms_info[0], NULL }, - { "input.L2.current.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.%i.1.2", + { "input.L2.current.low.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.%i.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L2.current.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.%i.1.2", + { "input.L2.current.low.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.%i.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L2.current.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.%i.1.2", + { "input.L2.current.high.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.%i.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L2.current.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.%i.1.2", + { "input.L2.current.high.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.%i.1.2", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L3.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.%i.1.3", NULL, 0, NULL, NULL }, - { "input.L3.current.nominal", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.%i.1.3", + { "input.L3.current", 0, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.%i.1.3", NULL, 0, NULL, NULL }, - { "input.L3.current.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.3", + { "input.L3.current.nominal", 0, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.%i.1.3", + NULL, 0, NULL, NULL }, + { "input.L3.current.status", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.3", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, - { "L3.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.3", + { "L3.alarm", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.3", NULL, SU_FLAG_OK, &marlin_threshold_current_alarms_info[0], NULL }, - { "input.L3.current.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.%i.1.3", + { "input.L3.current.low.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.%i.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L3.current.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.%i.1.3", + { "input.L3.current.low.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.%i.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L3.current.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.%i.1.3", + { "input.L3.current.high.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.%i.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, - { "input.L3.current.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.%i.1.3", + { "input.L3.current.high.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.%i.1.3", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, /* Sum of all phases realpower, valid for Shark 1ph/3ph only */ { "input.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.5.1.4.%i.1", @@ -439,133 +517,196 @@ static snmp_info_t eaton_marlin_mib[] = { NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, /* Ambient collection */ - { "ambient.present", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.1.1.3.%i.1", + { "ambient.present", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.7.1.1.3.%i.1", NULL, SU_FLAG_OK, &marlin_ambient_presence_info[0], NULL }, { "ambient.temperature.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.1.1.5.%i.1", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.1.1.5.%i.1", + { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.7.1.1.5.%i.1", NULL, SU_FLAG_OK, &marlin_threshold_temperature_alarms_info[0], NULL }, { "ambient.temperature", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.4.%i.1", NULL, SU_FLAG_OK, NULL, NULL }, /* Low and high threshold use the respective critical levels */ - { "ambient.temperature.low", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.7.%i.1", + { "ambient.temperature.low", ST_FLAG_RW, 0.1, + ".1.3.6.1.4.1.534.6.6.7.7.1.1.7.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "ambient.temperature.low.critical", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.7.%i.1", + { "ambient.temperature.low.critical", ST_FLAG_RW, 0.1, + ".1.3.6.1.4.1.534.6.6.7.7.1.1.7.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "ambient.temperature.low.warning", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.6.%i.1", + { "ambient.temperature.low.warning", ST_FLAG_RW, 0.1, + ".1.3.6.1.4.1.534.6.6.7.7.1.1.6.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "ambient.temperature.high", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.9.%i.1", + { "ambient.temperature.high", ST_FLAG_RW, 0.1, + ".1.3.6.1.4.1.534.6.6.7.7.1.1.9.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "ambient.temperature.high.warning", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.8.%i.1", + { "ambient.temperature.high.warning", ST_FLAG_RW, 0.1, + ".1.3.6.1.4.1.534.6.6.7.7.1.1.8.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "ambient.temperature.high.critical", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.9.%i.1", + { "ambient.temperature.high.critical", ST_FLAG_RW, 0.1, + ".1.3.6.1.4.1.534.6.6.7.7.1.1.9.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "ambient.humidity.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.2.1.5.%i.1", + { "ambient.humidity.status", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.7.2.1.5.%i.1", NULL, SU_FLAG_OK, &marlin_threshold_status_info[0], NULL }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.2.1.5.%i.1", + { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.7.2.1.5.%i.1", NULL, SU_FLAG_OK, &marlin_threshold_humidity_alarms_info[0], NULL }, { "ambient.humidity", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.4.%i.1", NULL, SU_FLAG_OK, NULL, NULL }, /* Low and high threshold use the respective critical levels */ - { "ambient.humidity.low", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.7.%i.1", + { "ambient.humidity.low", ST_FLAG_RW, 0.1, + ".1.3.6.1.4.1.534.6.6.7.7.2.1.7.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "ambient.humidity.low.warning", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.6.%i.1", + { "ambient.humidity.low.warning", ST_FLAG_RW, 0.1, + ".1.3.6.1.4.1.534.6.6.7.7.2.1.6.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "ambient.humidity.low.critical", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.7.%i.1", + { "ambient.humidity.low.critical", ST_FLAG_RW, 0.1, + ".1.3.6.1.4.1.534.6.6.7.7.2.1.7.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "ambient.humidity.high", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.9.%i.1", NULL, + { "ambient.humidity.high", ST_FLAG_RW, 0.1, + ".1.3.6.1.4.1.534.6.6.7.7.2.1.9.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "ambient.humidity.high.warning", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.8.%i.1", + { "ambient.humidity.high.warning", ST_FLAG_RW, 0.1, + ".1.3.6.1.4.1.534.6.6.7.7.2.1.8.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, - { "ambient.humidity.high.critical", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.9.%i.1", + { "ambient.humidity.high.critical", ST_FLAG_RW, 0.1, + ".1.3.6.1.4.1.534.6.6.7.7.2.1.9.%i.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, /* Dry contacts on TH module */ - { "ambient.contacts.1.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.3.1.4.%i.1", + { "ambient.contacts.1.status", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.7.3.1.4.%i.1", NULL, SU_FLAG_OK, &marlin_ambient_drycontacts_info[0], NULL }, - { "ambient.contacts.2.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.7.3.1.4.%i.2", + { "ambient.contacts.2.status", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.7.3.1.4.%i.2", NULL, SU_FLAG_OK, &marlin_ambient_drycontacts_info[0], NULL }, /* Outlet collection */ - { "outlet.id", 0, 1, NULL, "0", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, + { "outlet.id", 0, 1, NULL, + "0", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, { "outlet.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, NULL, "All outlets", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, { "outlet.count", 0, 1, ".1.3.6.1.4.1.534.6.6.7.1.2.1.22.%i", "0", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, /* The below ones are the same as the input.* equivalent */ /* FIXME: transition period, TO BE REMOVED, moved to input.* */ - { "outlet.frequency", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.3.1.1.3.%i.1", NULL, 0, NULL, NULL }, - { "outlet.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.%i.1.1", NULL, 0, NULL, NULL }, - { "outlet.current", 0, 0.01, ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.%i.1.1", NULL, 0, NULL, NULL }, - { "outlet.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.4.%i.1.4", NULL, 0, NULL, NULL }, - { "outlet.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.%i.1.4", NULL, 0, NULL, NULL }, + { "outlet.frequency", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.3.1.1.3.%i.1", + NULL, 0, NULL, NULL }, + { "outlet.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.%i.1.1", + NULL, 0, NULL, NULL }, + { "outlet.current", 0, 0.01, ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.%i.1.1", + NULL, 0, NULL, NULL }, + { "outlet.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.4.%i.1.4", + NULL, 0, NULL, NULL }, + { "outlet.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.%i.1.4", + NULL, 0, NULL, NULL }, /* outlet template definition * Indexes start from 1, ie outlet.1 => .1 */ /* Note: the first definition is used to determine the base index (ie 0 or 1) */ /* outletName: Outlet friendly name, which can be modified by the user */ - { "outlet.%i.desc", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.1.1.3.%i.%i", NULL, SU_FLAG_STATIC | SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.6.1.2.%i.%i", - NULL, SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, &marlin_outlet_status_info[0], NULL }, + { "outlet.%i.desc", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.6.1.1.3.%i.%i", + NULL, SU_FLAG_STATIC | SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, + NULL, NULL }, + { "outlet.%i.status", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.6.6.1.2.%i.%i", + NULL, SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, + &marlin_outlet_status_info[0], NULL }, /* Numeric identifier of the outlet, tied to the whole unit */ { "outlet.%i.id", 0, 1, NULL, "%i", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, + NULL, NULL }, /* outletID: Outlet physical name, related to its number in the group * ex: first outlet of the second group (B) is B1 */ - { "outlet.%i.name", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.1.1.2.%i.%i", - NULL, SU_FLAG_STATIC | SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.name", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.6.1.1.2.%i.%i", + NULL, SU_FLAG_STATIC | SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, + NULL, NULL }, /* FIXME: the last part of the OID gives the group number (i.e. %i.1 means "group 1") * Need to address that, without multiple declaration (%i.%i, SU_OUTLET | SU_OUTLET_GROUP)? */ - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.1", - NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.2", - NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.3", - NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.4", - NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.5", - NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.6", - NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.1", + NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, + NULL, NULL }, + { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.2", + NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, + NULL, NULL }, + { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.3", + NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, + NULL, NULL }, + { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.4", + NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, + NULL, NULL }, + { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.5", + NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, + NULL, NULL }, + { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.6", + NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, + NULL, NULL }, { "outlet.%i.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.4.1.3.%i.%i", NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.current.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.4.1.4.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, &marlin_threshold_status_info[0], NULL }, - { "outlet.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.4.1.4.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, &marlin_threshold_current_alarms_info[0], NULL }, - { "outlet.%i.current.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.4.1.5.%i.%i", + { "outlet.%i.current.status", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.6.4.1.4.%i.%i", + NULL, SU_OUTLET | SU_TYPE_DAISY_1, + &marlin_threshold_status_info[0], NULL }, + { "outlet.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.6.4.1.4.%i.%i", + NULL, SU_OUTLET | SU_TYPE_DAISY_1, + &marlin_threshold_current_alarms_info[0], NULL }, + { "outlet.%i.current.low.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.6.4.1.5.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.current.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.4.1.6.%i.%i", + { "outlet.%i.current.low.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.6.4.1.6.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.current.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.4.1.7.%i.%i", + { "outlet.%i.current.high.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.6.4.1.7.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.current.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.4.1.8.%i.%i", + { "outlet.%i.current.high.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.6.4.1.8.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, { "outlet.%i.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.6.5.1.3.%i.%i", NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, { "outlet.%i.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.3.1.2.%i.%i", NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.3.1.3.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, &marlin_threshold_status_info[0], NULL }, - { "outlet.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.3.1.3.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, &marlin_threshold_voltage_alarms_info[0], NULL }, - { "outlet.%i.voltage.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.3.1.4.%i.%i", + { "outlet.%i.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.6.3.1.3.%i.%i", + NULL, SU_OUTLET | SU_TYPE_DAISY_1, + &marlin_threshold_status_info[0], NULL }, + { "outlet.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.6.3.1.3.%i.%i", + NULL, SU_OUTLET | SU_TYPE_DAISY_1, + &marlin_threshold_voltage_alarms_info[0], NULL }, + { "outlet.%i.voltage.low.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.6.3.1.4.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.voltage.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.3.1.5.%i.%i", + { "outlet.%i.voltage.low.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.6.3.1.5.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.voltage.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.3.1.6.%i.%i", + { "outlet.%i.voltage.high.warning", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.6.3.1.6.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - { "outlet.%i.voltage.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.3.1.7.%i.%i", + { "outlet.%i.voltage.high.critical", ST_FLAG_RW, 0.001, + ".1.3.6.1.4.1.534.6.6.7.6.3.1.7.%i.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, { "outlet.%i.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.6.5.1.2.%i.%i", NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, /* FIXME: handle non switchable units (only measurements), which do not expose this OID */ - { "outlet.%i.switchable", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.6.1.3.%i.%i", + { "outlet.%i.switchable", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.6.6.1.3.%i.%i", "no", SU_FLAG_STATIC | SU_OUTLET | SU_FLAG_OK | SU_TYPE_DAISY_1, &marlin_outlet_switchability_info[0], NULL }, - { "outlet.%i.type", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.1.1.5.%i.%i", - "unknown", SU_FLAG_STATIC | SU_OUTLET | SU_TYPE_DAISY_1, &marlin_outlet_type_info[0], NULL }, + { "outlet.%i.type", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.6.1.1.5.%i.%i", + "unknown", SU_FLAG_STATIC | SU_OUTLET | SU_TYPE_DAISY_1, + &marlin_outlet_type_info[0], NULL }, /* TODO: handle statistics @@ -580,7 +721,8 @@ static snmp_info_t eaton_marlin_mib[] = { * Indexes start from 1, ie outlet.group.1 => .1 */ /* Note: the first definition is used to determine the base index (ie 0 or 1) */ /* groupID.0.1 = OctetString: A */ - { "outlet.group.%i.id", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.1.1.2.%i.%i", + { "outlet.group.%i.id", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.5.1.1.2.%i.%i", NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* groupName.0.1 = OctetString: Factory Group 1 */ /* FIXME: SU_FLAG_SEMI_STATIC or SU_FLAG_SETTING => refreshed from time to time or upon call to setvar */ @@ -588,79 +730,104 @@ static snmp_info_t eaton_marlin_mib[] = { ".1.3.6.1.4.1.534.6.6.7.5.1.1.3.%i.%i", NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* groupType.0.1 = Integer: outletSection (4) */ - { "outlet.group.%i.type", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.1.1.4.%i.%i", + { "outlet.group.%i.type", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.5.1.1.4.%i.%i", NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, &marlin_outlet_group_type_info[0], NULL }, - { "outlet.group.%i.phase", 0, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.1.1.2.%i.%i", + { "outlet.group.%i.phase", 0, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.5.1.1.2.%i.%i", NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, &marlin_outlet_group_phase_info[0], NULL }, /* groupControlStatus.0.1 = Integer: on (1) */ - { "outlet.group.%i.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.6.1.2.%i.%i", + { "outlet.group.%i.status", ST_FLAG_STRING, SU_INFOSIZE, + ".1.3.6.1.4.1.534.6.6.7.5.6.1.2.%i.%i", NULL, SU_FLAG_OK | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, &marlin_outletgroups_status_info[0], NULL }, /* groupChildCount.0.1 = Integer: 12 */ - { "outlet.group.%i.count", 0, 1, ".1.3.6.1.4.1.534.6.6.7.5.1.1.6.%i.%i", + { "outlet.group.%i.count", 0, 1, + ".1.3.6.1.4.1.534.6.6.7.5.1.1.6.%i.%i", NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* groupVoltage.0.1 = Integer: 243080 */ - { "outlet.group.%i.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.3.1.3.%i.%i", + { "outlet.group.%i.voltage", 0, 0.001, + ".1.3.6.1.4.1.534.6.6.7.5.3.1.3.%i.%i", NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* groupVoltageThStatus.0.1 = Integer: good (0) */ { "outlet.group.%i.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.3.1.4.%i.%i", - NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, &marlin_threshold_status_info[0], NULL }, + NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, + &marlin_threshold_status_info[0], NULL }, { "outlet.group.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.3.1.4.%i.%i", - NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, &marlin_threshold_voltage_alarms_info[0], NULL }, + NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, + &marlin_threshold_voltage_alarms_info[0], NULL }, { "outlet.group.%i.voltage.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.3.1.5.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, + NULL, NULL }, { "outlet.group.%i.voltage.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.3.1.6.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, + NULL, NULL }, { "outlet.group.%i.voltage.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.3.1.7.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, + NULL, NULL }, { "outlet.group.%i.voltage.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.3.1.8.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, + NULL, NULL }, /* groupCurrent.0.1 = Integer: 0 */ - { "outlet.group.%i.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.4.1.3.%i.%i", + { "outlet.group.%i.current", 0, 0.001, + ".1.3.6.1.4.1.534.6.6.7.5.4.1.3.%i.%i", NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* groupCurrentCapacity.0.1 = Integer: 16000 */ - { "outlet.group.%i.current.nominal", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.4.1.2.%i.%i", + { "outlet.group.%i.current.nominal", 0, 0.001, + ".1.3.6.1.4.1.534.6.6.7.5.4.1.2.%i.%i", NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* groupCurrentThStatus.0.1 = Integer: good (0) */ { "outlet.group.%i.current.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.4.1.4.%i.%i", - NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, &marlin_threshold_status_info[0], NULL }, + NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, + &marlin_threshold_status_info[0], NULL }, { "outlet.group.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.5.4.1.4.%i.%i", - NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, &marlin_threshold_current_alarms_info[0], NULL }, + NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, + &marlin_threshold_current_alarms_info[0], NULL }, /* groupCurrentPercentLoad.0.1 = Integer: 0 */ - { "outlet.group.%i.load", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.5.4.1.10.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.%i.load", 0, 1.0, + ".1.3.6.1.4.1.534.6.6.7.5.4.1.10.%i.%i", + NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, + NULL, NULL }, /* groupCurrentThLowerWarning.0.1 = Integer: 0 */ { "outlet.group.%i.current.low.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.4.1.5.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, + NULL, NULL }, /* groupCurrentThLowerCritical.0.1 = Integer: -1 */ { "outlet.group.%i.current.low.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.4.1.6.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, + NULL, NULL }, /* groupCurrentThUpperWarning.0.1 = Integer: 12800 */ { "outlet.group.%i.current.high.warning", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.4.1.7.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, + NULL, NULL }, /* groupCurrentThUpperCritical.0.1 = Integer: 16000 */ { "outlet.group.%i.current.high.critical", ST_FLAG_RW, 0.001, ".1.3.6.1.4.1.534.6.6.7.5.4.1.8.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, + NULL, NULL }, /* groupWatts.0.1 = Integer: 2670 */ - { "outlet.group.%i.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.5.5.1.3.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.%i.realpower", 0, 1.0, + ".1.3.6.1.4.1.534.6.6.7.5.5.1.3.%i.%i", + NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, + NULL, NULL }, /* groupVA.0.1 = Integer: 3132 */ - { "outlet.group.%i.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.5.5.1.2.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, + { "outlet.group.%i.power", 0, 1.0, + ".1.3.6.1.4.1.534.6.6.7.5.5.1.2.%i.%i", + NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, + NULL, NULL }, /* instant commands. */ /* Notes: @@ -670,9 +837,12 @@ static snmp_info_t eaton_marlin_mib[] = { * -1 : Cancel * we currently use "0", so instant On | Off | Reboot... */ /* no counterpart found! - { "outlet.load.off", 0, DO_OFF, AR_OID_OUTLET_STATUS ".0", NULL, SU_TYPE_CMD, NULL, NULL }, - { "outlet.load.on", 0, DO_ON, AR_OID_OUTLET_STATUS ".0", NULL, SU_TYPE_CMD, NULL, NULL }, - { "outlet.load.cycle", 0, DO_CYCLE, AR_OID_OUTLET_STATUS ".0", NULL, SU_TYPE_CMD, NULL, NULL }, */ + { "outlet.load.off", 0, DO_OFF, AR_OID_OUTLET_STATUS ".0", + NULL, SU_TYPE_CMD, NULL, NULL }, + { "outlet.load.on", 0, DO_ON, AR_OID_OUTLET_STATUS ".0", + NULL, SU_TYPE_CMD, NULL, NULL }, + { "outlet.load.cycle", 0, DO_CYCLE, AR_OID_OUTLET_STATUS ".0", + NULL, SU_TYPE_CMD, NULL, NULL }, */ /* TODO: handle delays */ { "outlet.%i.load.off", 0, 0, ".1.3.6.1.4.1.534.6.6.7.6.6.1.3.%i.%i", @@ -686,13 +856,16 @@ static snmp_info_t eaton_marlin_mib[] = { * 0-n :Time in seconds until the group command is issued * -1:Cancel a pending group-level Off/On/Reboot command */ /* groupControlOffCmd.0.1 = Integer: -1 */ - { "outlet.group.%i.load.off", 0, 0, ".1.3.6.1.4.1.534.6.6.7.5.6.1.3.%i.%i", + { "outlet.group.%i.load.off", 0, 0, + ".1.3.6.1.4.1.534.6.6.7.5.6.1.3.%i.%i", NULL, SU_TYPE_CMD | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* groupControl0nCmd.0.1 = Integer: -1 */ - { "outlet.group.%i.load.on", 0, 0, ".1.3.6.1.4.1.534.6.6.7.5.6.1.4.%i.%i", + { "outlet.group.%i.load.on", 0, 0, + ".1.3.6.1.4.1.534.6.6.7.5.6.1.4.%i.%i", NULL, SU_TYPE_CMD | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, /* groupControlRebootCmd.0.1 = Integer: -1 */ - { "outlet.group.%i.load.cycle", 0, 0, ".1.3.6.1.4.1.534.6.6.7.5.6.1.5.%i.%i", + { "outlet.group.%i.load.cycle", 0, 0, + ".1.3.6.1.4.1.534.6.6.7.5.6.1.5.%i.%i", NULL, SU_TYPE_CMD | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL, NULL }, // FIXME: miss load.{on,off}.delay From 491d088af70a67b6ed1d2a6a6711d83be71dd911 Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Mon, 30 Oct 2017 21:43:45 +0100 Subject: [PATCH 15/26] configure.ac: Fix systemd shutdown directory detection The configure script assumes that systemd is installed below ${libdir}, which is not true on many biarch Linux distros with /lib64. Instead of guessing, use pkg-config to find the path and provide a --with-systemdshutdowndir option so that make distcheck can override it. Also, rename the internal varable to systemdshutdowndir to rhyme with the respective systemd.pc variable. Signed-off-by: Michal Marek --- Makefile.am | 1 + configure.ac | 18 +++++++++++++----- scripts/systemd/Makefile.am | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9b1c3b5c9a..7c35d2e124 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,6 +23,7 @@ DISTCHECK_VALGRIND_FLAGS = --with-all=auto --with-ssl=auto --with-doc=skip --wit DISTCHECK_CONFIGURE_FLAGS = ${DISTCHECK_FLAGS} \ --with-systemdsystemunitdir='$${prefix}/lib/systemd/system' \ + --with-systemdshutdowndir='$${prefix}/lib/systemd/system-shutdown' \ --with-augeas-lenses-dir='$${prefix}/usr/share/augeas/lenses' \ --with-hotplug-dir='$${prefix}/etc/hotplug' \ --with-udev-dir='$${prefix}/etc/udev' \ diff --git a/configure.ac b/configure.ac index 620ffdb250..93a2d33dba 100644 --- a/configure.ac +++ b/configure.ac @@ -1197,16 +1197,24 @@ AC_ARG_WITH([systemdsystemunitdir], ;; esac ], []) -dnl Override installation directory, with the local installation -dnl prefix. This is needed for 'distcheck*' targets, otherwise -dnl files will try to get intalled to the actual system directories if test -n "${systemdsystemunitdir}"; then - systemdsystemshutdowndir="${libdir}/systemd/system-shutdown" AC_MSG_RESULT(using ${systemdsystemunitdir}) else AC_MSG_RESULT(no) fi AM_CONDITIONAL(HAVE_SYSTEMD, test "$systemdsystemunitdir" != "") +dnl This option is only provided so that make distcheck can override it, +dnl otherwise we ask pkg-config whenever --with-systemdsystemunitdir is +dnl given +AC_ARG_WITH([systemdshutdowndir], + AS_HELP_STRING([--with-systemdshutdowndir=DIR], [Directory for systemd shutdown scripts (auto)]), + [systemdshutdowndir=${withval}]) +if test -n "${systemdsystemunitdir}"; then + case "${systemdshutdowndir}" in + yes|auto|"") + systemdshutdowndir=`$PKG_CONFIG --variable=systemdshutdowndir systemd` + esac +fi dnl dnl Tests for CppUnit availability and usability (will be built if we can, @@ -1582,7 +1590,7 @@ AC_SUBST(driverexecdir) AC_SUBST(htmldir) AC_SUBST(pkgconfigdir) AC_SUBST(systemdsystemunitdir) -AC_SUBST(systemdsystemshutdowndir) +AC_SUBST(systemdshutdowndir) AC_SUBST(auglensdir) AC_SUBST(hotplugdir) AC_SUBST(udevdir) diff --git a/scripts/systemd/Makefile.am b/scripts/systemd/Makefile.am index b62796d2d7..72e9a1c0cd 100644 --- a/scripts/systemd/Makefile.am +++ b/scripts/systemd/Makefile.am @@ -7,7 +7,7 @@ systemdsystemunit_DATA = \ nut-monitor.service \ nut-server.service -systemdsystemshutdown_SCRIPTS = nutshutdown +systemdshutdown_SCRIPTS = nutshutdown else EXTRA_DIST += nut-driver.service.in nut-monitor.service.in \ From b7f7043c8cc6f84d801e12d3db133c7cb1ae1463 Mon Sep 17 00:00:00 2001 From: Arnaud Quette Date: Fri, 17 Nov 2017 10:39:27 +0100 Subject: [PATCH 16/26] mge-shut/usbhid-ups: compute Output load for Eaton UPS When HID data UPS.PowerConverter.Output.ActivePower is not present, compute a realpower approximation using available data. This is needed for Eaton 5E and some other units Closes: https://github.com/networkupstools/nut/issues/484 Signed-off-by: Arnaud Quette --- drivers/Makefile.am | 4 ++-- drivers/mge-hid.c | 39 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/drivers/Makefile.am b/drivers/Makefile.am index 06a74be60e..6c95ac66cd 100644 --- a/drivers/Makefile.am +++ b/drivers/Makefile.am @@ -173,7 +173,7 @@ USBHID_UPS_SUBDRIVERS = apc-hid.c belkin-hid.c cps-hid.c explore-hid.c \ openups-hid.c usbhid_ups_SOURCES = usbhid-ups.c libhid.c libusb.c hidparser.c \ usb-common.c $(USBHID_UPS_SUBDRIVERS) -usbhid_ups_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) +usbhid_ups_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm tripplite_usb_SOURCES = tripplite_usb.c libusb.c usb-common.c tripplite_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm @@ -198,7 +198,7 @@ riello_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm mge_shut_SOURCES = usbhid-ups.c libshut.c libhid.c hidparser.c mge-hid.c # per-target CFLAGS are necessary here mge_shut_CFLAGS = $(AM_CFLAGS) -DSHUT_MODE -mge_shut_LDADD = $(LDADD) +mge_shut_LDADD = $(LDADD) -lm # SNMP snmp_ups_SOURCES = snmp-ups.c apc-mib.c baytech-mib.c compaq-mib.c \ diff --git a/drivers/mge-hid.c b/drivers/mge-hid.c index 5372e149fa..4845059cb9 100644 --- a/drivers/mge-hid.c +++ b/drivers/mge-hid.c @@ -36,8 +36,9 @@ #include "main.h" /* for getval() */ #include "usbhid-ups.h" #include "mge-hid.h" +#include -#define MGE_HID_VERSION "MGE HID 1.42" +#define MGE_HID_VERSION "MGE HID 1.43" /* (prev. MGE Office Protection Systems, prev. MGE UPS SYSTEMS) */ /* Eaton */ @@ -653,6 +654,39 @@ static info_lkp_t eaton_check_country_info[] = { { 0, NULL, NULL } }; +/* When UPS.PowerConverter.Output.ActivePower is not present, + * compute a realpower approximation using available data */ +static const char *eaton_compute_realpower_fun(double value) +{ + const char *str_ups_load = dstate_getinfo("ups.load"); + const char *str_power_nominal = dstate_getinfo("ups.power.nominal"); + const char *str_powerfactor = dstate_getinfo("output.powerfactor"); + float powerfactor = 0.80; + int power_nominal = 0; + int ups_load = 0; + double realpower = 0; + if (str_power_nominal && str_ups_load) { + /* Extract needed values */ + ups_load = atoi(str_ups_load); + power_nominal = atoi(str_power_nominal); + if (str_powerfactor) + powerfactor = atoi(str_powerfactor); + /* Compute the value */ + realpower = round(ups_load * 0.01 * power_nominal * powerfactor); + snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%.0f", realpower); + upsdebugx(1, "eaton_compute_realpower_fun(%s)", mge_scratch_buf); + return mge_scratch_buf; + } + /* else can't process */ + /* Return NULL, not to get the value published! */ + return NULL; +} + +static info_lkp_t eaton_compute_realpower_info[] = { + { 0, "dummy", eaton_compute_realpower_fun }, + { 0, NULL, NULL } +}; + /* Limit nominal output voltage according to HV or LV models */ static const char *nominal_output_voltage_fun(double value) { @@ -1153,6 +1187,9 @@ static hid_info_t mge_hid2nut[] = { "ups.L3.power", 0, 0, "UPS.PowerConverter.Output.Phase.[3].ApparentPower", NULL, "%.0f", 0, NULL }, { "ups.power.nominal", 0, 0, "UPS.Flow.[4].ConfigApparentPower", NULL, "%.0f", HU_FLAG_STATIC, NULL }, { "ups.realpower", 0, 0, "UPS.PowerConverter.Output.ActivePower", NULL, "%.0f", 0, NULL }, + /* When not available, process an approximation from other data, + * but map to apparent power to be called */ + { "ups.realpower", 0, 0, "UPS.Flow.[4].ConfigApparentPower", NULL, "-1", 0, eaton_compute_realpower_info }, { "ups.L1.realpower", 0, 0, "UPS.PowerConverter.Output.Phase.[1].ActivePower", NULL, "%.0f", 0, NULL }, { "ups.L2.realpower", 0, 0, "UPS.PowerConverter.Output.Phase.[2].ActivePower", NULL, "%.0f", 0, NULL }, { "ups.L3.realpower", 0, 0, "UPS.PowerConverter.Output.Phase.[3].ActivePower", NULL, "%.0f", 0, NULL }, From e957ea02eb8d2631034f021a7064d713b0af4c3d Mon Sep 17 00:00:00 2001 From: Arnaud Quette Date: Fri, 17 Nov 2017 10:47:05 +0100 Subject: [PATCH 17/26] HCL: Eaton ATS 30 supported by snmp-ups Signed-off-by: Arnaud Quette --- data/driver.list.in | 1 + 1 file changed, 1 insertion(+) diff --git a/data/driver.list.in b/data/driver.list.in index 63f1cba57a..7d537843cb 100644 --- a/data/driver.list.in +++ b/data/driver.list.in @@ -338,6 +338,7 @@ "Eaton" "ups" "5" "ConnectUPS X / BD / E Slot" "Network port" "snmp-ups" "Eaton" "ups" "5" "Management Card Contact" "Config 3 - Cable 66033" "genericups upstype=7" "Eaton" "ats" "5" "Eaton ATS16" "" "snmp-ups" +"Eaton" "ats" "5" "Eaton ATS30" "" "snmp-ups" "Effekta" "ups" "2" "MI/MT/MH" "2502 cable" "blazer_ser" "Effekta" "ups" "2" "RM2000MH" "" "blazer_ser" From cbcd997be57aa08dafcc9442be43459e9d500d23 Mon Sep 17 00:00:00 2001 From: Arnaud Quette Date: Fri, 17 Nov 2017 10:51:01 +0100 Subject: [PATCH 18/26] HCL: Eaton 9PX supported by mge-shut, usbhid-ups and netxml-ups Signed-off-by: Arnaud Quette --- data/driver.list.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/data/driver.list.in b/data/driver.list.in index 7d537843cb..89f50648db 100644 --- a/data/driver.list.in +++ b/data/driver.list.in @@ -295,6 +295,7 @@ "Eaton" "ups" "5" "5SC" "USB port" "usbhid-ups" "Eaton" "ups" "5" "5P" "USB port" "usbhid-ups" "Eaton" "ups" "5" "9SX" "USB port" "usbhid-ups" +"Eaton" "ups" "5" "9PX" "USB port" "usbhid-ups" "Eaton" "ups" "5" "9PX Split Phase 6/8/10 kVA" "USB port" "usbhid-ups" "Eaton" "ups" "5" "Ellipse ASR USBS 600/750/1000/1500 VA" "Serial cable" "mge-shut" "Eaton" "ups" "5" "Ellipse MAX USBS 600/850/1100/1500 VA" "Serial cable" "mge-shut" @@ -310,7 +311,9 @@ "Eaton" "ups" "5" "5SC" "Serial port" "mge-shut" "Eaton" "ups" "5" "5P" "Serial port" "mge-shut" "Eaton" "ups" "5" "9SX" "Serial port" "mge-shut" +"Eaton" "ups" "5" "9PX" "Serial port" "mge-shut" "Eaton" "ups" "5" "9PX Split Phase 6/8/10 kVA" "Serial port" "mge-shut" +"Eaton" "ups" "5" "9PX" "SNMP/Web card" "netxml-ups" "Eaton" "ups" "5" "9PX Split Phase 6/8/10 kVA" "SNMP/Web card" "netxml-ups" "Eaton" "ups" "5" "EX RT (XML/HTTP)" "NMC Transverse card (ref 66074)" "netxml-ups (experimental)" "Eaton" "ups" "5" "EX RT (SNMP)" "NMC Transverse card (ref 66074)" "snmp-ups (experimental)" From cf32fd728ac1465a0eb3d8eb895cb73cd2833408 Mon Sep 17 00:00:00 2001 From: Arnaud Quette Date: Fri, 17 Nov 2017 14:19:01 +0100 Subject: [PATCH 19/26] man pages: clarification on polling parameters Explain difference between pollfreq and pollinterval in usbhid-ups, and highlight the pollinterval parameter use from ups.conf in nutupsdrv Closes: https://github.com/networkupstools/nut/issues/476 Signed-off-by: Arnaud Quette --- docs/man/nutupsdrv.txt | 6 +++--- docs/man/usbhid-ups.txt | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/man/nutupsdrv.txt b/docs/man/nutupsdrv.txt index 4b62075984..80243e2901 100644 --- a/docs/man/nutupsdrv.txt +++ b/docs/man/nutupsdrv.txt @@ -29,9 +29,9 @@ the rest of this package. The core has two modes of operation which are determined by the command line switches. In the normal mode, the driver will periodically -poll the UPS for its state and parameters. The results of this command -is presented to upsd. The driver will also handle setting variables and -instant commands if available. +poll the UPS for its state and parameters, as per the *pollinterval* parameter +in linkman:ups.conf[5]. The results of this command is presented to upsd. +The driver will also handle setting variables and instant commands if available. The driver can also instruct the UPS to shut down the load, possibly after some delay. This mode of operation is intended for cases when it is diff --git a/docs/man/usbhid-ups.txt b/docs/man/usbhid-ups.txt index 2127d76d36..f61168c234 100644 --- a/docs/man/usbhid-ups.txt +++ b/docs/man/usbhid-ups.txt @@ -73,9 +73,12 @@ isn't. Some UPSes will restart no matter what, even if the power is if setting 'ondelay = -1' in *ups.conf* helps. *pollfreq*='num':: -Set polling frequency, in seconds, to reduce the USB data flow. -Between two polling requests, the driver will wait for interrupts (aka UPS -notifications), which are data changes returned by the UPS by itself. +Set polling frequency, in seconds, to reduce the USB data flow due to the +generic calls to request driver updates every "pollinterval", as per +linkman:ups.conf[5]. +Between two polling requests with *pollfreq*, the driver will wait for +interrupts (aka UPS notifications), which are data changes returned by the +UPS by itself. This mechanism allow to avoid or reduce staleness message, due to the UPS being temporarily overloaded with too much polling requests. The default value is 30 (in seconds). From 1212e27db17e59cb774f7f602bdeaaba0d61264e Mon Sep 17 00:00:00 2001 From: Charles Lepple Date: Sun, 26 Nov 2017 17:30:41 -0500 Subject: [PATCH 20/26] doc: mention CPS delay quirks in usbhid-ups man page Closes: https://github.com/networkupstools/nut/issues/432 --- docs/man/usbhid-ups.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/man/usbhid-ups.txt b/docs/man/usbhid-ups.txt index f61168c234..d0a6942978 100644 --- a/docs/man/usbhid-ups.txt +++ b/docs/man/usbhid-ups.txt @@ -59,6 +59,10 @@ sent (via the *-k* switch). + The default value is 20 (in seconds). Usually this *must be lower* than 'ondelay', but the driver will *not* warn you upon startup if it isn't. ++ +Note that many Cyber Power Systems (CPS) models tend to divide this delay by +60 and round down, so the minimum advisable value is 60 to avoid powering off +immediately after NUT sends the shutdown command to the UPS. *ondelay*='num':: Set the timer for the UPS to switch on in case the power returns after the @@ -71,6 +75,10 @@ than offdelay, but the driver will *not* warn you upon startup if it isn't. Some UPSes will restart no matter what, even if the power is (still) out at the moment this timer elapses. In that case, you could try if setting 'ondelay = -1' in *ups.conf* helps. ++ +Note that many CPS models tend to divide this delay by 60 and round down, so +the minimum advisable value is 60 to avoid powering on immediately after the +power returns. *pollfreq*='num':: Set polling frequency, in seconds, to reduce the USB data flow due to the From 22c4066fefed7f49aeb9a751e4955a39ce9f132b Mon Sep 17 00:00:00 2001 From: Charles Lepple Date: Sun, 26 Nov 2017 17:36:53 -0500 Subject: [PATCH 21/26] doc: reword other parts of usbhid-ups man page --- docs/man/usbhid-ups.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/man/usbhid-ups.txt b/docs/man/usbhid-ups.txt index d0a6942978..016ba0b98a 100644 --- a/docs/man/usbhid-ups.txt +++ b/docs/man/usbhid-ups.txt @@ -19,9 +19,9 @@ which only supported Linux systems. SUPPORTED HARDWARE ------------------ -*usbhid-ups* brings USB/HID UPS monitoring to NUT on all platform supporting -USB through libusb. It should detect any UPS that uses the HID power device -class, but the amount of data will vary depending on the manufacturer and +*usbhid-ups* brings USB/HID UPS monitoring to NUT on all platforms supporting +USB through libusb. It should detect any UPS that uses the HID Power Device +Class, but the amount of data will vary depending on the manufacturer and model. At the present time, usbhid-ups supports: @@ -66,19 +66,19 @@ immediately after NUT sends the shutdown command to the UPS. *ondelay*='num':: Set the timer for the UPS to switch on in case the power returns after the -kill power command had been sent but before the actual switch off. This +kill power command had been sent, but before the actual switch off. This ensures the machines connected to the UPS are, in all cases, rebooted after a power failure. + The default value is 30 (in seconds). Usually this *must be greater* than offdelay, but the driver will *not* warn you upon startup if it isn't. Some UPSes will restart no matter what, even if the power is -(still) out at the moment this timer elapses. In that case, you could try -if setting 'ondelay = -1' in *ups.conf* helps. +(still) out at the moment this timer elapses. In that case, you could see +whether setting `ondelay = -1` in *ups.conf* helps. + Note that many CPS models tend to divide this delay by 60 and round down, so -the minimum advisable value is 60 to avoid powering on immediately after the -power returns. +the minimum advisable value is 120 to allow a short delay between when the UPS +shuts down, and when the power returns. *pollfreq*='num':: Set polling frequency, in seconds, to reduce the USB data flow due to the @@ -102,7 +102,7 @@ UPS (not recommended, but needed if these reports are broken on your UPS). *productid*='regex':: Select a specific UPS, in case there is more than one connected via -USB Each option specifies an extended regular expression (see +USB. Each option specifies an extended regular expression (see regex(7)) that must match the UPS's entire vendor/product/serial string (minus any surrounding whitespace), or the whole 4-digit hexadecimal code for vendorid and productid. Try *-DD* for From f613d45f78c96c290a1d63d4a2c3f28385d90d42 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 27 Nov 2017 09:14:34 +0100 Subject: [PATCH 22/26] Problem: nutscan_init() called before debug is enabled Solution: Move the call to this stateless function to the point after we parse arguments and just before we'd start the actual scans. Later this can be extended to also consider which scans were requested and so which libs to load. Thanks to @clepple for research in https://github.com/networkupstools/nut/issues/500 Signed-off-by: Jim Klimov --- tools/nut-scanner/nut-scanner.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/nut-scanner/nut-scanner.c b/tools/nut-scanner/nut-scanner.c index 0e65fdf957..9fea9276c4 100644 --- a/tools/nut-scanner/nut-scanner.c +++ b/tools/nut-scanner/nut-scanner.c @@ -246,8 +246,6 @@ int main(int argc, char *argv[]) xml_sec.usec_timeout = -1; /* Override with the "timeout" common setting later */ xml_sec.peername = NULL; - nutscan_init(); - display_func = nutscan_display_ups_conf; /* Note: the getopts print an error message about unknown arguments @@ -468,6 +466,12 @@ int main(int argc, char *argv[]) /* BEWARE: allow_all does not include allow_eaton_serial! */ } + /* TODO: nutscan_init() should consider (via args? shared global vars?) + * which scan types we desire at this run, and not try to load irrelevant + * libraries. + */ + nutscan_init(); + /* TODO/discuss : Should the #else...#endif code below for lack of pthreads * during build also serve as a fallback for pthread failure at runtime? */ From a1f7445230e2c9eea0d9b9be31a42ee6154df4d3 Mon Sep 17 00:00:00 2001 From: Arnaud Quette Date: Mon, 27 Nov 2017 15:31:14 +0100 Subject: [PATCH 23/26] doc: reword nutupsdrv man page Reference: https://github.com/networkupstools/nut/issues/476 Signed-off-by: Arnaud Quette --- docs/man/nutupsdrv.txt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/man/nutupsdrv.txt b/docs/man/nutupsdrv.txt index 80243e2901..b715f01ac8 100644 --- a/docs/man/nutupsdrv.txt +++ b/docs/man/nutupsdrv.txt @@ -27,16 +27,21 @@ hardware and the linkman:upsd[8] server. The driver is responsible for translating the native protocol of the UPS to the common format used by the rest of this package. -The core has two modes of operation which are determined by the +The core has three modes of operation which are determined by the command line switches. In the normal mode, the driver will periodically poll the UPS for its state and parameters, as per the *pollinterval* parameter -in linkman:ups.conf[5]. The results of this command is presented to upsd. +in linkman:ups.conf[5]. The results of this command are presented to upsd. The driver will also handle setting variables and instant commands if available. -The driver can also instruct the UPS to shut down the load, possibly -after some delay. This mode of operation is intended for cases when it is -known that the UPS is running out of battery power and the systems -attached must be turned off to ensure a proper reboot when power returns. +In the second mode, using *-k*, the driver can instruct the UPS to shut down +the load, possibly after some delay. This mode of operation is intended for +cases when it is known that the UPS is running out of battery power and the +systems attached must be turned off to ensure a proper reboot when power +returns. + +In the third mode, using *-d*, the driver will exit after some update loops, +dumping the data tree (in upsc-like format) to stdout. This can be useful to +complement the nut-scanner to discover devices, along with in-depth data. NOTE: You probably don't want to use any of these options directly. You should use linkman:upsdrvctl[8] to control your drivers, and From be3e4266e16840ee969afc671052cbcbe8df2319 Mon Sep 17 00:00:00 2001 From: Arnaud Quette Date: Tue, 28 Nov 2017 08:22:35 +0100 Subject: [PATCH 24/26] doc: minor formatting in usbhid-ups man page Signed-off-by: Arnaud Quette --- docs/man/usbhid-ups.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/man/usbhid-ups.txt b/docs/man/usbhid-ups.txt index 016ba0b98a..766cb37fb3 100644 --- a/docs/man/usbhid-ups.txt +++ b/docs/man/usbhid-ups.txt @@ -82,7 +82,7 @@ shuts down, and when the power returns. *pollfreq*='num':: Set polling frequency, in seconds, to reduce the USB data flow due to the -generic calls to request driver updates every "pollinterval", as per +generic calls to request driver updates every *pollinterval*, as per linkman:ups.conf[5]. Between two polling requests with *pollfreq*, the driver will wait for interrupts (aka UPS notifications), which are data changes returned by the From 4dc254cdc39f76595e3c62c30cfe8eaa9327c49b Mon Sep 17 00:00:00 2001 From: Sam Varshavchik Date: Sat, 8 Apr 2017 12:10:32 -0400 Subject: [PATCH 25/26] Fix creation of documentation from libnutclient_misc.txt A simple .txt.3 rule doesn't understand that libnutclient_misc.txt creates a bunch of .3. A parallel build, say 'make -j 10' results in make trying to figure out how to build nutclient_authenticate.3 before building libnutclient_misc.3, and without a corresponding .txt in sight it gives up. Signed-off-by: Sam Varshavchik Rebased onto master by Charles Lepple clepple+nut@gmail.com Closes: https://github.com/networkupstools/nut/pull/418 --- docs/man/Makefile.am | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/docs/man/Makefile.am b/docs/man/Makefile.am index 80876da43c..94a16b4d9c 100644 --- a/docs/man/Makefile.am +++ b/docs/man/Makefile.am @@ -176,6 +176,15 @@ SRC_DEV_PAGES = \ if WITH_MANS # NOTE: nutclient_*.3 has no source counterpart (libnutclient_*.txt) + +LIBNUTCLIENT_MISC_DEPS= + nutclient_authenticate.3 \ + nutclient_logout.3 \ + nutclient_device_login.3 \ + nutclient_get_device_num_logins.3 \ + nutclient_device_master.3 \ + nutclient_device_forced_shutdown.3 + MAN3_DEV_PAGES = \ upsclient.3 \ upscli_add_host_cert.3 \ @@ -201,16 +210,12 @@ MAN3_DEV_PAGES = \ libnutclient_misc.3 \ libnutclient_tcp.3 \ libnutclient_variables.3 \ - nutclient_authenticate.3 \ + $(LIBNUTCLIENT_MISC_DEPS) nutclient_destroy.3 \ - nutclient_device_forced_shutdown.3 \ - nutclient_device_login.3 \ - nutclient_device_master.3 \ nutclient_execute_device_command.3 \ nutclient_get_device_command_description.3 \ nutclient_get_device_commands.3 \ nutclient_get_device_description.3 \ - nutclient_get_device_num_logins.3 \ nutclient_get_device_rw_variables.3 \ nutclient_get_devices.3 \ nutclient_get_device_variable_description.3 \ @@ -219,7 +224,6 @@ MAN3_DEV_PAGES = \ nutclient_has_device.3 \ nutclient_has_device_command.3 \ nutclient_has_device_variable.3 \ - nutclient_logout.3 \ nutclient_set_device_variable_value.3 \ nutclient_set_device_variable_values.3 \ nutclient_tcp_create_client.3 \ @@ -246,6 +250,9 @@ MAN3_DEV_PAGES = \ nutscan_get_serial_ports_list.3 \ nutscan_init.3 +$(LIBNUTCLIENT_MISC_DEPS): libnutclient_misc.3 + touch $@ + MAN1_DEV_PAGES = \ libupsclient-config.1 endif From 1a4c493acc7400f2e148d3a03a9af3e85a7b1a73 Mon Sep 17 00:00:00 2001 From: Arnaud Quette Date: Wed, 29 Nov 2017 14:35:02 +0100 Subject: [PATCH 26/26] doc: missing documentation for NUT_* env vars Complete documentation for upsd and drivers related to the environment variables NUT_CONFPATH, NUT_STATEPATH and NUT_ALTPIDPATH Signed-off-by: Arnaud Quette --- docs/configure.txt | 2 ++ docs/man/nutupsdrv.txt | 17 +++++++++++++++++ docs/man/upsd.txt | 7 ++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/docs/configure.txt b/docs/configure.txt index 149636e0fa..8824349bf4 100644 --- a/docs/configure.txt +++ b/docs/configure.txt @@ -358,6 +358,8 @@ Programs that normally don't have root powers, like the drivers and upsd, write their pid files here. By default this is whatever the statepath is, as those programs should be able to write there. +The NUT_ALTPIDPATH environment variable overrides this at run time. + --with-statepath=PATH Change the default location of the state sockets created by the diff --git a/docs/man/nutupsdrv.txt b/docs/man/nutupsdrv.txt index b715f01ac8..910c2ac0e2 100644 --- a/docs/man/nutupsdrv.txt +++ b/docs/man/nutupsdrv.txt @@ -153,6 +153,23 @@ ups.conf:: Required configuration file. This contains all details on which drivers to start and where the hardware is attached. +ENVIRONMENT VARIABLES +--------------------- + +*NUT_CONFPATH* is the path name of the directory that contains +`upsd.conf` and other configuration files. If this variable is not set, +*upsd* uses a built-in default, which is often `/usr/local/ups/etc`. + +*NUT_STATEPATH* is the path name of the directory in which +*upsd* keeps state information. If this variable is not set, +*upsd* uses a built-in default, which is often `/var/state/ups`. +The *STATEPATH* directive in linkman:upsd.conf[5] overrides this variable. + +*NUT_ALTPIDPATH* is the path name of the directory in which +*upsd* and drivers store .pid files. If this variable is not set, +*upsd* and drivers use either *NUT_STATEPATH* if set, or ALTPIDPATH if set, +or otherwise the built-in default *STATEPATH*. + BUGS ---- diff --git a/docs/man/upsd.txt b/docs/man/upsd.txt index 1fddadb1d5..a052e28a29 100644 --- a/docs/man/upsd.txt +++ b/docs/man/upsd.txt @@ -126,11 +126,16 @@ ENVIRONMENT VARIABLES `upsd.conf` and other configuration files. If this variable is not set, *upsd* uses a built-in default, which is often `/usr/local/ups/etc`. -*NUT_STATEPATH* is the path name of the directory in which +*NUT_STATEPATH* is the path name of the directory in which *upsd* keeps state information. If this variable is not set, *upsd* uses a built-in default, which is often `/var/state/ups`. The *STATEPATH* directive in linkman:upsd.conf[5] overrides this variable. +*NUT_ALTPIDPATH* is the path name of the directory in which +*upsd* and drivers store .pid files. If this variable is not set, +*upsd* and drivers use either *NUT_STATEPATH* if set, or ALTPIDPATH if set, +or otherwise the built-in default *STATEPATH*. + SEE ALSO --------