mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
make sure host_name is only printed once per plugin call
This commit is contained in:
parent
2b23857b4a
commit
e1e5a14ab5
1 changed files with 9 additions and 8 deletions
|
@ -173,19 +173,20 @@ if ($0 =~ /vcenter_(.+)$/) {
|
||||||
my @returns = ();
|
my @returns = ();
|
||||||
|
|
||||||
foreach $host_name (@host_names) {
|
foreach $host_name (@host_names) {
|
||||||
|
# make sure we only print one host_name statement per plugin
|
||||||
|
if ((@returns == 0) and (defined $ARGV[0]) and ($ARGV[0] eq "config")) {
|
||||||
|
if ($ENV{flatview}) {
|
||||||
|
print "host_name $ENV{flatview}\n";
|
||||||
|
print "# for host $host_name\n" if $DEBUG;
|
||||||
|
} else {
|
||||||
|
print "host_name $host_name\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
local *FH;
|
local *FH;
|
||||||
my $pid = open(FH, "-|");
|
my $pid = open(FH, "-|");
|
||||||
if ($pid == 0) {
|
if ($pid == 0) {
|
||||||
# CHILD
|
# CHILD
|
||||||
|
|
||||||
if ((defined $ARGV[0]) and ($ARGV[0] eq "config")) {
|
|
||||||
if ($ENV{flatview}) {
|
|
||||||
print "host_name $ENV{flatview}\n";
|
|
||||||
print "# for host $host_name\n" if $DEBUG;
|
|
||||||
} else {
|
|
||||||
print "host_name $host_name\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# env.user and env.password need to be set in plugin-conf.d
|
# env.user and env.password need to be set in plugin-conf.d
|
||||||
Opts::set_option ('username', $ENV{user} || 'root');
|
Opts::set_option ('username', $ENV{user} || 'root');
|
||||||
|
|
Loading…
Reference in a new issue