Merge branch 'collectd-4.2'
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Thu, 8 Nov 2007 21:22:19 +0000 (22:22 +0100)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Thu, 8 Nov 2007 21:22:19 +0000 (22:22 +0100)
Conflicts:

src/types.db

12 files changed:
ChangeLog
contrib/README
contrib/collection.cgi
contrib/exec-munin.conf [new file with mode: 0644]
contrib/exec-munin.px [new file with mode: 0755]
contrib/fedora/collectd.spec
contrib/snmp-data.conf
src/exec.c
src/snmp.c
src/tcpconns.c
src/types.db
version-gen.sh

index ca0b034..5fe505a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-11-08, Version 4.2.1
+       * tcpconns plugin: Don't complain about a missing file if IPv6 is not
+         enabled on the host.
+       * snmp plugin: Fix a memory leak.
+
 2007-10-27, Version 4.2.0
        * collectd: The new config option `Include' lets you include other
          configfiles and thus split up your config into smaller parts. This
          to see how many connections your FTP server has to handle or how
          many outgoing connections your mailserver has open.
 
+2007-11-08, Version 4.1.4
+       * Build system: Improve detection of the rrd library, especially if
+         it's in a non-standard location.
+       * Build system: A bug when parsing the argument for
+         `--with-libnetsnmp' has been fixed.
+       * collectd: Implement `strerror_r' if the libc doesn't provide it.
+       * rrdtool plugin: Fix a bug in the shutdown sequence that might cause
+         a deadlock or delay when shutting down the daemon.
+       * snmp plugin: Fix a memory leak.
+
 2007-10-24, Version 4.1.3
        * collectd: A build issue under Solaris has been resolved by renaming
          data types.
index 2e9cbf5..398d13b 100644 (file)
@@ -38,6 +38,15 @@ should look something like this:
   datadir: "/var/lib/collectd/rrd/"
   libdir: "/usr/lib/collectd/"
 
+exec-munin.px
+-------------
+  Script to be used with the exec-plugin (see collectd-exec(5) for details)
+which executes munin plugins, parses the output and translates it to a format
+the exec-plugin understands. The features are limited - changing the munin
+plugins to use the output format understood by the exec-plugin is recommended.
+See the embedded POD documentation for more details:
+ $ perldoc contrib/exec-munin.px
+
 exec-smartctl
 -------------
   Sample script for the exec plugin. Please refer to the documentation in the
index 045b77b..7da7e1c 100755 (executable)
@@ -209,8 +209,8 @@ sub _find_plugins
     for (@tmp)
     {
       my ($plugin, $instance) = split (m/-/, $_, 2);
-      $plugins{$plugin} = [] if (!$plugins{$plugin});
-      push (@{$plugins{$plugin}}, $instance) if (defined ($instance));
+      $plugins{$plugin} = [] if (!exists $plugins{$plugin});
+      push (@{$plugins{$plugin}}, $instance);
     }
   } # for (@DataDirs)
 
@@ -267,9 +267,11 @@ sub _find_files_for_host
 
     for (@$plugin_instances)
     {
-      my $plugin_instance = $_;
+      my $plugin_instance = defined ($_) ? $_ : '-';
       my %types = _find_types ($host, $plugin,
-       ($plugin_instance ne '-') ? $plugin_instance : undef);
+       ($plugin_instance ne '-')
+       ? $plugin_instance
+       : undef);
 
       $ret->{$plugin}{$plugin_instance} = {};
 
@@ -1289,6 +1291,18 @@ sub load_graph_definitions
     'GPRINT:temp_max:MAX:%4.1lf Max,',
     'GPRINT:temp_avg:LAST:%4.1lf Last\l'
     ],
+    humidity => ['-v', 'Percent',
+    'DEF:temp_avg={file}:value:AVERAGE',
+    'DEF:temp_min={file}:value:MIN',
+    'DEF:temp_max={file}:value:MAX',
+    "AREA:temp_max#$HalfGreen",
+    "AREA:temp_min#$Canvas",
+    "LINE1:temp_avg#$FullGreen:Temperature",
+    'GPRINT:temp_min:MIN:%4.1lf%% Min,',
+    'GPRINT:temp_avg:AVERAGE:%4.1lf%% Avg,',
+    'GPRINT:temp_max:MAX:%4.1lf%% Max,',
+    'GPRINT:temp_avg:LAST:%4.1lf%% Last\l'
+    ],
     if_errors => ['-v', 'Errors/s',
     'DEF:tx_min={file}:tx:MIN',
     'DEF:tx_avg={file}:tx:AVERAGE',
@@ -1881,6 +1895,18 @@ sub load_graph_definitions
     'GPRINT:ping_avg:AVERAGE:%4.1lf ms Avg,',
     'GPRINT:ping_max:MAX:%4.1lf ms Max,',
     'GPRINT:ping_avg:LAST:%4.1lf ms Last'],
+    power => ['-v', 'Watt',
+    'DEF:avg={file}:value:AVERAGE',
+    'DEF:min={file}:value:MIN',
+    'DEF:max={file}:value:MAX',
+    "AREA:max#$HalfBlue",
+    "AREA:min#$Canvas",
+    "LINE1:avg#$FullBlue:Watt",
+    'GPRINT:min:MIN:%5.1lf%sW Min,',
+    'GPRINT:avg:AVERAGE:%5.1lf%sW Avg,',
+    'GPRINT:max:MAX:%5.1lf%sW Max,',
+    'GPRINT:avg:LAST:%5.1lf%sW Last\l'
+    ],
     processes => [
     "DEF:running_avg={file}:running:AVERAGE",
     "DEF:running_min={file}:running:MIN",
@@ -1943,18 +1969,27 @@ sub load_graph_definitions
     'GPRINT:sleeping_max:MAX:%5.1lf Max,',
     'GPRINT:sleeping_avg:LAST:%5.1lf Last\l'
     ],
-    ps_rss => [
-    'DEF:avg={file}:byte:AVERAGE',
-    'DEF:min={file}:byte:MIN',
-    'DEF:max={file}:byte:MAX',
-    "AREA:avg#$HalfBlue",
-    "LINE1:avg#$FullBlue:RSS",
-    'GPRINT:min:MIN:%5.1lf%s Min,',
-    'GPRINT:avg:AVERAGE:%5.1lf%s Avg,',
-    'GPRINT:max:MAX:%5.1lf%s Max,',
-    'GPRINT:avg:LAST:%5.1lf%s Last\l'
+    ps_count => ['-v', 'Processes',
+    'DEF:procs_avg={file}:processes:AVERAGE',
+    'DEF:procs_min={file}:processes:MIN',
+    'DEF:procs_max={file}:processes:MAX',
+    'DEF:thrds_avg={file}:threads:AVERAGE',
+    'DEF:thrds_min={file}:threads:MIN',
+    'DEF:thrds_max={file}:threads:MAX',
+    "AREA:thrds_avg#$HalfBlue",
+    "AREA:procs_avg#$HalfRed",
+    "LINE1:thrds_avg#$FullBlue:Threads  ",
+    'GPRINT:thrds_min:MIN:%5.1lf Min,',
+    'GPRINT:thrds_avg:AVERAGE:%5.1lf Avg,',
+    'GPRINT:thrds_max:MAX:%5.1lf Max,',
+    'GPRINT:thrds_avg:LAST:%5.1lf Last\l',
+    "LINE1:procs_avg#$FullRed:Processes",
+    'GPRINT:procs_min:MIN:%5.1lf Min,',
+    'GPRINT:procs_avg:AVERAGE:%5.1lf Avg,',
+    'GPRINT:procs_max:MAX:%5.1lf Max,',
+    'GPRINT:procs_avg:LAST:%5.1lf Last\l'
     ],
-    ps_cputime => [
+    ps_cputime => ['-v', 'Jiffies',
     'DEF:user_avg_raw={file}:user:AVERAGE',
     'DEF:user_min_raw={file}:user:MIN',
     'DEF:user_max_raw={file}:user:MAX',
@@ -1981,27 +2016,7 @@ sub load_graph_definitions
     'GPRINT:syst_max:MAX:%5.1lf%s Max,',
     'GPRINT:syst_avg:LAST:%5.1lf%s Last\l'
     ],
-    ps_count => [
-    'DEF:procs_avg={file}:processes:AVERAGE',
-    'DEF:procs_min={file}:processes:MIN',
-    'DEF:procs_max={file}:processes:MAX',
-    'DEF:thrds_avg={file}:threads:AVERAGE',
-    'DEF:thrds_min={file}:threads:MIN',
-    'DEF:thrds_max={file}:threads:MAX',
-    "AREA:thrds_avg#$HalfBlue",
-    "AREA:procs_avg#$HalfRed",
-    "LINE1:thrds_avg#$FullBlue:Threads  ",
-    'GPRINT:thrds_min:MIN:%5.1lf Min,',
-    'GPRINT:thrds_avg:AVERAGE:%5.1lf Avg,',
-    'GPRINT:thrds_max:MAX:%5.1lf Max,',
-    'GPRINT:thrds_avg:LAST:%5.1lf Last\l',
-    "LINE1:procs_avg#$FullRed:Processes",
-    'GPRINT:procs_min:MIN:%5.1lf Min,',
-    'GPRINT:procs_avg:AVERAGE:%5.1lf Avg,',
-    'GPRINT:procs_max:MAX:%5.1lf Max,',
-    'GPRINT:procs_avg:LAST:%5.1lf Last\l'
-    ],
-    ps_pagefaults => [
+    ps_pagefaults => ['-v', 'Pagefaults/s',
     'DEF:minor_avg={file}:minflt:AVERAGE',
     'DEF:minor_min={file}:minflt:MIN',
     'DEF:minor_max={file}:minflt:MAX',
@@ -2022,6 +2037,17 @@ sub load_graph_definitions
     'GPRINT:major_max:MAX:%5.1lf%s Max,',
     'GPRINT:major_avg:LAST:%5.1lf%s Last\l'
     ],
+    ps_rss => ['-v', 'Bytes',
+    'DEF:avg={file}:value:AVERAGE',
+    'DEF:min={file}:value:MIN',
+    'DEF:max={file}:value:MAX',
+    "AREA:avg#$HalfBlue",
+    "LINE1:avg#$FullBlue:RSS",
+    'GPRINT:min:MIN:%5.1lf%s Min,',
+    'GPRINT:avg:AVERAGE:%5.1lf%s Avg,',
+    'GPRINT:max:MAX:%5.1lf%s Max,',
+    'GPRINT:avg:LAST:%5.1lf%s Last\l'
+    ],
     ps_state => ['-v', 'Processes',
     'DEF:avg={file}:value:AVERAGE',
     'DEF:min={file}:value:MIN',
@@ -2139,7 +2165,7 @@ sub load_graph_definitions
     'GPRINT:temp_max:MAX:%4.1lf Max,',
     'GPRINT:temp_avg:LAST:%4.1lf Last\l'
     ],
-    timeleft => [
+    timeleft => ['-v', 'Minutes',
     'DEF:avg={file}:timeleft:AVERAGE',
     'DEF:min={file}:timeleft:MIN',
     'DEF:max={file}:timeleft:MAX',
@@ -2223,7 +2249,7 @@ sub load_graph_definitions
     'GPRINT:multimeter_max:MAX:%4.1lf Max,',
     'GPRINT:multimeter_avg:LAST:%4.1lf Last\l'
     ],
-    users => [
+    users => ['-v', 'Users',
     'DEF:users_avg={file}:users:AVERAGE',
     'DEF:users_min={file}:users:MIN',
     'DEF:users_max={file}:users:MAX',
@@ -2457,6 +2483,8 @@ sub meta_graph_cpu
   $opts->{'title'} = "$host/$plugin"
   . (defined ($plugin_instance) ? "-$plugin_instance" : '') . "/$type";
 
+  $opts->{'rrd_opts'} = ['-v', 'Percent'];
+
   my @files = ();
 
   $opts->{'colors'} =
@@ -2714,6 +2742,7 @@ sub meta_graph_ps_state
 
   $opts->{'title'} = "$host/$plugin"
   . (defined ($plugin_instance) ? "-$plugin_instance" : '') . "/$type";
+  $opts->{'rrd_opts'} = ['-v', 'Processes'];
 
   my @files = ();
 
@@ -2773,6 +2802,7 @@ sub meta_graph_swap
   $opts->{'title'} = "$host/$plugin"
   . (defined ($plugin_instance) ? "-$plugin_instance" : '') . "/$type";
   $opts->{'number_format'} = '%5.1lf%s';
+  $opts->{'rrd_opts'} = ['-v', 'Bytes'];
 
   my @files = ();
 
@@ -2851,7 +2881,7 @@ sub meta_graph_tcp_connections
   };
 
   _custom_sort_arrayref ($type_instances,
-    [qw(ESTABLISHED SYN_SENT SYN_RECV FIN_WAIT1 FIN_WAIT2 TIME_WAIT CLOSE
+    [reverse qw(ESTABLISHED SYN_SENT SYN_RECV FIN_WAIT1 FIN_WAIT2 TIME_WAIT CLOSE
     CLOSE_WAIT LAST_ACK CLOSING LISTEN)]);
 
   for (@$type_instances)
diff --git a/contrib/exec-munin.conf b/contrib/exec-munin.conf
new file mode 100644 (file)
index 0000000..d7c31a4
--- /dev/null
@@ -0,0 +1,6 @@
+AddType temperature temperature
+
+Interval 300
+
+Script /tmp/ipmisens2
+Script /tmp/munin-sensors.pl
diff --git a/contrib/exec-munin.px b/contrib/exec-munin.px
new file mode 100755 (executable)
index 0000000..e6c8128
--- /dev/null
@@ -0,0 +1,248 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+=head1 NAME
+
+exec-munin.px
+
+=head1 DESCRIPTION
+
+This script allows you to use plugins that were written for Munin with
+collectd's C<exec-plugin>. Since the data models of Munin and collectd are
+quite different rewriting the plugins should be preferred over using this
+transition layer. Having more than one "data source" for one "data set" doesn't
+work with this script, for example.
+
+=cut
+
+use Sys::Hostname ('hostname');
+use File::Basename ('basename');
+use Config::General ('ParseConfig');
+use Regexp::Common ('number');
+
+our $ConfigFile = '/etc/exec-munin.conf';
+our $TypeMap = {};
+our $Scripts = [];
+our $Interval = 300;
+
+main ();
+exit (0);
+
+# Configuration
+# {{{
+
+=head1 CONFIGURATION
+
+This script reads it's configuration from F</etc/exec-munin.conf>. The
+configuration is read using C<Config::General> which understands a Apache-like
+config syntax, so it's very similar to the F<collectd.conf> syntax, too.
+
+Here's a short sample config:
+
+  AddType voltage-in in
+  AddType voltage-out out
+  Interval 300
+  Script /usr/lib/munin/plugins/nut
+
+The options have the following semantic (i.E<nbsp>e. meaning):
+
+=over 4
+
+=item B<AddType> I<to> I<from> [I<from> ...]
+
+collectd uses B<types> to specify how data is structured. In Munin all data is
+structured the same way, so some way of telling collectd how to handle the data
+is needed. This option translates the so called "field names" of Munin to the
+"types" of collectd. If more than one field are of the same type, e.E<nbsp>g.
+the C<nut> plugin above provides C<in> and C<out> which are both voltages, you
+can use a hyphen to add a "type instance" to the type.
+
+For a list of already defined "types" look at the F<types.db> file in
+collectd's library path, e.E<nbsp>g. F</usr/lib/collectd/>.
+
+=item B<Interval> I<Seconds>
+
+Sets the interval in which the plugins are executed. This doesn't need to match
+the interval setting of the collectd daemon. Usually, you want to execute the
+Munin plugins much less often, e.E<nbsp>g. every 300 seconds versus every 10
+seconds.
+
+=item B<Script> I<File>
+
+Adds a script to the list of scripts to be executed once per I<Interval>
+seconds.
+
+=back
+
+=cut
+
+sub handle_config_addtype
+{
+  my $list = shift;
+
+  for (my $i = 0; $i < @$list; $i++)
+  {
+    my ($to, @from) = split (' ', $list->[$i]);
+    for (my $j = 0; $j < @from; $j++)
+    {
+      $TypeMap->{$from[$j]} = $to;
+    }
+  }
+} # handle_config_addtype
+
+sub handle_config_script
+{
+  my $scripts = shift;
+
+  for (my $i = 0; $i < @$scripts; $i++)
+  {
+    my $script = $scripts->[$i];
+    if (!-e $script)
+    {
+      print STDERR "Script `$script' doesn't exist.\n";
+    }
+    elsif (!-x $script)
+    {
+      print STDERR "Script `$script' exists but is not executable.\n";
+    }
+    else
+    {
+      push (@$Scripts, $script);
+    }
+  } # for $i
+} # handle_config_script
+
+sub handle_config
+{
+  my $config = shift;
+
+  if (defined ($config->{'addtype'}))
+  {
+    if (ref ($config->{'addtype'}) eq 'ARRAY')
+    {
+      handle_config_addtype ($config->{'addtype'});
+    }
+    elsif (ref ($config->{'addtype'}) eq '')
+    {
+      handle_config_addtype ([$config->{'addtype'}]);
+    }
+    else
+    {
+      print STDERR "Cannot handle ref type '"
+      . ref ($config->{'addtype'}) . "' for option 'AddType'.\n";
+    }
+  }
+
+  if (defined ($config->{'script'}))
+  {
+    if (ref ($config->{'script'}) eq 'ARRAY')
+    {
+      handle_config_script ($config->{'script'});
+    }
+    elsif (ref ($config->{'script'}) eq '')
+    {
+      handle_config_addtype ([$config->{'script'}]);
+    }
+    else
+    {
+      print STDERR "Cannot handle ref type '"
+      . ref ($config->{'script'}) . "' for option 'Script'.\n";
+    }
+  }
+
+  if (defined ($config->{'interval'})
+    && (ref ($config->{'interval'}) eq ''))
+  {
+    my $num = int ($config->{'interval'});
+    if ($num > 0)
+    {
+      $Interval = $num;
+    }
+  }
+} # handle_config }}}
+
+sub execute_script
+{
+  my $fh;
+  my $pinst;
+  my $time = time ();
+  my $script = shift;
+  my $host = hostname () || 'localhost';
+  if (!open ($fh, '-|', $script))
+  {
+    print STDERR "Cannot execute $script: $!";
+    return;
+  }
+
+  $pinst = basename ($script);
+
+  while (my $line = <$fh>)
+  {
+    chomp ($line);
+    if ($line =~ m#^([^\.\-/]+)\.value\s+($RE{num}{real})#)
+    {
+      my $field = $1;
+      my $value = $2;
+      my $type = (defined ($TypeMap->{$field})) ? $TypeMap->{$field} : $field;
+
+      print "$host/munin-$pinst/$type interval=$Interval $time:$value\n";
+    }
+  }
+
+  close ($fh);
+} # execute_script
+
+sub main
+{
+  my $last_run;
+  my $next_run;
+
+  my %config = ParseConfig (-ConfigFile => $ConfigFile,
+    -AutoTrue => 1,
+    -LowerCaseNames => 1);
+  handle_config (\%config);
+
+  while (42)
+  {
+    $last_run = time ();
+    $next_run = $last_run + $Interval;
+
+    for (@$Scripts)
+    {
+      execute_script ($_);
+    }
+
+    while ((my $timeleft = ($next_run - time ())) > 0)
+    {
+      sleep ($timeleft);
+    }
+  }
+} # main
+
+=head1 REQUIREMENTS
+
+This script requires the following Perl modules to be installed:
+
+=over 4
+
+=item C<Config::General>
+
+=item C<Regexp::Common>
+
+=back
+
+=head1 SEE ALSO
+
+L<http://munin.projects.linpro.no/>,
+L<http://collectd.org/>,
+L<collectd-exec(5)>
+
+=head1 AUTHOR
+
+Florian octo Forster E<lt>octo at verplant.orgE<gt>
+
+=cut
+
+# vim: set sw=2 sts=2 ts=8 fdm=marker :
index d9f0552..89ce123 100644 (file)
@@ -1,13 +1,17 @@
 Summary:       Statistics collection daemon for filling RRD files.
 Name:           collectd
-Version:       4.0.6
-Release:       0.fc7
+Version:       4.2.0
+Release:       1.fc6
 Source:                http://collectd.org/files/%{name}-%{version}.tar.gz
 License:       GPL
 Group:         System Environment/Daemons
 BuildRoot:     %{_tmppath}/%{name}-%{version}-root
-BuildPrereq:   lm_sensors-devel, mysql-devel, rrdtool-devel
+BuildPrereq:   lm_sensors-devel
+BuildPrereq:   mysql-devel
+BuildPrereq:   rrdtool-devel
+BuildPrereq:   net-snmp-devel
 Requires:      rrdtool
+Requires:      perl-Regexp-Common
 Packager:      Florian octo Forster <octo@verplant.org>
 Vendor:                Florian octo Forster <octo@verplant.org>
 
@@ -63,6 +67,7 @@ mkdir -p $RPM_BUILD_ROOT/var/www/cgi-bin
 cp src/collectd.conf $RPM_BUILD_ROOT/etc/collectd.conf
 cp contrib/fedora/init.d-collectd $RPM_BUILD_ROOT/etc/rc.d/init.d/collectd
 cp contrib/collection.cgi $RPM_BUILD_ROOT/var/www/cgi-bin
+cp contrib/collection.conf $RPM_BUILD_ROOT/etc/collection.conf
 mkdir -p $RPM_BUILD_ROOT/var/lib/collectd
 
 %clean
@@ -90,6 +95,7 @@ exit 0
 %defattr(-,root,root)
 %doc AUTHORS COPYING ChangeLog INSTALL NEWS README
 %attr(0644,root,root) %config(noreplace) /etc/collectd.conf
+%attr(0644,root,root) %config(noreplace) /etc/collection.conf
 %attr(0755,root,root) /etc/rc.d/init.d/collectd
 %attr(0755,root,root) /var/www/cgi-bin/collection.cgi
 %attr(0755,root,root) %{_sbindir}/collectd
@@ -97,11 +103,18 @@ exit 0
 %attr(0644,root,root) %{_mandir}/man1/*
 %attr(0644,root,root) %{_mandir}/man5/*
 
+%attr(0644,root,root) /usr/lib/perl5/5.8.8/i386-linux-thread-multi/perllocal.pod
+%attr(0644,root,root) /usr/lib/perl5/site_perl/5.8.8/Collectd.pm
+%attr(0644,root,root) /usr/lib/perl5/site_perl/5.8.8/Collectd/Unixsock.pm
+%attr(0644,root,root) /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/Collectd/.packlist
+%attr(0644,root,root) %{_mandir}/man3/Collectd::Unixsock.3pm.gz
+
 %attr(0644,root,root) %{_libdir}/%{name}/apcups.so*
 %attr(0644,root,root) %{_libdir}/%{name}/apcups.la
 
-%attr(0644,root,root) %{_libdir}/%{name}/apple_sensors.so*
-%attr(0644,root,root) %{_libdir}/%{name}/apple_sensors.la
+# FIXME!!!
+#%attr(0644,root,root) %{_libdir}/%{name}/apple_sensors.so*
+#%attr(0644,root,root) %{_libdir}/%{name}/apple_sensors.la
 
 %attr(0644,root,root) %{_libdir}/%{name}/battery.so*
 %attr(0644,root,root) %{_libdir}/%{name}/battery.la
@@ -148,9 +161,12 @@ exit 0
 %attr(0644,root,root) %{_libdir}/%{name}/logfile.so*
 %attr(0644,root,root) %{_libdir}/%{name}/logfile.la
 
-%attr(0644,root,root) %{_libdir}/%{name}/mbmon.so
+%attr(0644,root,root) %{_libdir}/%{name}/mbmon.so*
 %attr(0644,root,root) %{_libdir}/%{name}/mbmon.la
 
+%attr(0644,root,root) %{_libdir}/%{name}/memcached.so*
+%attr(0644,root,root) %{_libdir}/%{name}/memcached.la
+
 %attr(0644,root,root) %{_libdir}/%{name}/memory.so*
 %attr(0644,root,root) %{_libdir}/%{name}/memory.la
 
@@ -163,11 +179,15 @@ exit 0
 %attr(0644,root,root) %{_libdir}/%{name}/nfs.so*
 %attr(0644,root,root) %{_libdir}/%{name}/nfs.la
 
+%attr(0644,root,root) %{_libdir}/%{name}/nginx.so*
+%attr(0644,root,root) %{_libdir}/%{name}/nginx.la
+
 %attr(0644,root,root) %{_libdir}/%{name}/ntpd.so*
 %attr(0644,root,root) %{_libdir}/%{name}/ntpd.la
 
-%attr(0644,root,root) %{_libdir}/%{name}/nut.so*
-%attr(0644,root,root) %{_libdir}/%{name}/nut.la
+# FIXME!!!
+#%attr(0644,root,root) %{_libdir}/%{name}/nut.so*
+#%attr(0644,root,root) %{_libdir}/%{name}/nut.la
 
 %attr(0644,root,root) %{_libdir}/%{name}/perl.so*
 %attr(0644,root,root) %{_libdir}/%{name}/perl.la
@@ -187,11 +207,18 @@ exit 0
 %attr(0644,root,root) %{_libdir}/%{name}/swap.so*
 %attr(0644,root,root) %{_libdir}/%{name}/swap.la
 
+%attr(0644,root,root) %{_libdir}/%{name}/snmp.so*
+%attr(0644,root,root) %{_libdir}/%{name}/snmp.la
+
 %attr(0644,root,root) %{_libdir}/%{name}/syslog.so*
 %attr(0644,root,root) %{_libdir}/%{name}/syslog.la
 
-%attr(0644,root,root) %{_libdir}/%{name}/tape.so*
-%attr(0644,root,root) %{_libdir}/%{name}/tape.la
+# FIXME!!!
+#%attr(0644,root,root) %{_libdir}/%{name}/tape.so*
+#%attr(0644,root,root) %{_libdir}/%{name}/tape.la
+
+%attr(0644,root,root) %{_libdir}/%{name}/tcpconns.so*
+%attr(0644,root,root) %{_libdir}/%{name}/tcpconns.la
 
 %attr(0644,root,root) %{_libdir}/%{name}/unixsock.so*
 %attr(0644,root,root) %{_libdir}/%{name}/unixsock.la
@@ -226,11 +253,15 @@ exit 0
 %attr(0644,root,root) %{_libdir}/%{name}/sensors.la
 
 %changelog
+* Wed Oct 31 2007 Iain Lea <iain@bricbrac.de> 4.2.0
+- New major release
+- Changes to support 4.2.0 (ie. contrib/collection.conf)
+
 * Mon Aug 06 2007 Kjell Randa <Kjell.Randa@broadpark.no> 4.0.6
 - New upstream version
 
 * Wed Jul 25 2007 Kjell Randa <Kjell.Randa@broadpark.no> 4.0.5
-- New major releas
+- New major release
 - Changes to support 4.0.5 
 
 * Wed Jan 11 2007 Iain Lea <iain@bricbrac.de> 3.11.0-0
index 9d497d0..fd8d404 100644 (file)
     # UPS-MIB
     # Statistics about your UPS using the UPS-MIB from the RFC1628.
     #
+    # Battery branch
+    <Data "upsmib_timeleft_battery">
+       Type "timeleft"
+       Table false
+       Instance "battery"
+       Values ".1.3.6.1.2.1.33.1.2.3.0"
+    </Data>
     <Data "upsmib_charge_battery">
        Type "percent"
        Table false
        Table false
        Instance "battery"
        Values ".1.3.6.1.2.1.33.1.2.5.0"
+       Scale 0.1
+    </Data>
+    <Data "upsmib_current_battery">
+       Type "current"
+       Table false
+       Instance "battery"
+       Values ".1.3.6.1.2.1.33.1.2.6.0"
+       Scale 0.1
+    </Data>
+    <Data "upsmib_temperature_battery">
+       Type "temperature"
+       Table false
+       Instance "battery"
+       Values ".1.3.6.1.2.1.33.1.2.7.0"
+    </Data>
+    # Input branch
+    <Data "upsmib_frequency_input">
+       Type "frequency"
+       Table true
+       InstancePrefix "input"
+       Values ".1.3.6.1.2.1.33.1.3.3.1.2"
+       Scale 0.1
     </Data>
     <Data "upsmib_voltage_input">
        Type "voltage"
        InstancePrefix "input"
        Values ".1.3.6.1.2.1.33.1.3.3.1.3"
     </Data>
+    <Data "upsmib_current_input">
+       Type "current"
+       Table true
+       InstancePrefix "input"
+       Values ".1.3.6.1.2.1.33.1.3.3.1.4"
+       Scale 0.1
+    </Data>
+    <Data "upsmib_power_input">
+       Type "power"
+       Table true
+       InstancePrefix "input"
+       Values ".1.3.6.1.2.1.33.1.3.3.1.5"
+    </Data>
+    # Output branch
+    <Data "upsmib_frequency_output">
+       Type "frequency"
+       Table false
+       Instance "output"
+       Values ".1.3.6.1.2.1.33.1.4.2.0"
+       Scale 0.1
+    </Data>
     <Data "upsmib_voltage_output">
        Type "voltage"
        Table true
        InstancePrefix "output"
        Values ".1.3.6.1.2.1.33.1.4.4.1.2"
     </Data>
+    <Data "upsmib_current_output">
+       Type "current"
+       Table true
+       InstancePrefix "output"
+       Values ".1.3.6.1.2.1.33.1.4.4.1.3"
+       Scale 0.1
+    </Data>
+    <Data "upsmib_power_output">
+       Type "power"
+       Table true
+       InstancePrefix "output"
+       Values ".1.3.6.1.2.1.33.1.4.4.1.4"
+    </Data>
+    <Data "upsmib_load_output">
+       Type "percent"
+       Table true
+       InstancePrefix "load-output"
+       Values ".1.3.6.1.2.1.33.1.4.4.1.5"
+    </Data>
+    # Bypass branch
+    <Data "upsmib_frequency_bypass">
+       Type "frequency"
+       Table false
+       Instance "output"
+       Values ".1.3.6.1.2.1.33.1.5.1.0"
+       Scale 0.1
+    </Data>
     <Data "upsmib_voltage_bypass">
        Type "voltage"
        Table true
        InstancePrefix "bypass"
        Values ".1.3.6.1.2.1.33.1.5.3.1.2"
     </Data>
-    <Data "upsmib_current_battery">
+    <Data "upsmib_current_bypass">
        Type "current"
+       Table true
+       InstancePrefix "bypass"
+       Values ".1.3.6.1.2.1.33.1.5.3.1.3"
+       Scale 0.1
+    </Data>
+    <Data "upsmib_power_bypass">
+       Type "power"
+       Table true
+       InstancePrefix "bypass"
+       Values ".1.3.6.1.2.1.33.1.5.3.1.4"
+    </Data>
+    # Special definitions for broken UPSes
+    <Data "upsmib_voltage_battery_unscaled">
+       Type "voltage"
        Table false
        Instance "battery"
-       Values ".1.3.6.1.2.1.33.1.2.6.0"
+       Values ".1.3.6.1.2.1.33.1.2.5.0"
     </Data>
-    <Data "upsmib_current_input">
+    <Data "upsmib_current_input_unscaled">
        Type "current"
        Table true
        InstancePrefix "input"
        Values ".1.3.6.1.2.1.33.1.3.3.1.4"
     </Data>
-    <Data "upsmib_current_output">
+    <Data "upsmib_current_output_unscaled">
        Type "current"
        Table true
        InstancePrefix "output"
        Values ".1.3.6.1.2.1.33.1.4.4.1.3"
     </Data>
-    <Data "upsmib_current_bypass">
+
+    #
+    # Riello UPS
+    # Temperatures for UPSes by Riello, <http://www.riello-ups.de/>
+    #
+    <Data "riello_temperature_system">
+       Type "temperature"
+       Table false
+       Instance "system"
+       Values ".1.3.6.1.4.1.5491.1.51.1.5.4.0"
+    </Data>
+    <Data "riello_temperature_rectifier">
+       Type "temperature"
+       Table false
+       Instance "rectifier"
+       Values ".1.3.6.1.4.1.5491.1.51.1.5.5.0"
+    </Data>
+    <Data "riello_temperature_inverter">
+       Type "temperature"
+       Table false
+       Instance "inverter"
+       Values ".1.3.6.1.4.1.5491.1.51.1.5.6.0"
+    </Data>
+
+    #
+    # PowerPlus UPS, manufactured by Gamatronic, <http://www.gamatronic.com/>,
+    # distributed in Germany by AdPoS, <http://adpos-usv.de/>
+    #
+    # Global inputs
+    <Data "powerplus_voltage_input">
+       Type "voltage"
+       Table true
+       InstancePrefix "input"
+       Values ".1.3.6.1.4.1.6050.5.4.1.1.2"
+    </Data>
+    <Data "powerplus_current_input">
        Type "current"
        Table true
-       InstancePrefix "bypass"
-       Values ".1.3.6.1.2.1.33.1.5.3.1.3"
+       InstancePrefix "input"
+       Values ".1.3.6.1.4.1.6050.5.4.1.1.3"
     </Data>
-    <Data "upsmib_temperature_battery">
-       Type "temperature"
+    <Data "powerplus_power_apparent_input">
+       Type "power"
+       Table true
+       InstancePrefix "apparent-input"
+       Values ".1.3.6.1.4.1.6050.5.4.1.1.4"
+       Scale 100.0
+    </Data>
+    <Data "powerplus_power_active_input">
+       Type "power"
+       Table true
+       InstancePrefix "active-input"
+       Values ".1.3.6.1.4.1.6050.5.4.1.1.5"
+       Scale 100.0
+    </Data>
+    <Data "powerplus_performance_factor_input">
+       Type "percent"
+       Table true
+       InstancePrefix "performance_factor-input"
+       Values ".1.3.6.1.4.1.6050.5.4.1.1.6"
+    </Data>
+    # Global outputs
+    <Data "powerplus_voltage_output">
+       Type "voltage"
+       Table true
+       InstancePrefix "output"
+       Values ".1.3.6.1.4.1.6050.5.5.1.1.2"
+    </Data>
+    <Data "powerplus_current_output">
+       Type "current"
+       Table true
+       InstancePrefix "output"
+       Values ".1.3.6.1.4.1.6050.5.5.1.1.3"
+    </Data>
+    <Data "powerplus_power_apparent_output">
+       Type "power"
+       Table true
+       InstancePrefix "apparent-output"
+       Values ".1.3.6.1.4.1.6050.5.5.1.1.4"
+       Scale 100.0
+    </Data>
+    <Data "powerplus_power_active_output">
+       Type "power"
+       Table true
+       InstancePrefix "active-output"
+       Values ".1.3.6.1.4.1.6050.5.5.1.1.5"
+       Scale 100.0
+    </Data>
+    <Data "powerplus_load_level_output">
+       Type "percent"
+       Table true
+       InstancePrefix "load_level-output"
+       Values ".1.3.6.1.4.1.6050.5.5.1.1.6"
+    </Data>
+    <Data "powerplus_active_load_level_output">
+       Type "percent"
+       Table true
+       InstancePrefix "active_load_level-output"
+       Values ".1.3.6.1.4.1.6050.5.5.1.1.7"
+    </Data>
+    <Data "powerplus_performance_factor_output">
+       Type "percent"
+       Table true
+       InstancePrefix "performance_factor-output"
+       Values ".1.3.6.1.4.1.6050.5.5.1.1.8"
+    </Data>
+    # Global DC
+    <Data "powerplus_global_dc_positive">
+       Type "voltage"
        Table false
-       Instance "battery"
-       Values ".1.3.6.1.2.1.33.1.2.7.0"
+       Instance "dc_positive-global"
+       Values ".1.3.6.1.4.1.6050.5.6.1.0"
+    </Data>
+    <Data "powerplus_global_dc_negative">
+       Type "voltage"
+       Table false
+       Instance "dc_negative-global"
+       Values ".1.3.6.1.4.1.6050.5.6.2.0"
+    </Data>
+    <Data "powerplus_global_dc_total">
+       Type "voltage"
+       Table false
+       Instance "dc_total-global"
+       Values ".1.3.6.1.4.1.6050.5.6.3.0"
     </Data>
 
     #
        Values ".1.3.6.1.4.1.5040.1.2.3.1.4.1.1"
        Scale 0.1
     </Data>
+
+    #
+    # Infratec
+    # Rack monitoring devices by Infratec, <http://www.infratec-ag.de/>
+    #
+    # Model H2-17
+    <Data "infratec_h2_17_temperature">
+       Type "temperature"
+       Table true
+       Instance ".1.3.6.1.4.1.4519.10.4.1.1.2"
+       Values ".1.3.6.1.4.1.4519.10.4.1.1.3"
+    </Data>
+    <Data "infratec_h2_17_humidity">
+       Type "humidity"
+       Table true
+       Instance ".1.3.6.1.4.1.4519.10.5.1.1.2"
+       Values ".1.3.6.1.4.1.4519.10.5.1.1.3"
+    </Data>
+    <Data "infratec_h2_17_voltage">
+       Type "voltage"
+       Table true
+       InstancePrefix "input"
+       Values ".1.3.6.1.4.1.4519.10.6.1.1.3"
+    </Data>
+    # Model H2-30
+    <Data "infratec_h2_30_temperature">
+       Type "temperature"
+       Table true
+       Instance ".1.3.6.1.4.1.1909.10.4.1.1.2"
+       Values ".1.3.6.1.4.1.1909.10.4.1.1.3"
+    </Data>
+    <Data "infratec_h2_30_humidity">
+       Type "humidity"
+       Table true
+       Instance ".1.3.6.1.4.1.1909.10.5.1.1.2"
+       Values ".1.3.6.1.4.1.1909.10.5.1.1.3"
+    </Data>
+    <Data "infratec_h2_30_voltage">
+       Type "voltage"
+       Table true
+       InstancePrefix "input"
+       Values ".1.3.6.1.4.1.1909.10.6.1.1.3"
+    </Data>
 </Plugin>
index dfdd11c..00b9c75 100644 (file)
@@ -422,6 +422,7 @@ static void *exec_read_one (void *arg) /* {{{ */
     ERROR ("exec plugin: fdopen (%i) failed: %s", fd,
        sstrerror (errno, errbuf, sizeof (errbuf)));
     kill (pl->pid, SIGTERM);
+    pl->pid = 0;
     close (fd);
     pthread_exit ((void *) 1);
   }
