From: Florian Forster Date: Thu, 8 Nov 2007 21:22:19 +0000 (+0100) Subject: Merge branch 'collectd-4.2' X-Git-Tag: collectd-4.3.0beta0~109 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=34749e7ebe508b1d563af287b180e951b7822bcd;hp=c6be63a74e2ed88ec7dc1d88d09896520bb8b7a1;p=collectd.git Merge branch 'collectd-4.2' Conflicts: src/types.db --- diff --git a/ChangeLog b/ChangeLog index ca0b034a..5fe505aa 100644 --- 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 @@ -25,6 +30,16 @@ 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 2e9cbf54..398d13ba 100644 --- a/contrib/README +++ b/contrib/README @@ -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 diff --git a/contrib/collection.cgi b/contrib/collection.cgi index 045b77bb..7da7e1c6 100755 --- a/contrib/collection.cgi +++ b/contrib/collection.cgi @@ -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 index 00000000..d7c31a4a --- /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 new file mode 100755 index 00000000..e6c8128e --- /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. 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. The +configuration is read using C which understands a Apache-like +config syntax, so it's very similar to the F 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.Ee. meaning): + +=over 4 + +=item B I I [I ...] + +collectd uses B 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.Eg. +the C plugin above provides C and C 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 file in +collectd's library path, e.Eg. F. + +=item B I + +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.Eg. every 300 seconds versus every 10 +seconds. + +=item B