Merge branch 'collectd-4.3' into collectd-4.4
authorFlorian Forster <octo@huhu.verplant.org>
Wed, 27 Aug 2008 08:12:55 +0000 (10:12 +0200)
committerFlorian Forster <octo@huhu.verplant.org>
Wed, 27 Aug 2008 08:12:55 +0000 (10:12 +0200)
.gitignore
bindings/perl/Collectd/Unixsock.pm
contrib/snmp-probe-host.px
src/memcached.c
src/perl.c

index 5d4fbca..03bd0c4 100644 (file)
@@ -44,6 +44,8 @@ src/*.la
 src/*.lo
 src/*.o
 src/collectd
+src/collectd-nagios
+src/collectdmon
 src/collectd*.1
 src/collectd*.5
 src/types.db.5
@@ -64,6 +66,12 @@ src/liboconfig/parser.c
 src/liboconfig/parser.h
 src/liboconfig/scanner.c
 
+# perl stuff:
+bindings/.perl-directory-stamp
+bindings/perl/Collectd/pm_to_blib
+bindings/perl/blib/
+bindings/perl/pm_to_blib
+
 # make dist stuff:
 collectd-*.tar.gz
 collectd-*.tar.bz2
index f21ebfe..29fac3e 100644 (file)
@@ -236,6 +236,12 @@ sub putval
        my $msg;
        my $identifier;
        my $values;
+       my $interval = "";
+
+       if (defined $args{'interval'})
+       {
+               $interval = ' interval=' . $args{'interval'};
+       }
 
        $identifier = _create_identifier (\%args) or return;
        if (!$args{'values'})
@@ -254,7 +260,7 @@ sub putval
                $values = join (':', $time, map { defined ($_) ? $_ : 'U' } (@{$args{'values'}}));
        }
 
-       $msg = "PUTVAL $identifier $values\n";
+       $msg = "PUTVAL $identifier$interval $values\n";
        #print "-> $msg";
        send ($fh, $msg, 0) or confess ("send: $!");
        $msg = undef;
index bb9f329..1d8f975 100755 (executable)
@@ -61,10 +61,13 @@ sub probe_one
   }
 
   @oids = split (/"\s*"/, $conf->{'values'});
-  if (($conf->{'table'} =~ m/^(true|yes|on)$/i) && ($conf->{'instance'}))
+  if ($conf->{'table'} =~ m/^(true|yes|on)$/i)
   {
     $cmd = 'GETNEXT';
-    push (@oids, $conf->{'instance'});
+    if (defined ($conf->{'instance'}))
+    {
+      push (@oids, $conf->{'instance'});
+    }
   }
 
   require Data::Dumper;
@@ -96,6 +99,14 @@ sub probe_one
       {
         return;
       }
+      if (!defined ($status))
+      {
+        return;
+      }
+      if ("$status" eq 'NOSUCHOBJECT')
+      {
+        return;
+      }
     }
     else
     {
@@ -213,11 +224,6 @@ sub probe_all
     $version--;
   } # while ($version > 0)
 
-  if (!@valid_data)
-  {
-    return;
-  }
-
   print <<EOF;
   <Host "$host">
     Address "$address"
@@ -228,6 +234,14 @@ EOF
   {
     print "    Collect \"$_\"\n";
   }
+  if (!@valid_data)
+  {
+    print <<EOF;
+# WARNING: Autoconfiguration failed.
+# TODO: Add one or more `Collect' statements here:
+#   Collect "foo"
+EOF
+  }
   print <<EOF;
     Interval 60
   </Host>
index 8d6f728..c3fa06b 100644 (file)
@@ -134,7 +134,7 @@ static int memcached_query_daemon (char *buffer, int buffer_size) /* {{{ */
                p.events = POLLIN | POLLERR | POLLHUP;
                p.revents = 0;
 
-               status = poll (&p, /* nfds = */ 1, /* timeout = */ interval_g);
+               status = poll (&p, /* nfds = */ 1, /* timeout = */ 1000 * interval_g);
                if (status <= 0)
                {
                        if (status == 0)
index cb61be5..84dd537 100644 (file)
@@ -1648,16 +1648,14 @@ static int perl_config (oconfig_item_t *ci)
 {
        int i = 0;
 
-       dTHX;
-
-       /* dTHX does not get any valid values in case Perl
-        * has not been initialized */
-       if (NULL == perl_threads)
-               aTHX = NULL;
+       dTHXa (NULL);
 
        for (i = 0; i < ci->children_num; ++i) {
                oconfig_item_t *c = ci->children + i;
 
+               if (NULL != perl_threads)
+                       aTHX = PERL_GET_CONTEXT;
+
                if (0 == strcasecmp (c->key, "LoadPlugin"))
                        perl_config_loadplugin (aTHX_ c);
                else if (0 == strcasecmp (c->key, "BaseName"))