index 8673df1..4311ff1 100644 (file)
@@ -656,24 +656,10 @@ static int csnmp_config (oconfig_item_t *ci)
 
 static void csnmp_host_close_session (host_definition_t *host)
 {
-  int status;
-
   if (host->sess_handle == NULL)
     return;
 
-  status = snmp_sess_close (host->sess_handle);
-
-  if (status != 0)
-  {
-    char *errstr = NULL;
-
-    snmp_sess_error (host->sess_handle, NULL, NULL, &errstr);
-
-    ERROR ("snmp plugin: host %s: snmp_sess_close failed: %s",
-       host->name, (errstr == NULL) ? "Unknown problem" : errstr);
-    sfree (errstr);
-  }
-
+  snmp_sess_close (host->sess_handle);
   host->sess_handle = NULL;
 } /* void csnmp_host_close_session */
 
@@ -1107,15 +1093,22 @@ static int csnmp_read_table (host_definition_t *host, data_definition_t *data)
     for (i = 0; i < oid_list_len; i++)
       snmp_add_null_var (req, oid_list[i].oid, oid_list[i].oid_len);
 
+    res = NULL;
     status = snmp_sess_synch_response (host->sess_handle, req, &res);
 
-    if (status != STAT_SUCCESS)
+    if ((status != STAT_SUCCESS) || (res == NULL))
     {
       char *errstr = NULL;
 
       snmp_sess_error (host->sess_handle, NULL, NULL, &errstr);
       ERROR ("snmp plugin: host %s: snmp_sess_synch_response failed: %s",
          host->name, (errstr == NULL) ? "Unknown problem" : errstr);
+
+      if (res != NULL)
+       snmp_free_pdu (res);
+      res = NULL;
+
+      sfree (errstr);
       csnmp_host_close_session (host);
 
       status = -1;
@@ -1127,6 +1120,10 @@ static int csnmp_read_table (host_definition_t *host, data_definition_t *data)
     vb = res->variables;
     if (vb == NULL)
     {
+      if (res != NULL)
+       snmp_free_pdu (res);
+      res = NULL;
+
       status = -1;
       break;
     }
@@ -1134,7 +1131,13 @@ static int csnmp_read_table (host_definition_t *host, data_definition_t *data)
     /* Check if all values (and possibly the instance) have left their
      * subtree */
     if (csnmp_check_res_left_subtree (host, data, res) != 0)
+    {
+      if (res != NULL)
+       snmp_free_pdu (res);
+      res = NULL;
+
       break;
+    }
 
     /* if an instance-OID is configured.. */
     if (data->instance.oid.oid_len > 0)
@@ -1314,17 +1317,24 @@ static int csnmp_read_value (host_definition_t *host, data_definition_t *data)
 
   for (i = 0; i < data->values_len; i++)
     snmp_add_null_var (req, data->values[i].oid, data->values[i].oid_len);
+
+  res = NULL;
   status = snmp_sess_synch_response (host->sess_handle, req, &res);
 
-  if (status != STAT_SUCCESS)
+  if ((status != STAT_SUCCESS) || (res == NULL))
   {
     char *errstr = NULL;
 
     snmp_sess_error (host->sess_handle, NULL, NULL, &errstr);
     ERROR ("snmp plugin: host %s: snmp_sess_synch_response failed: %s",
        host->name, (errstr == NULL) ? "Unknown problem" : errstr);
-    csnmp_host_close_session (host);
+
+    if (res != NULL)
+      snmp_free_pdu (res);
+    res = NULL;
+
     sfree (errstr);
+    csnmp_host_close_session (host);
 
     return (-1);
   }
@@ -1347,7 +1357,9 @@ static int csnmp_read_value (host_definition_t *host, data_definition_t *data)
            data->scale, data->shift);
   } /* for (res->variables) */
 
