projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'collectd-4.10' into collectd-5.0
[collectd.git]
/
contrib
/
exec-munin.px
diff --git
a/contrib/exec-munin.px
b/contrib/exec-munin.px
index
907ea9b
..
3e62ce0
100755
(executable)
--- 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 $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);
main ();
exit (0);
@@
-189,7
+190,7
@@
sub execute_script
my $pinst;
my $time = time ();
my $script = shift;
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: $!";
if (!open ($fh, '-|', $script))
{
print STDERR "Cannot execute $script: $!";
@@
-206,8
+207,11
@@
sub execute_script
my $field = $1;
my $value = $2;
my $type = (defined ($TypeMap->{$field})) ? $TypeMap->{$field} : $field;
my $field = $1;
my $value = $2;
my $type = (defined ($TypeMap->{$field})) ? $TypeMap->{$field} : $field;
+ my $ident = "$host/munin-$pinst/$type";
- print "$host/munin-$pinst/$type interval=$Interval $time:$value\n";
+ $ident =~ s/"/\\"/g;
+
+ print qq(PUTVAL "$ident" interval=$Interval $time:$value\n);
}
}
}
}