2
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

fix hang when asking for unknown commands

This commit is contained in:
Steve Schnepp 2012-03-07 17:59:19 +01:00
parent 58f03a964a
commit f0d8bcdb66

View file

@ -54,6 +54,7 @@ while(my $line = <>) {
next; next;
} elsif ($cmd eq "nodes") { } elsif ($cmd eq "nodes") {
print "$host\n"; print "$host\n";
print ".";
next; next;
} elsif ($cmd eq "quit") { } elsif ($cmd eq "quit") {
exit(0); exit(0);
@ -67,19 +68,19 @@ while(my $line = <>) {
} }
closedir(PLUGIN_DIR); closedir(PLUGIN_DIR);
next; next;
} elsif (-e $plugin_filename) { } elsif ($cmd eq "config" || $cmd eq "alert" || $cmd eq "fetch") {
my $arg_plugin; if (-d $plugin_filename || ! -x $plugin_filename) {
if ($cmd eq "config") { print "# Unknown plugin [$arg] for $cmd";
$arg_plugin = "config";
} elsif ($cmd eq "fetch") {
$arg_plugin = "";
} else {
# Ignore
next; next;
} }
my $arg_plugin = ($cmd eq "fetch") ? "" : $cmd;
system($plugin_filename, $arg_plugin); system($plugin_filename, $arg_plugin);
print "."; print ".";
next;
} }
# Arriving here is not a good sign
print "# Unknown command. Try list, nodes, config, fetch, version, alert or quit";
} continue { } continue {
#print " " x 4096; #print " " x 4096;
print "\n"; print "\n";