From: <buc...@us...> - 2011-01-25 09:19:49
|
Revision: 212 http://devmon.svn.sourceforge.net/devmon/?rev=212&view=rev Author: buchanmilne Date: 2011-01-25 09:19:43 +0000 (Tue, 25 Jan 2011) Log Message: ----------- Provide -h <pattern> opttion, to allow polling of only hosts that match the pattern for easier templaet development or other debugging (#2512239) Modified Paths: -------------- trunk/modules/dm_config.pm Modified: trunk/modules/dm_config.pm =================================================================== --- trunk/modules/dm_config.pm 2011-01-25 09:00:37 UTC (rev 211) +++ trunk/modules/dm_config.pm 2011-01-25 09:19:43 UTC (rev 212) @@ -49,6 +49,7 @@ 'debug' => 0, 'oneshot' => 0, 'print_msg' => 0, + 'hostonly' => '', 'shutting_down' => 0, 'active' => '', 'pidfile' => '', @@ -240,6 +241,8 @@ $g{'verbose'} = 2; $g{'debug'} = 1; $g{'oneshot'} = 1 } + elsif(/^-h$/) { $g{'hostonly'} = shift @ARGV or usage(); + $g{'daemonize'} = 0; } elsif(/^--debug$/) { $g{'debug'} = 1 } elsif(/^--syncconfig$/) { $syncconfig = 1 } elsif(/^--synctemplates$/) { $synctemps = 1 } @@ -1937,6 +1940,7 @@ my @arr = db_get_array("name,ip,vendor,model,tests,cid from devices"); for my $host (@arr) { my ($name,$ip,$vendor,$model,$tests,$cid) = @$host; + next if ($g{'hostonly'} ne '' and $name !~ /$g{'hostonly'}/); my $port = $1 if $cid =~ s/::(\d+)$//; @@ -1991,6 +1995,7 @@ do_log("Invalid entry in host file at line $num.",0) and next if !defined $cid; + next if ($g{'hostonly'} ne '' and $name !~ /$g{'hostonly'}/); my $port = $1 if $cid =~ s/::(\d+)$//; $hosts{$name}{'ip'} = $ip; @@ -2153,6 +2158,7 @@ " -c Specify config file location\n" . " -d Specify database file location\n" . " -f Run in foreground. Prevents running in daemon mode.\n" . + " -h Poll only hosts matching the pattern that follows.\n" . " -p Print message. Don't send message to display server.\n" . " print it to stdout\n" . " -v Verbose mode. The more v's, the more vebose logging.\n" . This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |