author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 8 Nov 2007 21:22:19 +0000 (22:22 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 8 Nov 2007 21:22:19 +0000 (22:22 +0100) |
Conflicts:
src/types.db
src/types.db
12 files changed:
ChangeLog | patch | blob | history | |
contrib/README | patch | blob | history | |
contrib/collection.cgi | patch | blob | history | |
contrib/exec-munin.conf | [new file with mode: 0644] | patch | blob |
contrib/exec-munin.px | [new file with mode: 0755] | patch | blob |
contrib/fedora/collectd.spec | patch | blob | history | |
contrib/snmp-data.conf | patch | blob | history | |
src/exec.c | patch | blob | history | |
src/snmp.c | patch | blob | history | |
src/tcpconns.c | patch | blob | history | |
src/types.db | patch | blob | history | |
version-gen.sh | patch | blob | history |
diff --git a/ChangeLog b/ChangeLog
index ca0b034ac7953adc1bfdda8d6e96cd642fecc511..5fe505aa623206f01a500d180a6da25421fcf074 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+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.
diff --git a/contrib/README b/contrib/README
index 2e9cbf54263e9a6aa1cd840fad8ddb177e42d6eb..398d13ba9bdd0dcab5020e5fb2b51f210c31d273 100644 (file)
--- a/contrib/README
+++ b/contrib/README
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
diff --git a/contrib/collection.cgi b/contrib/collection.cgi
index 045b77bbe835ed29ebb962cc30d36b550d902a0f..7da7e1c62f857a8bd9d1be956e51ff102d6da64e 100755 (executable)
--- a/contrib/collection.cgi
+++ b/contrib/collection.cgi
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)
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} = {};
'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',
'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",
'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',
'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',
'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',
'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',
'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',
$opts->{'title'} = "$host/$plugin"
. (defined ($plugin_instance) ? "-$plugin_instance" : '') . "/$type";
+ $opts->{'rrd_opts'} = ['-v', 'Percent'];
+
my @files = ();
$opts->{'colors'} =
$opts->{'title'} = "$host/$plugin"
. (defined ($plugin_instance) ? "-$plugin_instance" : '') . "/$type";
+ $opts->{'rrd_opts'} = ['-v', 'Processes'];
my @files = ();
$opts->{'title'} = "$host/$plugin"
. (defined ($plugin_instance) ? "-$plugin_instance" : '') . "/$type";
$opts->{'number_format'} = '%5.1lf%s';
+ $opts->{'rrd_opts'} = ['-v', 'Bytes'];
my @files = ();
};
_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
--- /dev/null
+++ b/contrib/exec-munin.conf
@@ -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
--- /dev/null
+++ b/contrib/exec-munin.px
@@ -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 d9f05521698f48adfba62b3d78f556519bdd61f2..89ce1237499395aaad888badce63528810ebf103 100644 (file)
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>
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
%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
%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
%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
%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
%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
%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
diff --git a/contrib/snmp-data.conf b/contrib/snmp-data.conf
index 9d497d0ca0bb7ef15b98e400a8507f3f8ecf1c2a..fd8d4044083f457b1e7c0da0aa8811e7d3989429 100644 (file)
--- a/contrib/snmp-data.conf
+++ b/contrib/snmp-data.conf
# 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>
diff --git a/src/exec.c b/src/exec.c
index dfdd11c18ed9b6079458f2f433258cacef4dc283..00b9c7511de57d8d2fe54dfeb81f2b21b8816f38 100644 (file)
--- a/src/exec.c
+++ b/src/exec.c
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);
}
diff --git a/src/snmp.c b/src/snmp.c
index 8673df199e9ffe135993986a24f5cc1e1607b50e..4311ff1670b5f92a6e2927d16420e2c1c5f8a011 100644 (file)
--- a/src/snmp.c
+++ b/src/snmp.c
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);
diff --git a/src/tcpconns.c b/src/tcpconns.c
index 74874ae36382080ebd90af4dcfdb0079965e3d10..00cad0e46fa8b4e7857a3c929882a8a6409dacae 100644 (file)
--- a/src/tcpconns.c
+++ b/src/tcpconns.c
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)
{
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 */
diff --git a/src/types.db b/src/types.db
index 919a3ecd1fece8f530d1dbd07cfada414b42cf15..a19f26dc997a9d2513f8dc3d5221307384ebfa9f 100644 (file)
--- a/src/types.db
+++ b/src/types.db
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
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
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
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
diff --git a/version-gen.sh b/version-gen.sh
index ccd3a2ef32da4aff497d4d5a8a70846826220e19..7691387663f397b1c58c30c95ad9f24dbbd60dd9 100755 (executable)
--- a/version-gen.sh
+++ b/version-gen.sh
#!/bin/sh
-DEFAULT_VERSION="4.2.0.git"
+DEFAULT_VERSION="4.2.1.git"
VERSION="$( git describe 2> /dev/null | sed -e 's/^collectd-//' )"