From: Florian Forster Date: Sat, 3 Nov 2007 15:28:35 +0000 (+0100) Subject: contrib/exec-munin.px: Added a simple Perl script which makes it possible to use... X-Git-Tag: collectd-4.1.4~5 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=281ecad012b4d76a04e110ab149391fdc67c7498;p=collectd.git contrib/exec-munin.px: Added a simple Perl script which makes it possible to use Munin plugins in collectd. The script has an embedded POD documentation. --- diff --git a/contrib/README b/contrib/README index 685903b3..6f0836f8 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 + extractDS.px ------------ Creates a new RRD-file with only one data-source (DS) of the source-RRD- 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