diff --git a/contrib/exec-nagios.px b/contrib/exec-nagios.px
index 938721fc55624977fa89d5ea3a1d289531573b6d..4b112f95139aa97fc0b04b3044c528f3218837f8 100755 (executable)
--- a/contrib/exec-nagios.px
+++ b/contrib/exec-nagios.px
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);
my $type = shift;
my $time = shift;
my $line = shift;
+ my $ident = "$host/$plugin-$pinst/$type-$tinst";
my $tinst;
my $value;
return;
}
- print "PUTVAL $host/$plugin-$pinst/$type-$tinst interval=$Interval ${time}:$value\n";
+ $ident =~ s/"/\\"/g;
+
+ print qq(PUTVAL "$ident" interval=$Interval ${time}:$value\n);
}
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;