2
0
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:
Stefan Seidel 2012-06-11 23:26:07 +02:00
parent 2b23857b4a
commit e1e5a14ab5

View File

@ -173,19 +173,20 @@ if ($0 =~ /vcenter_(.+)$/) {
my @returns = ();
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;
my $pid = open(FH, "-|");
if ($pid == 0) {
# 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
Opts::set_option ('username', $ENV{user} || 'root');