author | Florian Forster <octo@collectd.org> | |
Sun, 18 Aug 2013 09:13:32 +0000 (11:13 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Sun, 18 Aug 2013 09:13:32 +0000 (11:13 +0200) |
AUTHORS | patch | blob | history | |
README | patch | blob | history | |
configure.in | patch | blob | history | |
src/Makefile.am | patch | blob | history | |
src/aquaero.c | [new file with mode: 0644] | patch | blob |
src/collectd.conf.in | patch | blob | history | |
src/collectd.conf.pod | patch | blob | history |
index 11b0475bdfbaf4962affa96423c3675c1cb758d4..31d132fbfa3c12cf27948ab5e1c9019ddab49adc 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
Alessandro Iurlano <alessandro.iurlano at gmail.com>
- Initial filecount plugin.
+Alex Deymo <deymo at chromium.org>
+ - aquaero plugin.
+
Alvaro Barcellos <alvaro.barcellos at gmail.com>
- Don't-fork patch.
index 23e0172636da2bd8bc2d4fa81d174b89aefcb7ad..c0d703633d7dce78bace8c356748578ba6e22a4a 100644 (file)
--- a/README
+++ b/README
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'.
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.
+ <https://github.com/lynix/aerotools-ng>
+
* CoreFoundation.framework and IOKit.framework (optional)
For compiling on Darwin in general and the `apple_sensors' plugin in
particular.
diff --git a/configure.in b/configure.in
index ea78352cf0041b0bef7398f3c0720583e046188e..16bffbaba6e403d0a26ac1ec3d4c8f3cf3dbdbc9 100644 (file)
--- a/configure.in
+++ b/configure.in
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/obj"
+ 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(aquaero5, 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.])],
[
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])
Configuration:
Libraries:
intel mic . . . . . . $with_mic
+ libaquaero5 . . . . . $with_libaquaero5
libcurl . . . . . . . $with_libcurl
libdbi . . . . . . . $with_libdbi
libcredis . . . . . . $with_libcredis
amqp . . . . . . . $enable_amqp
apache . . . . . . . $enable_apache
apcups . . . . . . . $enable_apcups
+ aquaero . . . . . . . $enable_aquaero
apple_sensors . . . . $enable_apple_sensors
ascent . . . . . . . $enable_ascent
battery . . . . . . . $enable_battery
diff --git a/src/Makefile.am b/src/Makefile.am
index bc2110efd4445d0fd58d9a4b4bf229263a1dc382..59454dc09fc12109219593098780f6e5fe29a016 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
collectd_DEPENDENCIES += apple_sensors.la
endif
+if BUILD_PLUGIN_AQUAERO
+pkglib_LTLIBRARIES += aquaero.la
+aquaero_la_SOURCES = aquaero.c
+aquaero_la_LDFLAGS = -module -avoid-version
+aquaero_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBAQUAERO5_CFLAGS)
+aquaero_la_LIBADD = $(BUILD_WITH_LIBAQUAERO5_LDFLAGS) -laquaero5
+collectd_LDADD += "-dlopen" aquaero.la
+collectd_DEPENDENCIES += aquaero.la
+endif
+
if BUILD_PLUGIN_ASCENT
pkglib_LTLIBRARIES += ascent.la
ascent_la_SOURCES = ascent.c
diff --git a/src/aquaero.c b/src/aquaero.c
--- /dev/null
+++ b/src/aquaero.c
@@ -0,0 +1,193 @@
+/**
+ * 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
+ **/
+
+#include "collectd.h"
+#include "common.h"
+#include "plugin.h"
+
+#include <libaquaero5.h>
+
+/*
+ * Private variables
+ */
+/* Default values for contacting daemon */
+static char *conf_device = NULL;
+
+static int aquaero_config (oconfig_item_t *ci)
+{
+ int i;
+
+ for (i = 0; i < ci->children_num; i++)
+ {
+ oconfig_item_t *child = ci->children + i;
+
+ if (strcasecmp ("Device", child->key))
+ cf_util_get_string (child, &conf_device);
+ else
+ {
+ ERROR ("aquaero plugin: Unknown config option \"%s\".",
+ child->key);
+ }
+ }
+
+ return (0);
+}
+
+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)
+ 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)
+{
+ aq5_data_t aq_data;
+ aq5_settings_t aq_sett;
+ char *err_msg = NULL;
+ char type_instance[DATA_MAX_NAME_LEN];
+ int i;
+
+ if (libaquaero5_poll(conf_device, &aq_data, &err_msg) < 0)
+ {
+ 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)
+ {
+ 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);
+ }
+
+ /* CPU Temperature sensor */
+ aquaero_submit("temperature", "cpu", aq_data.cpu_temp[0]);
+
+ /* Temperature sensors */
+ aquaero_submit_array("temperature", "sensor", aq_data.temp,
+ AQ5_NUM_TEMP);
+
+ /* Virtual temperature sensors */
+ aquaero_submit_array("temperature", "virtual", aq_data.vtemp,
+ AQ5_NUM_VIRT_SENSORS);
+
+ /* Software temperature sensors */
+ aquaero_submit_array("temperature", "software", aq_data.stemp,
+ AQ5_NUM_SOFT_SENSORS);
+
+ /* Other temperature 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))
+ continue;
+
+ snprintf (type_instance, sizeof (type_instance),
+ "fan%d", i + 1);
+
+ 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]);
+
+ /* 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", "sensor", aq_data.flow, AQ5_NUM_FLOW);
+
+ /* Liquid level */
+ aquaero_submit_array("percentage", "waterlevel",
+ aq_data.level, AQ5_NUM_LEVEL);
+
+ return (0);
+}
+
+void module_register (void)
+{
+ plugin_register_complex_config ("aquaero", aquaero_config);
+ plugin_register_read ("aquaero", aquaero_read);
+ plugin_register_shutdown ("aquaero", aquaero_shutdown);
+} /* void module_register */
+
+/* vim: set sw=8 sts=8 noet : */
diff --git a/src/collectd.conf.in b/src/collectd.conf.in
index e8d4d28ef026c1c09546cdc0d143de52a19bbed5..d4d5a205b89c7b3c784033c5083ac3f75a336f98 100644 (file)
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in
#@BUILD_PLUGIN_APACHE_TRUE@LoadPlugin apache
#@BUILD_PLUGIN_APCUPS_TRUE@LoadPlugin apcups
#@BUILD_PLUGIN_APPLE_SENSORS_TRUE@LoadPlugin apple_sensors
+#@BUILD_PLUGIN_AQUAERO_TRUE@LoadPlugin aquaero
#@BUILD_PLUGIN_ASCENT_TRUE@LoadPlugin ascent
#@BUILD_PLUGIN_BATTERY_TRUE@LoadPlugin battery
#@BUILD_PLUGIN_BIND_TRUE@LoadPlugin bind
# ReportSeconds true
#</Plugin>
+#<Plugin aquaero>
+# Device ""
+#</Plugin>
+
#<Plugin ascent>
# URL "http://localhost/ascent/status/"
# User "www-user"
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 0febb53b65633b3585f5f1df58397f28b8976b9f..691a7494fecf3b521cf3afb46dee4c7e85a9f4a3 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
=back
+=head2 Plugin C<aquaero>
+
+This plugin collects the value of the available sensors in an
+I<AquaeroE<nbsp>5> board. AquaeroE<nbsp>5 is a water-cooling controller board,
+manufactured by Aqua Computer GmbH L<http://www.aquacomputer.de/>, 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<libaquaero5>
+library provided by I<aquatools-ng>.
+
+=over 4
+
+=item B<Device> I<DevicePath>
+
+Device path of the AquaeroE<nbsp>5's USB HID (human interface device), usually
+in the form C</dev/usb/hiddevX>. 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
+
=head2 Plugin C<ascent>
This plugin collects information about an Ascent server, a free server for the