From 8eee012f2cbb9e67d3412cb3269ecdbb6fb944d7 Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Thu, 8 Mar 2012 10:27:11 +0100 Subject: [PATCH] Adding basic spoolfetch plugin support --- tools/pmmn/bin/pmmn | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tools/pmmn/bin/pmmn b/tools/pmmn/bin/pmmn index c39ea2dd..a6f0c9f6 100755 --- a/tools/pmmn/bin/pmmn +++ b/tools/pmmn/bin/pmmn @@ -19,6 +19,8 @@ my $port; # Default is stdin/stdout my $verbose; my $host; my $plugin_dir = "plugins"; +my $spoolfetch_dir; + { my $man = 0; my $help = 0; @@ -29,6 +31,8 @@ my $plugin_dir = "plugins"; 'plugin-dir|d=s' => \$plugin_dir, 'host|h=s' => \$host, + 'spoolfetch-dir|s=s' => \$spoolfetch_dir, + 'help|?' => \$help, man => \$man, ) or pod2usage(2); @@ -78,12 +82,19 @@ while(my $line = <>) { system($plugin_filename, $arg_plugin); print "."; next; + } elsif ($cmd eq "cap") { + print "cap "; + print "spool " if $spoolfetch_dir; + next; + } elsif ($cmd eq "spoolfetch" && $spoolfetch_dir) { + system("$spoolfetch_dir/spoolfetch_$host", $arg); + 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"; }; @@ -105,6 +116,8 @@ Options: --plugin-dir Plugin directory (default is current dir) --host Host name (default is /bin/hostname) + --spoolfetch-dir Spoolfetch plugin dirs (default is disabled) + --help brief help message --man full documentation