fi
# }}}
+# --with-libdpdk {{{
+AC_ARG_WITH(libdpdk, [AS_HELP_STRING([--with-libdpdk@<:@=PREFIX@:>@], [Path to the DPDK build directory.])],
+[
+ if test "x$withval" != "xno" && test "x$withval" != "xyes"
+ then
+ RTE_BUILD="$withval"
+ with_libdpdk="yes"
+ else
+ RTE_BUILD="/usr"
+ with_libdpdk="$withval"
+ fi
+ DPDK_INCLUDE="$RTE_BUILD/include"
+ DPDK_LIB_DIR="$RTE_BUILD/lib"
+ FOUND_DPDK=yes
+], [with_libdpdk="no"])
+
+if test "x$with_libdpdk" = "xyes"
+then
+ LOCAL_DPDK_INSTALL="no"
+ AC_CHECK_HEADER([$DPDK_INCLUDE/rte_config.h], [LOCAL_DPDK_INSTALL=yes],
+ [AC_CHECK_HEADER([$DPDK_INCLUDE/dpdk/rte_config.h],
+ [],
+ [FOUND_DPDK=no], [])], [])
+
+ if test "x$LOCAL_DPDK_INSTALL" = "xno"
+ then
+ DPDK_INCLUDE=$DPDK_INCLUDE/dpdk
+ fi
+
+ if test "x$FOUND_DPDK" = "xno"
+ then
+ AC_MSG_ERROR([libdpdk error: rte_config.h not found])
+ fi
+fi
+
+if test "x$with_libdpdk" = "xyes"
+then
+ SAVE_LDFLAGS="$LDFLAGS"
+
+ if test "x$LOCAL_DPDK_INSTALL" != "xyes"
+ then
+ LDFLAGS="$LDFLAGS -L$DPDK_LIB_DIR"
+ fi
+
+ AC_CHECK_LIB(dpdk, rte_eal_init,
+ [BUILD_WITH_DPDK_LIBS="-Wl,-ldpdk"],
+ [FOUND_DPDK=no])
+
+ LDFLAGS="$SAVE_LDFLAGS"
+ if test "x$FOUND_DPDK" = "xno"
+ then
+ AC_MSG_ERROR([libdpdk error: cannot link with dpdk in $DPDK_LIB_DIR])
+ fi
+fi
+
+#
+# Note: An issue on Ubuntu 14.04 necessitates the use of -Wl,--no-as-needed:
+# If you try compile with the older linker, the dpdk symbols will be undefined.
+# This workaround should be removed when no longer necessary.
+#
+if test "x$with_libdpdk" = "xyes"
+then
+ BUILD_WITH_DPDK_CFLAGS+="-I$DPDK_INCLUDE"
+ if test "x$LOCAL_DPDK_INSTALL" != "xyes"
+ then
+ BUILD_WITH_DPDK_LDFLAGS="-Wl,--no-as-needed"
+ else
+ BUILD_WITH_DPDK_LDFLAGS="-L$DPDK_LIB_DIR -Wl,--no-as-needed"
+ fi
+ AC_SUBST(BUILD_WITH_DPDK_CFLAGS)
+ AC_SUBST(BUILD_WITH_DPDK_LDFLAGS)
+ AC_SUBST(BUILD_WITH_DPDK_LIBS)
+fi
+# }}}
+
# --with-java {{{
with_java_home="$JAVA_HOME"
if test "x$with_java_home" = "x"
AM_CONDITIONAL(BUILD_WITH_LIBPQ, test "x$with_libpq" = "xyes")
# }}}
+# --with-libpqos {{{
+with_libpqos_cppflags=""
+with_libpqos_ldflags=""
+AC_ARG_WITH(libpqos, [AS_HELP_STRING([--with-libpqos@<:@=PREFIX@:>@], [Path to libpqos.])],
+[
+ if test "x$withval" != "xno" && test "x$withval" != "xyes"
+ then
+ with_libpqos_cppflags="-I$withval/include"
+ with_libpqos_ldflags="-L$withval/lib"
+ with_libpqos="yes"
+ else
+ with_libpqos="$withval"
+ fi
+],
+[
+ with_libpqos="yes"
+])
+if test "x$with_libpqos" = "xyes"
+then
+ SAVE_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $with_libpqos_cppflags"
+
+ AC_CHECK_HEADERS(pqos.h, [with_libpqos="yes"], [with_libpqos="no (pqos.h not found)"])
+
+ CPPFLAGS="$SAVE_CPPFLAGS"
+fi
+if test "x$with_libpqos" = "xyes"
+then
+ SAVE_CPPFLAGS="$CPPFLAGS"
+ SAVE_LDFLAGS="$LDFLAGS"
+ CPPFLAGS="$CPPFLAGS $with_libpqos_cppflags"
+ LDFLAGS="$LDFLAGS $with_libpqos_ldflags"
+
+ AC_CHECK_LIB(pqos, pqos_init, [with_libpqos="yes"], [with_libpqos="no (Can't find libpqos)"])
+
+ CPPFLAGS="$SAVE_CPPFLAGS"
+ LDFLAGS="$SAVE_LDFLAGS"
+fi
+if test "x$with_libpqos" = "xyes"
+then
+ BUILD_WITH_LIBPQOS_CPPFLAGS="$with_libpqos_cppflags"
+ BUILD_WITH_LIBPQOS_LDFLAGS="$with_libpqos_ldflags"
+ BUILD_WITH_LIBPQOS_LIBS="-lpqos"
+ AC_SUBST(BUILD_WITH_LIBPQOS_CPPFLAGS)
+ AC_SUBST(BUILD_WITH_LIBPQOS_LDFLAGS)
+ AC_SUBST(BUILD_WITH_LIBPQOS_LIBS)
+fi
+# }}}
+
# --with-libprotobuf {{{
with_libprotobuf_cppflags=""
with_libprotobuf_ldflags=""
if test "x$with_librdkafka_log_cb" = "xyes"
then
AC_DEFINE(HAVE_LIBRDKAFKA_LOG_CB, 1, [Define if librdkafka log facility is present and usable.])
- fi
- if test "x$with_librdkafka_logger" = "xyes"
+ else if test "x$with_librdkafka_logger" = "xyes"
then
AC_DEFINE(HAVE_LIBRDKAFKA_LOGGER, 1, [Define if librdkafka log facility is present and usable.])
- fi
+ fi; fi
fi
CPPFLAGS="$SAVE_CPPFLAGS"
LDFLAGS="$SAVE_LDFLAGS"
plugin_df="no"
plugin_disk="no"
plugin_drbd="no"
+plugin_dpdk="no"
plugin_entropy="no"
plugin_ethstat="no"
plugin_fhcount="no"
plugin_fscache="no"
plugin_gps="no"
plugin_grpc="no"
+plugin_hugepages="no"
+plugin_intel_rdt="no"
plugin_interface="no"
plugin_ipmi="no"
plugin_ipvs="no"
plugin_entropy="yes"
plugin_fhcount="yes"
plugin_fscache="yes"
+ plugin_hugepages="yes"
plugin_interface="yes"
plugin_ipc="yes"
plugin_irq="yes"
AC_PLUGIN([df], [$plugin_df], [Filesystem usage statistics])
AC_PLUGIN([disk], [$plugin_disk], [Disk usage statistics])
AC_PLUGIN([dns], [$with_libpcap], [DNS traffic analysis])
+AC_PLUGIN([dpdkstat], [$with_libdpdk], [Stats & Status from DPDK])
AC_PLUGIN([drbd], [$plugin_drbd], [DRBD statistics])
AC_PLUGIN([email], [yes], [EMail statistics])
AC_PLUGIN([entropy], [$plugin_entropy], [Entropy statistics])
AC_PLUGIN([gps], [$plugin_gps], [GPS plugin])
AC_PLUGIN([grpc], [$plugin_grpc], [gRPC plugin])
AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
+AC_PLUGIN([hugepages], [$plugin_hugepages], [Hugepages statistics])
+AC_PLUGIN([intel_rdt], [$with_libpqos], [Intel RDT monitor plugin])
AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
AC_PLUGIN([ipc], [$plugin_ipc], [IPC statistics])
AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
AC_MSG_RESULT([ libatasmart . . . . . $with_libatasmart])
AC_MSG_RESULT([ libcurl . . . . . . . $with_libcurl])
AC_MSG_RESULT([ libdbi . . . . . . . $with_libdbi])
+AC_MSG_RESULT([ libdpdk . . . . . . . $with_libdpdk])
AC_MSG_RESULT([ libesmtp . . . . . . $with_libesmtp])
AC_MSG_RESULT([ libganglia . . . . . $with_libganglia])
AC_MSG_RESULT([ libgcrypt . . . . . . $with_libgcrypt])
AC_MSG_RESULT([ libperfstat . . . . . $with_perfstat])
AC_MSG_RESULT([ libperl . . . . . . . $with_libperl])
AC_MSG_RESULT([ libpq . . . . . . . . $with_libpq])
+AC_MSG_RESULT([ libpqos . . . . . . . $with_libpqos])
AC_MSG_RESULT([ libprotobuf . . . . . $with_libprotobuf])
AC_MSG_RESULT([ libprotobuf-c . . . . $with_libprotobuf_c])
AC_MSG_RESULT([ libpython . . . . . . $with_libpython])
AC_MSG_RESULT([ df . . . . . . . . . $enable_df])
AC_MSG_RESULT([ disk . . . . . . . . $enable_disk])
AC_MSG_RESULT([ dns . . . . . . . . . $enable_dns])
+AC_MSG_RESULT([ dpdkstat . . . . . . .$enable_dpdkstat])
AC_MSG_RESULT([ drbd . . . . . . . . $enable_drbd])
AC_MSG_RESULT([ email . . . . . . . . $enable_email])
AC_MSG_RESULT([ entropy . . . . . . . $enable_entropy])
AC_MSG_RESULT([ gps . . . . . . . . . $enable_gps])
AC_MSG_RESULT([ grpc . . . . . . . . $enable_grpc])
AC_MSG_RESULT([ hddtemp . . . . . . . $enable_hddtemp])
+AC_MSG_RESULT([ hugepages . . . . . . $enable_hugepages])
+AC_MSG_RESULT([ intel_rdt. . . . . . $enable_intel_rdt])
AC_MSG_RESULT([ interface . . . . . . $enable_interface])
AC_MSG_RESULT([ ipc . . . . . . . . . $enable_ipc])
AC_MSG_RESULT([ ipmi . . . . . . . . $enable_ipmi])
/*
* Private data types
*/
- struct apc_detail_s
+ typedef struct
{
- double linev;
- double loadpct;
- double bcharge;
- double timeleft;
- double outputv;
- double itemp;
- double battv;
- double linefreq;
- };
+ gauge_t linev;
+ gauge_t loadpct;
+ gauge_t bcharge;
+ gauge_t timeleft;
+ gauge_t outputv;
+ gauge_t itemp;
+ gauge_t battv;
+ gauge_t linefreq;
+ } apc_detail_t;
/*
* Private variables
/* Get and print status from apcupsd NIS server */
static int apc_query_server (char const *node, char const *service,
- struct apc_detail_s *apcups_detail)
+ apc_detail_t *apcups_detail)
{
int n;
char recvline[1024];
char *tokptr;
char *toksaveptr;
- char *key;
- double value;
_Bool retry = 1;
int status;
tokptr = strtok_r (recvline, " :\t", &toksaveptr);
while (tokptr != NULL)
{
- key = tokptr;
+ char *key = tokptr;
if ((tokptr = strtok_r (NULL, " :\t", &toksaveptr)) == NULL)
continue;
- value = atof (tokptr);
+
+ gauge_t value;
+ if (strtogauge (tokptr, &value) != 0)
+ continue;
PRINT_VALUE (key, value);
return (0);
} /* int apcups_config */
- static void apc_submit_generic (const char *type, const char *type_inst, double value)
+ static void apc_submit_generic (const char *type, const char *type_inst, gauge_t value)
{
- value_t values[1];
-- value_list_t vl = VALUE_LIST_INIT;
-
+ if (isnan (value))
+ return;
- values[0].gauge = value;
-
- vl.values = values;
++ value_list_t vl = VALUE_LIST_INIT;
+ vl.values = &(value_t) { .gauge = value };
vl.values_len = 1;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "apcups", sizeof (vl.plugin));
- sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance));
sstrncpy (vl.type, type, sizeof (vl.type));
sstrncpy (vl.type_instance, type_inst, sizeof (vl.type_instance));
plugin_dispatch_values (&vl);
}
- static void apc_submit (struct apc_detail_s *apcups_detail)
+ static void apc_submit (apc_detail_t const *apcups_detail)
{
apc_submit_generic ("voltage", "input", apcups_detail->linev);
apc_submit_generic ("voltage", "output", apcups_detail->outputv);
static int apcups_read (void)
{
- struct apc_detail_s apcups_detail;
- int status;
+ apc_detail_t apcups_detail = {
+ .linev = NAN,
+ .outputv = NAN,
+ .battv = NAN,
+ .loadpct = NAN,
+ .bcharge = NAN,
+ .timeleft = NAN,
+ .itemp = NAN,
+ .linefreq = NAN,
+ };
- apcups_detail.linev = -1.0;
- apcups_detail.outputv = -1.0;
- apcups_detail.battv = -1.0;
- apcups_detail.loadpct = -1.0;
- apcups_detail.bcharge = -1.0;
- apcups_detail.timeleft = NAN;
- apcups_detail.itemp = -300.0;
- apcups_detail.linefreq = -1.0;
-
- status = apc_query_server ((conf_node == NULL) ? APCUPS_DEFAULT_NODE : conf_node,
- (conf_service == NULL) ? APCUPS_DEFAULT_SERVICE : conf_service,
- &apcups_detail);
-
- /*
- * if we did not connect then do not bother submitting
- * zeros. We want rrd files to have NAN.
- */
+ int status = apc_query_server (conf_node == NULL
+ ? APCUPS_DEFAULT_NODE
+ : conf_node,
+ conf_service, &apcups_detail);
if (status != 0)
{
- DEBUG ("apcups plugin: apc_query_server (%s, %s) = %i",
- (conf_node == NULL) ? APCUPS_DEFAULT_NODE : conf_node,
- (conf_service == NULL) ? APCUPS_DEFAULT_SERVICE : conf_service,
- status);
- return (-1);
+ DEBUG ("apcups plugin: apc_query_server (\"%s\", \"%s\") = %d",
+ conf_node == NULL ? APCUPS_DEFAULT_NODE : conf_node,
+ conf_service, status);
+ return (status);
}
apc_submit (&apcups_detail);
static int32_t kafka_partition(const rd_kafka_topic_t *, const void *, size_t,
int32_t, void *, void *);
- #if defined HAVE_LIBRDKAFKA_LOGGER || defined HAVE_LIBRDKAFKA_LOG_CB
+ /* Version 0.9.0 of librdkafka deprecates rd_kafka_set_logger() in favor of
+ * rd_kafka_conf_set_log_cb(). This is to make sure we're not using the
+ * deprecated function. */
+ #ifdef HAVE_LIBRDKAFKA_LOG_CB
+ # undef HAVE_LIBRDKAFKA_LOGGER
+ #endif
+
+ #if defined(HAVE_LIBRDKAFKA_LOGGER) || defined(HAVE_LIBRDKAFKA_LOG_CB)
static void kafka_log(const rd_kafka_t *, int, const char *, const char *);
static void kafka_log(const rd_kafka_t *rkt, int level,
switch (ctx->format) {
case KAFKA_FORMAT_COMMAND:
- status = create_putval(buffer, sizeof(buffer), ds, vl);
+ status = cmd_create_putval(buffer, sizeof(buffer), ds, vl);
if (status != 0) {
- ERROR("write_kafka plugin: create_putval failed with status %i.",
+ ERROR("write_kafka plugin: cmd_create_putval failed with status %i.",
status);
return status;
}
ssnprintf(callback_name, sizeof(callback_name),
"write_kafka/%s", tctx->topic_name);
- user_data_t ud = {
- .data = tctx,
- .free_func = kafka_topic_context_free
- };
-
- status = plugin_register_write (callback_name, kafka_write, &ud);
+ status = plugin_register_write (callback_name, kafka_write,
+ &(user_data_t) {
+ .data = tctx,
+ .free_func = kafka_topic_context_free,
+ });
if (status != 0) {
WARNING ("write_kafka plugin: plugin_register_write (\"%s\") "
"failed with status %i.",