-  snmp_free_pdu (res);
+  if (res != NULL)
+    snmp_free_pdu (res);
+  res = NULL;
 
   DEBUG ("snmp plugin: -> plugin_dispatch_values (%s, &vl);", data->type);
   plugin_dispatch_values (data->type, &vl);
index 74874ae..00cad0e 100644 (file)
@@ -336,12 +336,7 @@ static int conn_read_file (const char *file)
 
   fh = fopen (file, "r");
   if (fh == NULL)
-  {
-    char errbuf[1024];
-    ERROR ("tcpconns plugin: fopen (%s) failed: %s",
-       file, sstrerror (errno, errbuf, sizeof (errbuf)));
     return (-1);
-  }
 
   while (fgets (buffer, sizeof (buffer), fh) != NULL)
   {
@@ -411,12 +406,25 @@ static int conn_init (void)
 
 static int conn_read (void)
 {
+  int errors_num = 0;
+
   conn_reset_port_entry ();
 
-  conn_read_file ("/proc/net/tcp");
-  conn_read_file ("/proc/net/tcp6");
+  if (conn_read_file ("/proc/net/tcp") != 0)
+    errors_num++;
+  if (conn_read_file ("/proc/net/tcp6") != 0)
+    errors_num++;
 
-  conn_submit_all ();
+  if (errors_num < 2)
+  {
+    conn_submit_all ();
+  }
+  else
+  {
+    ERROR ("tcpconns plugin: Neither /proc/net/tcp nor /proc/net/tcp6 "
+       "coult be read.");
+    return (-1);
+  }
 
   return (0);
 } /* int conn_read */
index 919a3ec..a19f26d 100644 (file)
@@ -6,8 +6,8 @@ bitrate                 value:GAUGE:0:4294967295
 charge                 value:GAUGE:0:U
 connections            value:COUNTER:0:U
 counter                        value:COUNTER:U:U
-cpu                    value:COUNTER:0:4294967295
 cpufreq                        value:GAUGE:0:U
+cpu                    value:COUNTER:0:4294967295
 current                        value:GAUGE:U:U
 delay                  seconds:GAUGE:-1000000:1000000
 df                     used:GAUGE:0:1125899906842623, free:GAUGE:0:1125899906842623
@@ -40,6 +40,11 @@ ipt_bytes            value:COUNTER:0:134217728
 ipt_packets            value:COUNTER:0:134217728
 irq                    value:COUNTER:U:65535
 load                   shortterm:GAUGE:0:100, midterm:GAUGE:0:100, longterm:GAUGE:0:100
+memcached_command      value:COUNTER:0:U
+memcached_connections  value:GAUGE:0:U
+memcached_items                value:GAUGE:0:U
+memcached_octets       rx:COUNTER:0:4294967295, tx:COUNTER:0:4294967295
+memcached_ops          value:COUNTER:0:134217728
 memory                 value:GAUGE:0:281474976710656
 multimeter             value:GAUGE:U:U
 mysql_commands         value:COUNTER:0:U
@@ -48,11 +53,6 @@ mysql_octets         rx:COUNTER:0:4294967295, tx:COUNTER:0:4294967295
 mysql_qcache           hits:COUNTER:0:U, inserts:COUNTER:0:U, not_cached:COUNTER:0:U, lowmem_prunes:COUNTER:0:U, queries_in_cache:GAUGE:0:U
 mysql_threads          running:GAUGE:0:U, connected:GAUGE:0:U, cached:GAUGE:0:U, created:COUNTER:0:U
 nfs_procedure          value:COUNTER:0:4294967295
-memcached_command      value:COUNTER:0:U
-memcached_connections  value:GAUGE:0:U
-memcached_items                value:GAUGE:0:U
-memcached_octets       rx:COUNTER:0:4294967295, tx:COUNTER:0:4294967295
-memcached_ops          value:COUNTER:0:134217728
 nginx_connections      value:GAUGE:0:U
 nginx_requests         value:COUNTER:0:134217728
 percent                        percent:GAUGE:0:100.1
@@ -63,21 +63,22 @@ ps_cputime          user:COUNTER:0:16000000, syst:COUNTER:0:16000000
 ps_pagefaults          minflt:COUNTER:0:9223372036854775807, majflt:COUNTER:0:9223372036854775807
 ps_rss                 value:GAUGE:0:9223372036854775807
 ps_state               value:GAUGE:0:65535
+serial_octets          rx:COUNTER:0:4294967295, tx:COUNTER:0:4294967295
+signal_noise           value:GAUGE:U:0
+signal_power           value:GAUGE:U:0
+signal_quality         value:GAUGE:0:U
 spam_score             value:GAUGE:U:U
+swap                   value:GAUGE:0:1099511627776
 tcp_connections                value:GAUGE:0:4294967295
 temperature            value:GAUGE:-273.15:U
 time_dispersion                seconds:GAUGE:-1000000:1000000
-time_offset            seconds:GAUGE:-1000000:1000000
 timeleft               timeleft:GAUGE:0:3600
-voltage                        value:GAUGE:U:U
-serial_octets          rx:COUNTER:0:4294967295, tx:COUNTER:0:4294967295
-swap                   value:GAUGE:0:1099511627776
+time_offset            seconds:GAUGE:-1000000:1000000
 users                  users:GAUGE:0:65535
 virt_cpu_total         ns:COUNTER:0:256000000000
 virt_vcpu              ns:COUNTER:0:1000000000
-vs_threads             value:GAUGE:0:65535
-vs_processes           value:GAUGE:0:65535
+voltage_threshold      value:GAUGE:U:U, threshold:GAUGE:U:U
+voltage                        value:GAUGE:U:U
 vs_memory              value:GAUGE:0:9223372036854775807
-signal_quality         value:GAUGE:0:U
-signal_power           value:GAUGE:U:0
-signal_noise           value:GAUGE:U:0
+vs_processes           value:GAUGE:0:65535
+vs_threads             value:GAUGE:0:65535
index ccd3a2e..7691387 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-DEFAULT_VERSION="4.2.0.git"
+DEFAULT_VERSION="4.2.1.git"
 
 VERSION="$( git describe 2> /dev/null | sed -e 's/^collectd-//' )"