From: Florian Forster Date: Mon, 5 Jul 2010 07:40:55 +0000 (+0200) Subject: contrib/exec-munin.px: Use the environment variables for defaults. X-Git-Tag: collectd-5.0.0-beta0~95 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c18f7cbb2645e67765f9aa7e15f59a556735706c;p=collectd.git contrib/exec-munin.px: Use the environment variables for defaults. --- diff --git a/contrib/exec-munin.px b/contrib/exec-munin.px index b57601a3..3e62ce00 100755 --- a/contrib/exec-munin.px +++ b/contrib/exec-munin.px @@ -46,7 +46,8 @@ use Regexp::Common ('number'); our $ConfigFile = '/etc/exec-munin.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); @@ -189,7 +190,7 @@ sub execute_script my $pinst; my $time = time (); my $script = shift; - my $host = hostname () || 'localhost'; + my $host = $Hostname || hostname () || 'localhost'; if (!open ($fh, '-|', $script)) { print STDERR "Cannot execute $script: $!";