From: Florian Forster Date: Wed, 26 Mar 2008 08:48:27 +0000 (+0100) Subject: Merge branch 'collectd-4.2' into collectd-4.3 X-Git-Tag: collectd-4.3.2~3 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=bc0a8f260e4e24bdf664c3dcff919b6f99bfe31d;hp=ac03ae49d85c01fe2da58dd78f66db58416d81cc;p=collectd.git Merge branch 'collectd-4.2' into collectd-4.3 Conflicts: src/unixsock.c --- diff --git a/build.sh b/build.sh index 89d3a68e..3efb44f6 100755 --- a/build.sh +++ b/build.sh @@ -1,9 +1,15 @@ #! /bin/sh +libtoolize=libtoolize + +if which glibtoolize > /dev/null 2>&1; then + libtoolize=glibtoolize +fi + set -x autoheader \ && aclocal \ -&& libtoolize --ltdl --copy --force \ +&& $libtoolize --ltdl --copy --force \ && automake --add-missing --copy \ && autoconf diff --git a/configure.in b/configure.in index 460b9316..952f5c5d 100644 --- a/configure.in +++ b/configure.in @@ -1042,8 +1042,6 @@ AC_CHECK_LIB(IOKit, IOServiceGetMatchingServices, AC_DEFINE_UNQUOTED(COLLECT_LIBIOKIT, [$collect_libiokit], [Wether or not to use the IOKit library]) AM_CONDITIONAL(BUILD_WITH_LIBIOKIT, test "x$with_libiokit" = "xyes") -with_libstatgrab="yes" -with_libdevstat="no" AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])], [ if test "x$withval" != "xno" -a "x$withval" != "xyes" diff --git a/src/collectd-unixsock.pod b/src/collectd-unixsock.pod index d17852a7..3ef24386 100644 --- a/src/collectd-unixsock.pod +++ b/src/collectd-unixsock.pod @@ -83,12 +83,12 @@ plugin within collectd. I identifies the type and number of values (i.Ee. data-set) passed to collectd. A large list of predefined data-sets is available in the B file. -The I is an optional list of I, where each option if a +The I is an optional list of I, where each option is a key-value-pair. A list of currently understood options can be found below, all other options will be ignored. I is a colon-separated list of the time and the values, each either -an integer if the data-source is a counter, of a double if the data-source if +an integer if the data-source is a counter, or a double if the data-source is of type "gauge". You can submit an undefined gauge-value by using B. When submitting B to a counter the behavior is undefined. The time is given as epoch (i.Ee. standard UNIX time). @@ -207,10 +207,12 @@ value on failure and never return zero. =head1 ABSTRACTION LAYER -Shipped with the sourcecode comes the Perl-Module L which +B ships the Perl-Module L which provides an abstraction layer over the actual socket connection. It can be -found in the directory F. If you want to use Perl to -communicate with the daemon, you're encouraged to use and expand this module. +found in the directory F in the source distribution or +(usually) somewhere near F if you're using a package. If +you want to use Perl to communicate with the daemon, you're encouraged to use +and expand this module. =head1 SEE ALSO diff --git a/src/liboconfig/oconfig.c b/src/liboconfig/oconfig.c index db9285b3..8cc3c8ab 100644 --- a/src/liboconfig/oconfig.c +++ b/src/liboconfig/oconfig.c @@ -27,6 +27,7 @@ extern FILE *yyin; oconfig_item_t *ci_root; +char *c_file; static void yyset_in (FILE *fd) { @@ -38,8 +39,24 @@ oconfig_item_t *oconfig_parse_fh (FILE *fh) int status; oconfig_item_t *ret; + char file[10]; + yyset_in (fh); + if (NULL == c_file) { + int status; + + status = snprintf (file, sizeof (file), "", fileno (fh)); + + if ((status < 0) || (status >= sizeof (file))) { + c_file = ""; + } + else { + file[sizeof (file) - 1] = '\0'; + c_file = file; + } + } + status = yyparse (); if (status != 0) { @@ -47,6 +64,8 @@ oconfig_item_t *oconfig_parse_fh (FILE *fh) return (NULL); } + c_file = NULL; + ret = ci_root; ci_root = NULL; yyset_in ((FILE *) 0); @@ -59,6 +78,8 @@ oconfig_item_t *oconfig_parse_file (const char *file) FILE *fh; oconfig_item_t *ret; + c_file = file; + fh = fopen (file, "r"); if (fh == NULL) { @@ -69,6 +90,8 @@ oconfig_item_t *oconfig_parse_file (const char *file) ret = oconfig_parse_fh (fh); fclose (fh); + c_file = NULL; + return (ret); } /* oconfig_item_t *oconfig_parse_file */ diff --git a/src/liboconfig/parser.y b/src/liboconfig/parser.y index 8df2c6e5..49cd139d 100644 --- a/src/liboconfig/parser.y +++ b/src/liboconfig/parser.y @@ -30,6 +30,7 @@ extern int yylineno; extern char *yytext; extern oconfig_item_t *ci_root; +extern char *c_file; %} %start entire_file @@ -64,6 +65,9 @@ extern oconfig_item_t *ci_root; %type statement_list %type entire_file +/* pass an verbose, specific error message to yyerror() */ +%error-verbose + %% string: QUOTED_STRING {$$ = unquote ($1);} @@ -192,7 +196,15 @@ entire_file: %% static int yyerror (const char *s) { - fprintf (stderr, "Error in line %i near `%s': %s\n", yylineno, yytext, s); + char *text; + + if (*yytext == '\n') + text = ""; + else + text = yytext; + + fprintf (stderr, "Parse error in file `%s', line %i near `%s': %s\n", + c_file, yylineno, text, s); return (-1); } /* int yyerror */ diff --git a/src/perl.c b/src/perl.c index d17551ee..96e85622 100644 --- a/src/perl.c +++ b/src/perl.c @@ -1,6 +1,6 @@ /** * collectd - src/perl.c - * Copyright (C) 2007 Sebastian Harl + * Copyright (C) 2007, 2008 Sebastian Harl * * 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 diff --git a/src/sensors.c b/src/sensors.c index 1289d4b6..a96e04cc 100644 --- a/src/sensors.c +++ b/src/sensors.c @@ -341,16 +341,38 @@ static int sensors_load_conf (void) /* "master features" only */ if (feature->mapping != SENSORS_NO_MAPPING) + { + DEBUG ("sensors plugin: sensors_load_conf: " + "Ignoring subfeature `%s', " + "because (feature->mapping " + "!= SENSORS_NO_MAPPING).", + feature->name); continue; + } /* skip ignored in sensors.conf */ if (sensors_get_ignored (*chip, feature->number) == 0) - break; + { + DEBUG ("sensors plugin: sensors_load_conf: " + "Ignoring subfeature `%s', " + "because " + "`sensors_get_ignored' told " + "me so.", + feature->name); + continue; + } feature_type = sensors_feature_name_to_type ( feature->name); if (feature_type == SENSOR_TYPE_UNKNOWN) + { + DEBUG ("sensors plugin: sensors_load_conf: " + "Ignoring subfeature `%s', " + "because its type is " + "unknown.", + feature->name); continue; + } fl = (featurelist_t *) malloc (sizeof (featurelist_t)); if (fl == NULL) @@ -389,7 +411,13 @@ static int sensors_load_conf (void) if ((feature->type != SENSORS_FEATURE_IN) && (feature->type != SENSORS_FEATURE_FAN) && (feature->type != SENSORS_FEATURE_TEMP)) + { + DEBUG ("sensors plugin: sensors_load_conf: " + "Ignoring feature `%s', " + "because its type is not " + "supported.", feature->name); continue; + } while ((subfeature = sensors_get_all_subfeatures (chip, feature, &subfeature_num)) != NULL) diff --git a/src/wireless.c b/src/wireless.c index 48705989..285fb744 100644 --- a/src/wireless.c +++ b/src/wireless.c @@ -132,8 +132,8 @@ static int wireless_read (void) power = 1.0; /* invalid */ /* noise [dBm] < 0.0 */ - noise = strtod (fields[3], &endptr); - if (fields[3] == endptr) + noise = strtod (fields[4], &endptr); + if (fields[4] == endptr) noise = 1.0; /* invalid */ else if ((noise >= 0.0) && (noise <= 100.0)) noise = wireless_percent_to_power (noise);