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