From: Florian Forster Date: Mon, 5 Jul 2010 07:45:46 +0000 (+0200) Subject: contrib/exec-nagios.px: Use the environment variables for defaults. X-Git-Tag: collectd-5.0.0-beta0~93 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=0a5310ddaae74d0ac98ff30b28d55871fadc8fcb;p=collectd.git contrib/exec-nagios.px: Use the environment variables for defaults. --- diff --git a/contrib/exec-nagios.px b/contrib/exec-nagios.px index b26981fb..4b112f95 100755 --- a/contrib/exec-nagios.px +++ b/contrib/exec-nagios.px @@ -24,7 +24,8 @@ use Regexp::Common ('number'); our $ConfigFile = '/etc/exec-nagios.conf'; our $TypeMap = {}; our $Scripts = []; -our $Interval = 300; +our $Interval = defined ($ENV{'COLLECTD_INTERVAL'}) ? (0 + $ENV{'COLLECTD_INTERVAL'}) : 300; +our $Hostname = defined ($ENV{'COLLECTD_HOSTNAME'}) ? $ENV{'COLLECTD_HOSTNAME'} : ''; main (); exit (0); @@ -263,7 +264,7 @@ sub execute_script my $time = time (); my $script = shift; my @args = (); - my $host = hostname () || 'localhost'; + my $host = $Hostname || hostname () || 'localhost'; my $state = 0; my $serviceoutput;