1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-27 03:14:45 +00: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,12 +173,8 @@ if ($0 =~ /vcenter_(.+)$/) {
my @returns = (); my @returns = ();
foreach $host_name (@host_names) { foreach $host_name (@host_names) {
local *FH; # make sure we only print one host_name statement per plugin
my $pid = open(FH, "-|"); if ((@returns == 0) and (defined $ARGV[0]) and ($ARGV[0] eq "config")) {
if ($pid == 0) {
# CHILD
if ((defined $ARGV[0]) and ($ARGV[0] eq "config")) {
if ($ENV{flatview}) { if ($ENV{flatview}) {
print "host_name $ENV{flatview}\n"; print "host_name $ENV{flatview}\n";
print "# for host $host_name\n" if $DEBUG; print "# for host $host_name\n" if $DEBUG;
@ -186,6 +182,11 @@ foreach $host_name (@host_names) {
print "host_name $host_name\n"; print "host_name $host_name\n";
} }
} }
local *FH;
my $pid = open(FH, "-|");
if ($pid == 0) {
# CHILD
# 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');