#!/usr/bin/perl use strict; use warnings; =head1 NAME exec-nagios.px =head1 DESCRIPTION This script allows you to use plugins that were written for Nagios with collectd's C. If the plugin checks some kind of threshold, please consider configuring the threshold using collectd's own facilities instead of using this transition layer. =cut use Sys::Hostname ('hostname'); use File::Basename ('basename'); use Config::General ('ParseConfig'); use Regexp::Common ('number'); our $ConfigFile = '/etc/exec-nagios.conf'; our $TypeMap = {}; our $Scripts = []; our $Interval = defined ($ENV{'COLLECTD_INTERVAL'}) ? (0 + $ENV{'COLLECTD_INTERVAL'}) : 300; our $Hostname = defined ($ENV{'COLLECTD_HOSTNAME'}) ? $ENV{'COLLECTD_HOSTNAME'} : ''; 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: Interval 300 The options have the following semantic (i.Ee. meaning): =over 4 =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 Nagios plugins much less often, e.Eg. every 300 seconds versus every 10 seconds. =item EB