From d5cd30db4c7c932d0b0a42f7ab78dc4a12a1ac9e Mon Sep 17 00:00:00 2001 From: Alex Deymo Date: Wed, 17 Jul 2013 23:54:46 -0700 Subject: [PATCH 01/10] aquaero: Include aquaero plugin in config files. Adds the aquaero plugin into the build system. --- configure.in | 60 ++++++++++++++++++++++++++++++++++++++++++++ src/Makefile.am | 10 ++++++++ src/collectd.conf.in | 10 ++++++++ 3 files changed, 80 insertions(+) diff --git a/configure.in b/configure.in index 27c6cd316..7c2de0f28 100644 --- a/configure.in +++ b/configure.in @@ -1480,6 +1480,63 @@ then fi AM_CONDITIONAL(BUILD_WITH_LIBKVM_OPENFILES, test "x$with_kvm_openfiles" = "xyes") +# --with-libaquaero5 {{{ +AC_ARG_WITH(libaquaero5, [AS_HELP_STRING([--with-libaquaero5@<:@=PREFIX@:>@], [Path to aquatools-ng source code.])], +[ + if test "x$withval" = "xyes" + then + with_libaquaero5="yes" + else if test "x$withval" = "xno" + then + with_libaquaero5="no" + else + with_libaquaero5="yes" + LIBAQUAERO5_CFLAGS="$LIBAQUAERO5_CFLAGS -I$withval/src" + LIBAQUAERO5_LDFLAGS="$LIBAQUAERO5_LDFLAGS -L$withval/lib" + fi; fi +], +[with_libaquaero5="yes"]) + +SAVE_CPPFLAGS="$CPPFLAGS" +SAVE_LDFLAGS="$LDFLAGS" + +CPPFLAGS="$CPPFLAGS $LIBAQUAERO5_CFLAGS" +LDFLAGS="$LDFLAGS $LIBAQUAERO5_LDFLAGS" + +if test "x$with_libaquaero5" = "xyes" +then + if test "x$LIBAQUAERO5_CFLAGS" != "x" + then + AC_MSG_NOTICE([libaquaero5 CPPFLAGS: $LIBAQUAERO5_CFLAGS]) + fi + AC_CHECK_HEADERS(libaquaero5.h, + [with_libaquaero5="yes"], + [with_libaquaero5="no (libaquaero5.h not found)"]) +fi +if test "x$with_libaquaero5" = "xyes" +then + if test "x$LIBAQUAERO5_LDFLAGS" != "x" + then + AC_MSG_NOTICE([libaquaero5 LDFLAGS: $LIBAQUAERO5_LDFLAGS]) + fi + AC_CHECK_LIB(aquaero, libaquaero5_poll, + [with_libaquaero5="yes"], + [with_libaquaero5="no (symbol 'libaquaero5_poll' not found)"]) +fi + +CPPFLAGS="$SAVE_CPPFLAGS" +LDFLAGS="$SAVE_LDFLAGS" + +if test "x$with_libaquaero5" = "xyes" +then + BUILD_WITH_LIBAQUAERO5_CFLAGS="$LIBAQUAERO5_CFLAGS" + BUILD_WITH_LIBAQUAERO5_LDFLAGS="$LIBAQUAERO5_LDFLAGS" + AC_SUBST(BUILD_WITH_LIBAQUAERO5_CFLAGS) + AC_SUBST(BUILD_WITH_LIBAQUAERO5_LDFLAGS) +fi +AM_CONDITIONAL(BUILD_WITH_LIBAQUAERO5, test "x$with_libaquaero5" = "xyes") +# }}} + # --with-libcredis {{{ AC_ARG_WITH(libcredis, [AS_HELP_STRING([--with-libcredis@<:@=PREFIX@:>@], [Path to libcredis.])], [ @@ -5018,6 +5075,7 @@ AC_PLUGIN([amqp], [$with_librabbitmq], [AMQP output plugin]) AC_PLUGIN([apache], [$with_libcurl], [Apache httpd statistics]) AC_PLUGIN([apcups], [yes], [Statistics of UPSes by APC]) AC_PLUGIN([apple_sensors], [$with_libiokit], [Apple's hardware sensors]) +AC_PLUGIN([aquaero], [$with_libaquaero5], [Aquaero's hardware sensors]) AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics]) AC_PLUGIN([battery], [$plugin_battery], [Battery statistics]) AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics]) @@ -5301,6 +5359,7 @@ cat < +# +# # If you specify an empty string for the device (the default) it +# # will autodetect the first Aquaero 5 installed. +# Device "" +# # Optionally, you can specify the device path, make sure the Aquaero +# # device is readable by collectd. +# #Device "/dev/usb/hiddev0" +# + # # URL "http://localhost/ascent/status/" # User "www-user" From 4cc20e3bd688adfc806a418fefe735d8ba7ed3ac Mon Sep 17 00:00:00 2001 From: Alex Deymo Date: Wed, 17 Jul 2013 23:55:58 -0700 Subject: [PATCH 02/10] aquaero: New Aquaero sensors plugin This plugin adds support for the Aquaero 5 sensors. --- src/aquaero.c | 183 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 src/aquaero.c diff --git a/src/aquaero.c b/src/aquaero.c new file mode 100644 index 000000000..1dc6640f6 --- /dev/null +++ b/src/aquaero.c @@ -0,0 +1,183 @@ +/** + * collectd - src/aquaero.c + * Copyright (C) 2013 Alex Deymo + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; only version 2 of the License is applicable. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: + * Alex Deymo + **/ + +#define _BSD_SOURCE + +#include "collectd.h" +#include "common.h" +#include "plugin.h" + +#include + +/* + * Private variables + */ +/* Default values for contacting daemon */ +static char *conf_device = NULL; + +static const char *config_keys[] = +{ + "Device", +}; +static int config_keys_num = STATIC_ARRAY_SIZE (config_keys); + + +static int aquaero_config (const char *key, const char *value) +{ + if (strcasecmp (key, "Device") == 0) + { + if (conf_device != NULL) + { + free (conf_device); + conf_device = NULL; + } + if (value[0] == '\0') + return (0); + if ((conf_device = strdup (value)) == NULL) + return (1); + } + else + { + return (-1); + } + return (0); +} /* int aquaero_config */ + +static int aquaero_shutdown (void) +{ + libaquaero5_exit(); + return (0); +} /* int aquaero_shutdown */ + +static void aquaero_submit (const char *type, const char *type_instance, double value) +{ + const char *instance = conf_device?conf_device:"default"; + value_t values[1]; + value_list_t vl = VALUE_LIST_INIT; + + /* Don't report undefined values. */ + if (value == AQ5_FLOAT_UNDEF) + return; + + values[0].gauge = value; + + vl.values = values; + vl.values_len = 1; + + sstrncpy (vl.host, hostname_g, sizeof (vl.host)); + sstrncpy (vl.plugin, "aquaero", sizeof (vl.plugin)); + sstrncpy (vl.plugin_instance, instance, sizeof (vl.plugin_instance)); + sstrncpy (vl.type, type, sizeof (vl.type)); + sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance)); + + plugin_dispatch_values (&vl); +} /* int aquaero_submit */ + +/* aquaero_submit_array submits every value of a given array of values */ +static void aquaero_submit_array (const char *type, const char *type_instance_prefix, double *value_array, int len) +{ + char type_instance[DATA_MAX_NAME_LEN]; + int i; + + for (i = 0; i < len; i++) + if (value_array[i] != AQ5_FLOAT_UNDEF) + { + snprintf(type_instance, sizeof(type_instance), "%s%d", type_instance_prefix, i+1); + aquaero_submit(type, type_instance, value_array[i]); + } +} + +static int aquaero_read (void) +{ + aq5_data_t aq_data; + aq5_settings_t aq_sett; + char *err_msg = NULL; + char type_instance[DATA_MAX_NAME_LEN]; + char errbuf[1024]; + int i; + + if (libaquaero5_poll(conf_device, &aq_data, &err_msg) < 0) + { + sstrerror(errno, errbuf, sizeof (errbuf)); + ERROR ("Failed to poll device '%s': %s (%s)", + conf_device?conf_device:"default", err_msg, errbuf); + return (-1); + } + + if (libaquaero5_getsettings(conf_device, &aq_sett, &err_msg) < 0) + { + sstrerror(errno, errbuf, sizeof (errbuf)); + ERROR ("Failed to get settings for device '%s': %s (%s)\n", + conf_device?conf_device:"default", err_msg, errbuf); + return (-1); + } + + /* CPU Temperature sensor */ + aquaero_submit("temperature", "cpu", aq_data.cpu_temp[0]); + + /* Temperature sensors */ + aquaero_submit_array("temperature", "temp", aq_data.temp, AQ5_NUM_TEMP); + + /* Virtual temperature sensors */ + aquaero_submit_array("temperature", "virttemp", aq_data.vtemp, AQ5_NUM_VIRT_SENSORS); + + /* Software temperature sensors */ + aquaero_submit_array("temperature", "softtemp", aq_data.stemp, AQ5_NUM_SOFT_SENSORS); + + /* Other temperature sensors */ + aquaero_submit_array("temperature", "othertemp", aq_data.otemp, AQ5_NUM_OTHER_SENSORS); + + /* Fans */ + for (i = 0; i < AQ5_NUM_FAN; i++) + { + if ((aq_sett.fan_data_source[i] != NONE) && (aq_data.fan_vrm_temp[i] != AQ5_FLOAT_UNDEF)) + { + snprintf(type_instance, sizeof(type_instance), "fan%d", i+1); + aquaero_submit("fanspeed", type_instance, aq_data.fan_rpm[i]); + snprintf(type_instance, sizeof(type_instance), "fan-vrm%d", i+1); + aquaero_submit("temperature", type_instance, aq_data.fan_vrm_temp[i]); + + snprintf(type_instance, sizeof(type_instance), "fan%d", i+1); + aquaero_submit("percentage", type_instance, aq_data.fan_duty[i]); + + snprintf(type_instance, sizeof(type_instance), "fan%d", i+1); + aquaero_submit("voltage", type_instance, aq_data.fan_voltage[i]); + snprintf(type_instance, sizeof(type_instance), "fan%d", i+1); + aquaero_submit("current", type_instance, aq_data.fan_current[i]); + } + } + + /* Flow sensors */ + aquaero_submit_array("flow", "flow", aq_data.flow, AQ5_NUM_FLOW); + + /* Liquid level */ + aquaero_submit_array("level", "level", aq_data.level, AQ5_NUM_LEVEL); + + return (0); +} + +void module_register (void) +{ + plugin_register_config ("aquaero", aquaero_config, config_keys, + config_keys_num); + plugin_register_read ("aquaero", aquaero_read); + plugin_register_shutdown ("aquaero", aquaero_shutdown); +} /* void module_register */ From 983bfa38355e8547d7c37cc31981a88e91af6b48 Mon Sep 17 00:00:00 2001 From: Alex Deymo Date: Tue, 13 Aug 2013 00:10:43 -0700 Subject: [PATCH 03/10] aquaero: Fix sensor names This patch replaces some sensor names to more reasonable ones. --- src/aquaero.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/aquaero.c b/src/aquaero.c index 1dc6640f6..493fbde27 100644 --- a/src/aquaero.c +++ b/src/aquaero.c @@ -19,8 +19,6 @@ * Alex Deymo **/ -#define _BSD_SOURCE - #include "collectd.h" #include "common.h" #include "plugin.h" @@ -148,28 +146,29 @@ static int aquaero_read (void) /* Fans */ for (i = 0; i < AQ5_NUM_FAN; i++) { - if ((aq_sett.fan_data_source[i] != NONE) && (aq_data.fan_vrm_temp[i] != AQ5_FLOAT_UNDEF)) - { - snprintf(type_instance, sizeof(type_instance), "fan%d", i+1); - aquaero_submit("fanspeed", type_instance, aq_data.fan_rpm[i]); - snprintf(type_instance, sizeof(type_instance), "fan-vrm%d", i+1); - aquaero_submit("temperature", type_instance, aq_data.fan_vrm_temp[i]); + if ((aq_sett.fan_data_source[i] == NONE) || (aq_data.fan_vrm_temp[i] != AQ5_FLOAT_UNDEF)) + continue; - snprintf(type_instance, sizeof(type_instance), "fan%d", i+1); - aquaero_submit("percentage", type_instance, aq_data.fan_duty[i]); + /* Always report fanthe fan VRM (Voltage Regulator) temp if a regulator is installed. */ + snprintf(type_instance, sizeof(type_instance), "fan%d", i+1); + aquaero_submit("fanspeed", type_instance, aq_data.fan_rpm[i]); + snprintf(type_instance, sizeof(type_instance), "fan-vrm%d", i+1); + aquaero_submit("temperature", type_instance, aq_data.fan_vrm_temp[i]); - snprintf(type_instance, sizeof(type_instance), "fan%d", i+1); - aquaero_submit("voltage", type_instance, aq_data.fan_voltage[i]); - snprintf(type_instance, sizeof(type_instance), "fan%d", i+1); - aquaero_submit("current", type_instance, aq_data.fan_current[i]); - } + snprintf(type_instance, sizeof(type_instance), "fan%d", i+1); + aquaero_submit("percentage", type_instance, aq_data.fan_duty[i]); + + snprintf(type_instance, sizeof(type_instance), "fan%d", i+1); + aquaero_submit("voltage", type_instance, aq_data.fan_voltage[i]); + snprintf(type_instance, sizeof(type_instance), "fan%d", i+1); + aquaero_submit("current", type_instance, aq_data.fan_current[i]); } /* Flow sensors */ aquaero_submit_array("flow", "flow", aq_data.flow, AQ5_NUM_FLOW); /* Liquid level */ - aquaero_submit_array("level", "level", aq_data.level, AQ5_NUM_LEVEL); + aquaero_submit_array("percentage", "waterlevel", aq_data.level, AQ5_NUM_LEVEL); return (0); } From 186f1649312ccb9287a993d3d4c1a207edf50411 Mon Sep 17 00:00:00 2001 From: Alex Deymo Date: Tue, 13 Aug 2013 00:29:55 -0700 Subject: [PATCH 04/10] aquaero: Documentation for aquaero plugin. This patch includes the manpage, smaller config sample file and the README and AUTHORS description. --- AUTHORS | 3 +++ README | 3 +++ src/collectd.conf.in | 5 ----- src/collectd.conf.pod | 23 +++++++++++++++++++++++ 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/AUTHORS b/AUTHORS index adb74813b..2e6511b6c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -21,6 +21,9 @@ Akkarit Sangpetch Alessandro Iurlano - Initial filecount plugin. +Alex Deymo + - aquaero plugin. + Alvaro Barcellos - Don't-fork patch. diff --git a/README b/README index 3f65963ae..0b70eaa3d 100644 --- a/README +++ b/README @@ -26,6 +26,9 @@ Features Sensors in Macs running Mac OS X / Darwin: Temperature, fanspeed and voltage sensors. + - aquaero + Various sensors in the Aquaero 5 watercooling board made by Aquacomputer. + - ascent Statistics about Ascent, a free server for the game `World of Warcraft'. diff --git a/src/collectd.conf.in b/src/collectd.conf.in index a96f6752d..040b930cf 100644 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@ -240,12 +240,7 @@ # # -# # If you specify an empty string for the device (the default) it -# # will autodetect the first Aquaero 5 installed. # Device "" -# # Optionally, you can specify the device path, make sure the Aquaero -# # device is readable by collectd. -# #Device "/dev/usb/hiddev0" # # diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index 11db1ccdc..32f76a4a9 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -730,6 +730,29 @@ default for backwards compatibility, the time will be reported in minutes. =back +=head2 Plugin C + +This plugin collects the value of the available sensors in an Aquaero 5 board. +Aquaero 5 is a watercooling controller board, manufactured by Aqua Computer GmbH +L, with a USB2 connection for monitoring and +configuration. The board can handle multiple temperature sensors, fans, water +pumps and water level sensors and adjust the output settings such as fan voltage +or power the water pump based on the available inputs using a configurable +controller included in the board. This plugin collects all the available inputs +as well as some of the output values choosen by this controler. The plugin is +based on the libaquaero5 library provided by aquatools-ng. + +=over 4 + +=item B I + +Device path of the HID USB device, usually of the form /dev/usb/hiddevX, where +the Aquaero 5 device is. If this option is no set or is the empty string the +plugin will try to autodetect the first Aquaero 5 USB device based on the +VendorID and ProductID. + +=back + =head2 Plugin C This plugin collects information about an Ascent server, a free server for the From 0a323ec3edc8e76b7ebfc3106cce1dec65268b58 Mon Sep 17 00:00:00 2001 From: Alex Deymo Date: Tue, 13 Aug 2013 01:08:18 -0700 Subject: [PATCH 05/10] aquaero: Fix AC_CHECK configure setting for libaquaero5. --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 7c2de0f28..f074fe6fc 100644 --- a/configure.in +++ b/configure.in @@ -1519,7 +1519,7 @@ then then AC_MSG_NOTICE([libaquaero5 LDFLAGS: $LIBAQUAERO5_LDFLAGS]) fi - AC_CHECK_LIB(aquaero, libaquaero5_poll, + AC_CHECK_LIB(aquaero5, libaquaero5_poll, [with_libaquaero5="yes"], [with_libaquaero5="no (symbol 'libaquaero5_poll' not found)"]) fi From a88e21631bd89f50949aeb1a65ecd88aedb39ee3 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sun, 18 Aug 2013 10:53:25 +0200 Subject: [PATCH 06/10] configure.in: Check for the libaquaero5.o file in "obj/". This is what the aerotools-ng Makefile is currently using. --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index f074fe6fc..b396db649 100644 --- a/configure.in +++ b/configure.in @@ -1492,7 +1492,7 @@ AC_ARG_WITH(libaquaero5, [AS_HELP_STRING([--with-libaquaero5@<:@=PREFIX@:>@], [P else with_libaquaero5="yes" LIBAQUAERO5_CFLAGS="$LIBAQUAERO5_CFLAGS -I$withval/src" - LIBAQUAERO5_LDFLAGS="$LIBAQUAERO5_LDFLAGS -L$withval/lib" + LIBAQUAERO5_LDFLAGS="$LIBAQUAERO5_LDFLAGS -L$withval/obj" fi; fi ], [with_libaquaero5="yes"]) From d33c4140644f9dfc682adcbdba6643f6e49f582e Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sun, 18 Aug 2013 10:55:38 +0200 Subject: [PATCH 07/10] aquaero plugin: Some coding style fixes. * Break long lines. * Rename temperatures. The type instances are now "sensor", "virtual", "software" and "other". * Rename "flow-flow" to "flow-sensor". --- src/aquaero.c | 84 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 32 deletions(-) diff --git a/src/aquaero.c b/src/aquaero.c index 493fbde27..6e0d0d195 100644 --- a/src/aquaero.c +++ b/src/aquaero.c @@ -65,7 +65,8 @@ static int aquaero_shutdown (void) return (0); } /* int aquaero_shutdown */ -static void aquaero_submit (const char *type, const char *type_instance, double value) +static void aquaero_submit (const char *type, const char *type_instance, + double value) { const char *instance = conf_device?conf_device:"default"; value_t values[1]; @@ -90,17 +91,21 @@ static void aquaero_submit (const char *type, const char *type_instance, double } /* int aquaero_submit */ /* aquaero_submit_array submits every value of a given array of values */ -static void aquaero_submit_array (const char *type, const char *type_instance_prefix, double *value_array, int len) +static void aquaero_submit_array (const char *type, + const char *type_instance_prefix, double *value_array, int len) { char type_instance[DATA_MAX_NAME_LEN]; int i; for (i = 0; i < len; i++) - if (value_array[i] != AQ5_FLOAT_UNDEF) - { - snprintf(type_instance, sizeof(type_instance), "%s%d", type_instance_prefix, i+1); - aquaero_submit(type, type_instance, value_array[i]); - } + { + if (value_array[i] == AQ5_FLOAT_UNDEF) + continue; + + snprintf (type_instance, sizeof (type_instance), "%s%d", + type_instance_prefix, i + 1); + aquaero_submit (type, type_instance, value_array[i]); + } } static int aquaero_read (void) @@ -109,22 +114,24 @@ static int aquaero_read (void) aq5_settings_t aq_sett; char *err_msg = NULL; char type_instance[DATA_MAX_NAME_LEN]; - char errbuf[1024]; int i; if (libaquaero5_poll(conf_device, &aq_data, &err_msg) < 0) { - sstrerror(errno, errbuf, sizeof (errbuf)); - ERROR ("Failed to poll device '%s': %s (%s)", - conf_device?conf_device:"default", err_msg, errbuf); + char errbuf[1024]; + ERROR ("aquaero plugin: Failed to poll device \"%s\": %s (%s)", + conf_device ? conf_device : "default", err_msg, + sstrerror (errno, errbuf, sizeof (errbuf))); return (-1); } if (libaquaero5_getsettings(conf_device, &aq_sett, &err_msg) < 0) { - sstrerror(errno, errbuf, sizeof (errbuf)); - ERROR ("Failed to get settings for device '%s': %s (%s)\n", - conf_device?conf_device:"default", err_msg, errbuf); + char errbuf[1024]; + ERROR ("aquaero plugin: Failed to get settings " + "for device \"%s\": %s (%s)", + conf_device ? conf_device : "default", err_msg, + sstrerror (errno, errbuf, sizeof (errbuf))); return (-1); } @@ -132,43 +139,54 @@ static int aquaero_read (void) aquaero_submit("temperature", "cpu", aq_data.cpu_temp[0]); /* Temperature sensors */ - aquaero_submit_array("temperature", "temp", aq_data.temp, AQ5_NUM_TEMP); + aquaero_submit_array("temperature", "sensor", aq_data.temp, + AQ5_NUM_TEMP); /* Virtual temperature sensors */ - aquaero_submit_array("temperature", "virttemp", aq_data.vtemp, AQ5_NUM_VIRT_SENSORS); + aquaero_submit_array("temperature", "virtual", aq_data.vtemp, + AQ5_NUM_VIRT_SENSORS); /* Software temperature sensors */ - aquaero_submit_array("temperature", "softtemp", aq_data.stemp, AQ5_NUM_SOFT_SENSORS); + aquaero_submit_array("temperature", "software", aq_data.stemp, + AQ5_NUM_SOFT_SENSORS); /* Other temperature sensors */ - aquaero_submit_array("temperature", "othertemp", aq_data.otemp, AQ5_NUM_OTHER_SENSORS); + aquaero_submit_array("temperature", "other", aq_data.otemp, + AQ5_NUM_OTHER_SENSORS); /* Fans */ for (i = 0; i < AQ5_NUM_FAN; i++) { - if ((aq_sett.fan_data_source[i] == NONE) || (aq_data.fan_vrm_temp[i] != AQ5_FLOAT_UNDEF)) + if ((aq_sett.fan_data_source[i] == NONE) + || (aq_data.fan_vrm_temp[i] != AQ5_FLOAT_UNDEF)) continue; - /* Always report fanthe fan VRM (Voltage Regulator) temp if a regulator is installed. */ - snprintf(type_instance, sizeof(type_instance), "fan%d", i+1); - aquaero_submit("fanspeed", type_instance, aq_data.fan_rpm[i]); - snprintf(type_instance, sizeof(type_instance), "fan-vrm%d", i+1); - aquaero_submit("temperature", type_instance, aq_data.fan_vrm_temp[i]); + snprintf (type_instance, sizeof (type_instance), + "fan%d", i + 1); - snprintf(type_instance, sizeof(type_instance), "fan%d", i+1); - aquaero_submit("percentage", type_instance, aq_data.fan_duty[i]); + aquaero_submit ("fanspeed", type_instance, + aq_data.fan_rpm[i]); + aquaero_submit ("percentage", type_instance, + aq_data.fan_duty[i]); + aquaero_submit ("voltage", type_instance, + aq_data.fan_voltage[i]); + aquaero_submit ("current", type_instance, + aq_data.fan_current[i]); - snprintf(type_instance, sizeof(type_instance), "fan%d", i+1); - aquaero_submit("voltage", type_instance, aq_data.fan_voltage[i]); - snprintf(type_instance, sizeof(type_instance), "fan%d", i+1); - aquaero_submit("current", type_instance, aq_data.fan_current[i]); + /* Report the voltage reglator module (VRM) temperature with a + * different type instance. */ + snprintf (type_instance, sizeof (type_instance), + "fan%d-vrm", i + 1); + aquaero_submit ("temperature", type_instance, + aq_data.fan_vrm_temp[i]); } /* Flow sensors */ - aquaero_submit_array("flow", "flow", aq_data.flow, AQ5_NUM_FLOW); + aquaero_submit_array("flow", "sensor", aq_data.flow, AQ5_NUM_FLOW); /* Liquid level */ - aquaero_submit_array("percentage", "waterlevel", aq_data.level, AQ5_NUM_LEVEL); + aquaero_submit_array("percentage", "waterlevel", + aq_data.level, AQ5_NUM_LEVEL); return (0); } @@ -180,3 +198,5 @@ void module_register (void) plugin_register_read ("aquaero", aquaero_read); plugin_register_shutdown ("aquaero", aquaero_shutdown); } /* void module_register */ + +/* vim: set sw=8 sts=8 noet : */ From 3b48fc260dcba13ba4d32ddffa54c2ba5f715caa Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sun, 18 Aug 2013 10:56:28 +0200 Subject: [PATCH 08/10] aquaero plugin: Use the "complex" configuration. Actually less LOC. --- src/aquaero.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/src/aquaero.c b/src/aquaero.c index 6e0d0d195..84c797bcd 100644 --- a/src/aquaero.c +++ b/src/aquaero.c @@ -31,33 +31,25 @@ /* Default values for contacting daemon */ static char *conf_device = NULL; -static const char *config_keys[] = +static int aquaero_config (oconfig_item_t *ci) { - "Device", -}; -static int config_keys_num = STATIC_ARRAY_SIZE (config_keys); + int i; - -static int aquaero_config (const char *key, const char *value) -{ - if (strcasecmp (key, "Device") == 0) + for (i = 0; i < ci->children_num; i++) { - if (conf_device != NULL) + oconfig_item_t *child = ci->children + i; + + if (strcasecmp ("Device", child->key)) + cf_util_get_string (child, &conf_device); + else { - free (conf_device); - conf_device = NULL; + ERROR ("aquaero plugin: Unknown config option \"%s\".", + child->key); } - if (value[0] == '\0') - return (0); - if ((conf_device = strdup (value)) == NULL) - return (1); - } - else - { - return (-1); } + return (0); -} /* int aquaero_config */ +} static int aquaero_shutdown (void) { @@ -193,8 +185,7 @@ static int aquaero_read (void) void module_register (void) { - plugin_register_config ("aquaero", aquaero_config, config_keys, - config_keys_num); + plugin_register_complex_config ("aquaero", aquaero_config); plugin_register_read ("aquaero", aquaero_read); plugin_register_shutdown ("aquaero", aquaero_shutdown); } /* void module_register */ From 8139d94aa8a3e5f52ef4ae4357e394a7baf891fa Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sun, 18 Aug 2013 11:05:42 +0200 Subject: [PATCH 09/10] README: Add dependency "aerotools-ng". --- README | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README b/README index 0b70eaa3d..df50ed249 100644 --- a/README +++ b/README @@ -564,6 +564,14 @@ Prerequisites used and should be found in various implementations for hopefully all platforms. + * aerotools-ng (optional) + Used by the `aquaero' plugin. Currently, the `libaquaero5' library, which + is used by the `aerotools-ng' toolkit, is not compiled as a shared object + nor does it feature an installation routine. Therefore, you need to point + collectd's configure script at the source directory of the `aerotools-ng' + project. + + * CoreFoundation.framework and IOKit.framework (optional) For compiling on Darwin in general and the `apple_sensors' plugin in particular. From 4b4d7f3060c116e8f4fdb605c037a281a95de72f Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sun, 18 Aug 2013 11:13:27 +0200 Subject: [PATCH 10/10] collectd.conf(5): Improve markup of the aquaero plugin. --- src/collectd.conf.pod | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index 32f76a4a9..1add9752b 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -732,24 +732,24 @@ default for backwards compatibility, the time will be reported in minutes. =head2 Plugin C -This plugin collects the value of the available sensors in an Aquaero 5 board. -Aquaero 5 is a watercooling controller board, manufactured by Aqua Computer GmbH -L, with a USB2 connection for monitoring and -configuration. The board can handle multiple temperature sensors, fans, water -pumps and water level sensors and adjust the output settings such as fan voltage -or power the water pump based on the available inputs using a configurable -controller included in the board. This plugin collects all the available inputs -as well as some of the output values choosen by this controler. The plugin is -based on the libaquaero5 library provided by aquatools-ng. +This plugin collects the value of the available sensors in an +I5> board. AquaeroE5 is a water-cooling controller board, +manufactured by Aqua Computer GmbH L, with a USB2 +connection for monitoring and configuration. The board can handle multiple +temperature sensors, fans, water pumps and water level sensors and adjust the +output settings such as fan voltage or power used by the water pump based on +the available inputs using a configurable controller included in the board. +This plugin collects all the available inputs as well as some of the output +values chosen by this controller. The plugin is based on the I +library provided by I. =over 4 =item B I -Device path of the HID USB device, usually of the form /dev/usb/hiddevX, where -the Aquaero 5 device is. If this option is no set or is the empty string the -plugin will try to autodetect the first Aquaero 5 USB device based on the -VendorID and ProductID. +Device path of the AquaeroE5's USB HID (human interface device), usually +in the form C. If this option is no set the plugin will try +to auto-detect the Aquaero 5 USB device based on vendor-ID and product-ID. =back