Merge branch 'collectd-4.2' into collectd-4.3
authorFlorian Forster <octo@huhu.verplant.org>
Wed, 26 Mar 2008 08:48:27 +0000 (09:48 +0100)
committerFlorian Forster <octo@huhu.verplant.org>
Wed, 26 Mar 2008 08:48:27 +0000 (09:48 +0100)
Conflicts:

src/unixsock.c

build.sh
configure.in
src/collectd-unixsock.pod
src/liboconfig/oconfig.c
src/liboconfig/parser.y
src/perl.c
src/sensors.c
src/wireless.c

index 89d3a68..3efb44f 100755 (executable)
--- 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
index 460b931..952f5c5 100644 (file)
@@ -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"
index d17852a..3ef2438 100644 (file)
@@ -83,12 +83,12 @@ plugin within collectd. I<type> identifies the type and number of values
 (i.E<nbsp>e. data-set) passed to collectd. A large list of predefined
 data-sets is available in the B<types.db> file.
 
-The I<OptionList> is an optional list of I<Options>, where each option if a
+The I<OptionList> is an optional list of I<Options>, 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<Valuelist> 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<U>. When
 submitting B<U> to a counter the behavior is undefined. The time is given as
 epoch (i.E<nbsp>e. 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<Collectd::Unixsock> which
+B<collectd> ships the Perl-Module L<Collectd::Unixsock> which
 provides an abstraction layer over the actual socket connection. It can be
-found in the directory F<contrib/PerlLib>. 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<bindings/perl/> in the source distribution or
+(usually) somewhere near F</usr/share/perl5/> 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
 
index db9285b..8cc3c8a 100644 (file)
@@ -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), "<fd#%d>", fileno (fh));
+
+    if ((status < 0) || (status >= sizeof (file))) {
+      c_file = "<unknown>";
+    }
+    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 */
 
index 8df2c6e..49cd139 100644 (file)
@@ -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 <sl> statement_list
 %type <ci> 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 = "<newline>";
+       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 */
 
index d17551e..96e8562 100644 (file)
@@ -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
index 1289d4b..a96e04c 100644 (file)
@@ -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)
index 4870598..285fb74 100644 (file)
@@ -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);