#!/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 $NRPEMap = {}; 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 its 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: NRPEConfig "/etc/nrpe.cfg" Interval 300 The options have the following semantic (i.Ee. meaning): =over 4 =item B I Read the NRPE config and add the command definitions to an alias table. After reading the file you can use the NRPE command name rather than the script's filename within B