AC_HEADER_DIRENT
AC_CHECK_HEADERS(stdint.h)
AC_CHECK_HEADERS(errno.h)
+ AC_CHECK_HEADERS(math.h)
AC_CHECK_HEADERS(syslog.h)
AC_CHECK_HEADERS(fcntl.h)
AC_CHECK_HEADERS(signal.h)
AC_CHECK_HEADERS(utmp.h)
AC_CHECK_HEADERS(utmpx.h)
+# For apache plugin
+AC_CHECK_HEADERS(curl/curl.h)
+
# For quota module
AC_CHECK_HEADERS(grp.h pwd.h sys/ucred.h)
AC_CHECK_HEADERS(ctype.h)
[with_libresolv="no"])
AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes")
+with_libcurl="yes"
+AC_CHECK_LIB(curl, curl_easy_init,
+[
+ AC_DEFINE(HAVE_LIBCURL, 1, [Define to 1 if you have the 'curl' library (-lcurl).])
+],
+[with_libcurl="no"])
+AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes")
+
+if test "x$with_libcurl" = "xyes"
+then
+ with_libcurl_libs=`curl-config --libs`
+ if test "x$with_libcurl_libs" != "x"
+ then
+ BUILD_WITH_LIBCURL_LIBS="$with_libcurl_libs";
+ AC_SUBST(BUILD_WITH_LIBCURL_LIBS)
+ fi
+fi
+
m4_divert_once([HELP_WITH], [
collectd additional packages:])
[Wether or not to use mysql library])
AM_CONDITIONAL(BUILD_WITH_LIBMYSQL, test "x$with_libmysql" = "xyes")
+ # Define `step' and `hearbeat' values..
+ declare -i collectd_step=10
+ declare -i collectd_heartbeat=25
+ AC_ARG_WITH(step, [AS_HELP_STRING([--with-step=SECONDS], [Interval in which plugins are queried.])],
+ [
+ if test "x$withval" != "xno" -a "x$withval" != "xyes"
+ then
+ declare -i tmp_collectd_step="$withval"
+ if test $tmp_collectd_step -gt 0
+ then
+ collectd_step=$tmp_collectd_step
+ let "collectd_heartbeat=$collectd_step*2"
+ fi
+ fi
+ ], [])
+ AC_ARG_WITH(heartbeat, [AS_HELP_STRING([--with-heartbeat=SECONDS], [Heartbeat of the DS in generated RRD files.])],
+ [
+ if test "x$withval" != "xno" -a "x$withval" != "xyes"
+ then
+ declare -i tmp_collectd_heartbeat="$withval"
+ if test $tmp_collectd_heartbeat -gt 0
+ then
+ collectd_heartbeat=$tmp_collectd_heartbeat
+ fi
+ fi
+ ], [])
+
+ if test $collectd_step -ne 10
+ then
+ AC_DEFINE_UNQUOTED(COLLECTD_STEP, "$collectd_step", [Interval in which plugins are queried.])
+ fi
+ if test $collectd_heartbeat -ne 25
+ then
+ AC_DEFINE_UNQUOTED(COLLECTD_HEARTBEAT, "$collectd_heartbeat", [Interval in which plugins are queried.])
+ fi
+
#
# Check for enabled/disabled features
#
m4_divert_once([HELP_ENABLE], [
collectd modules:])
+AC_COLLECTD([apache], [disable], [module], [Apache httpd statistics])
AC_COLLECTD([battery], [disable], [module], [battery statistics])
AC_COLLECTD([cpu], [disable], [module], [cpu usage statistics])
AC_COLLECTD([cpufreq], [disable], [module], [system cpu frequency statistics])
Configuration:
Libraries:
+ libcurl . . . . . . $with_libcurl
librrd . . . . . . $with_rrdtool
lm_sensors . . . . $with_lm_sensors
libstatgrab . . . . $with_libstatgrab
Features:
debug . . . . . . . $enable_debug
daemon mode . . . . $enable_daemon
+ step . . . . . . . $collectd_step seconds
+ heartbeat . . . . . $collectd_heartbeat seconds
Modules:
battery . . . . . . $enable_battery
static char *ds_def[] =
{
- "DS:ping:GAUGE:25:0:65535",
+ "DS:ping:GAUGE:"COLLECTD_HEARTBEAT":0:65535",
NULL
};
static int ds_num = 1;
if (ping_host_add (pingobj, value) < 0)
{
- syslog (LOG_ERR, "ping: `ping_host_add' failed.\n");
- return (-1);
+ syslog (LOG_WARNING, "ping: `ping_host_add' failed.\n");
}
return (0);
static char *rrd_other = "vserver-%s/traffic-other.rrd";
static char *rrd_unspec = "vserver-%s/traffic-unspec.rrd";
-static char *rrd_thread = "vserver-%s/threads.rrd";
+static char *rrd_thread = "vserver-%s/vs_threads.rrd";
static char *rrd_load = "vserver-%s/load.rrd";
/* bytes transferred */
static char *ds_def_unix[] =
{
- "DS:incoming:COUNTER:25:0:9223372036854775807",
- "DS:outgoing:COUNTER:25:0:9223372036854775807",
- "DS:failed:COUNTER:25:0:9223372036854775807",
+ "DS:incoming:COUNTER:"COLLECTD_HEARTBEAT":0:9223372036854775807",
+ "DS:outgoing:COUNTER:"COLLECTD_HEARTBEAT":0:9223372036854775807",
+ "DS:failed:COUNTER:"COLLECTD_HEARTBEAT":0:9223372036854775807",
NULL
};
static int ds_num_unix = 3;
static char *ds_def_inet[] =
{
- "DS:incoming:COUNTER:25:0:9223372036854775807",
- "DS:outgoing:COUNTER:25:0:9223372036854775807",
- "DS:failed:COUNTER:25:0:9223372036854775807",
+ "DS:incoming:COUNTER:"COLLECTD_HEARTBEAT":0:9223372036854775807",
+ "DS:outgoing:COUNTER:"COLLECTD_HEARTBEAT":0:9223372036854775807",
+ "DS:failed:COUNTER:"COLLECTD_HEARTBEAT":0:9223372036854775807",
NULL
};
static int ds_num_inet = 3;
static char *ds_def_inet6[] =
{
- "DS:incoming:COUNTER:25:0:9223372036854775807",
- "DS:outgoing:COUNTER:25:0:9223372036854775807",
- "DS:failed:COUNTER:25:0:9223372036854775807",
+ "DS:incoming:COUNTER:"COLLECTD_HEARTBEAT":0:9223372036854775807",
+ "DS:outgoing:COUNTER:"COLLECTD_HEARTBEAT":0:9223372036854775807",
+ "DS:failed:COUNTER:"COLLECTD_HEARTBEAT":0:9223372036854775807",
NULL
};
static int ds_num_inet6 = 3;
static char *ds_def_other[] =
{
- "DS:incoming:COUNTER:25:0:9223372036854775807",
- "DS:outgoing:COUNTER:25:0:9223372036854775807",
- "DS:failed:COUNTER:25:0:9223372036854775807",
+ "DS:incoming:COUNTER:"COLLECTD_HEARTBEAT":0:9223372036854775807",
+ "DS:outgoing:COUNTER:"COLLECTD_HEARTBEAT":0:9223372036854775807",
+ "DS:failed:COUNTER:"COLLECTD_HEARTBEAT":0:9223372036854775807",
NULL
};
static int ds_num_other = 3;
static char *ds_def_unspec[] =
{
- "DS:incoming:COUNTER:25:0:9223372036854775807",
- "DS:outgoing:COUNTER:25:0:9223372036854775807",
- "DS:failed:COUNTER:25:0:9223372036854775807",
+ "DS:incoming:COUNTER:"COLLECTD_HEARTBEAT":0:9223372036854775807",
+ "DS:outgoing:COUNTER:"COLLECTD_HEARTBEAT":0:9223372036854775807",
+ "DS:failed:COUNTER:"COLLECTD_HEARTBEAT":0:9223372036854775807",
NULL
};
static int ds_num_unspec = 3;
static char *ds_def_threads[] =
{
- "DS:total:GAUGE:25:0:65535",
- "DS:running:GAUGE:25:0:65535",
- "DS:uninterruptible:GAUGE:25:0:65535",
- "DS:onhold:GAUGE:25:0:65535",
+ "DS:total:GAUGE:"COLLECTD_HEARTBEAT":0:65535",
+ "DS:running:GAUGE:"COLLECTD_HEARTBEAT":0:65535",
+ "DS:uninterruptible:GAUGE:"COLLECTD_HEARTBEAT":0:65535",
+ "DS:onhold:GAUGE:"COLLECTD_HEARTBEAT":0:65535",
NULL
};
static int ds_num_threads = 4;
static char *ds_def_load[] =
{
- "DS:shortterm:GAUGE:25:0:100",
- "DS:midterm:GAUGE:25:0:100",
- "DS:longterm:GAUGE:25:0:100",
+ "DS:shortterm:GAUGE:"COLLECTD_HEARTBEAT":0:100",
+ "DS:midterm:GAUGE:"COLLECTD_HEARTBEAT":0:100",
+ "DS:longterm:GAUGE:"COLLECTD_HEARTBEAT":0:100",
NULL
};
static int ds_num_load = 3;
static char *ds_def_procs[] =
{
- "DS:total:GAUGE:25:0:65535",
+ "DS:total:GAUGE:"COLLECTD_HEARTBEAT":0:65535",
NULL
};
static int ds_num_procs = 1;
/* bytes */
static char *ds_def_memory[] =
{
- "DS:vm:GAUGE:25:0:9223372036854775807",
- "DS:vml:GAUGE:25:0:9223372036854775807",
- "DS:rss:GAUGE:25:0:9223372036854775807",
- "DS:anon:GAUGE:25:0:9223372036854775807",
+ "DS:vm:GAUGE:"COLLECTD_HEARTBEAT":0:9223372036854775807",
+ "DS:vml:GAUGE:"COLLECTD_HEARTBEAT":0:9223372036854775807",
+ "DS:rss:GAUGE:"COLLECTD_HEARTBEAT":0:9223372036854775807",
+ "DS:anon:GAUGE:"COLLECTD_HEARTBEAT":0:9223372036854775807",
NULL
};
static int ds_num_memory = 4;
#include "common.h"
#include "plugin.h"
-#include <math.h>
-
#define MODULE_NAME "wireless"
#define BUFSIZE 1024
static char *ds_def[] =
{
- "DS:quality:GAUGE:25:0:U",
- "DS:power:GAUGE:25:U:0",
- "DS:noise:GAUGE:25:U:0",
+ "DS:quality:GAUGE:"COLLECTD_HEARTBEAT":0:U",
- "DS:power:GAUGE:"COLLECTD_HEARTBEAT":0:U",
- "DS:noise:GAUGE:"COLLECTD_HEARTBEAT":0:U",
++ "DS:power:GAUGE:"COLLECTD_HEARTBEAT":U:0",
++ "DS:noise:GAUGE:"COLLECTD_HEARTBEAT":U:0",
NULL
};
static int ds_num = 3;
}
#if WIRELESS_HAVE_READ
+#if 0
static double wireless_dbm_to_watt (double dbm)
{
double watt;
return (watt);
}
+#endif
static void wireless_submit (char *device,
double quality, double power, double noise)
power = atof (fields[3]);
noise = atof (fields[4]);
+ /* Fill in invalid values when conversion failed.. */
if (quality == 0.0)
- quality = -1.0;
+ quality = -1.0; /* quality >= 0 */
- if (power >= 0.0)
- power = -1.0;
- else
- power = wireless_dbm_to_watt (power);
+ if (power == 0.0)
+ power = 1.0; /* power <= 0 */
- if (noise >= 0.0)
- noise = -1.0;
- else
- noise = wireless_dbm_to_watt (noise);
+ if (noise == 0.0)
+ noise = 1.0; /* noise <= 0 */
wireless_submit (device, quality, power, noise);
}
void module_register (void)
{
- plugin_register (MODULE_NAME, wireless_init, wireless_read, wireless_write);
+ plugin_register (MODULE_NAME, wireless_init, wireless_read, wireless_write);
}
#undef BUFSIZE