From: <buc...@us...> - 2008-09-04 08:16:02
|
Revision: 89 http://devmon.svn.sourceforge.net/devmon/?rev=89&view=rev Author: buchanmilne Date: 2008-09-04 08:15:59 +0000 (Thu, 04 Sep 2008) Log Message: ----------- Fix loading non-standard ports from the config file Modified Paths: -------------- trunk/modules/dm_config.pm Modified: trunk/modules/dm_config.pm =================================================================== --- trunk/modules/dm_config.pm 2008-06-24 18:34:31 UTC (rev 88) +++ trunk/modules/dm_config.pm 2008-09-04 08:15:59 UTC (rev 89) @@ -1866,7 +1866,7 @@ for my $host (@arr) { my ($name,$ip,$vendor,$model,$tests,$cid) = @$host; - my $port = $1 if $cid =~ s/::(\d+)^//; + my $port = $1 if $cid =~ s/::(\d+)$//; $hosts{$name}{'ip'} = $ip; $hosts{$name}{'vendor'} = $vendor; @@ -1919,7 +1919,7 @@ do_log("Invalid entry in host file at line $num.",0) and next if !defined $cid; - my $port = $1 if $cid =~ s/::(\d+)^//; + my $port = $1 if $cid =~ s/::(\d+)$//; $hosts{$name}{'ip'} = $ip; $hosts{$name}{'vendor'} = $vendor; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <buc...@us...> - 2008-11-13 19:40:29
|
Revision: 91 http://devmon.svn.sourceforge.net/devmon/?rev=91&view=rev Author: buchanmilne Date: 2008-11-13 19:40:22 +0000 (Thu, 13 Nov 2008) Log Message: ----------- Fix multiple custom threshholds and exceptions on the same test Modified Paths: -------------- trunk/modules/dm_config.pm Modified: trunk/modules/dm_config.pm =================================================================== --- trunk/modules/dm_config.pm 2008-11-07 00:25:45 UTC (rev 90) +++ trunk/modules/dm_config.pm 2008-11-13 19:40:22 UTC (rev 91) @@ -1820,8 +1820,9 @@ my $sc = $thr_sc{$color}; $threshes .= ";$sc:$val"; } + $threshes .= ','; } - $threshes .= ','; + $threshes .= ',' if ($threshes !~ /,$/); } $threshes =~ s/,$//; @@ -1835,8 +1836,9 @@ my $sc = $exc_sc{$type}; $excepts .= ";$sc:$val"; } + $excepts .= ','; } - $excepts .= ','; + $excepts .= ',' if ($excepts !~ /,$/); } $excepts =~ s/,$//; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <buc...@us...> - 2008-12-08 05:56:26
|
Revision: 98 http://devmon.svn.sourceforge.net/devmon/?rev=98&view=rev Author: buchanmilne Date: 2008-12-08 05:56:18 +0000 (Mon, 08 Dec 2008) Log Message: ----------- Improve error handling, by opening log file immediately after forking, and returning non-zero exit codes when exiting due to error (e.g. log_fatal) Modified Paths: -------------- trunk/modules/dm_config.pm Modified: trunk/modules/dm_config.pm =================================================================== --- trunk/modules/dm_config.pm 2008-12-07 20:02:02 UTC (rev 97) +++ trunk/modules/dm_config.pm 2008-12-08 05:56:18 UTC (rev 98) @@ -262,6 +262,9 @@ # Daemonize if need be daemonize(); + # Open the log file + open_log(); + # Set our pid $g{'mypid'} = $$; @@ -288,9 +291,6 @@ $pid_handle->close; } - # Open the log file - open_log(); - # Autodetect our nodename on user request if($g{'nodename'} eq 'HOSTNAME') { my $hostname_bin = bin_path('hostname'); @@ -356,12 +356,12 @@ if($exceeded > 1) { do_log("Exceeded cycle time ($poll_time seconds).", 0); $g{'sleep_time'} = 0; - quit() if $g{'oneshot'}; + quit(0) if $g{'oneshot'}; } # Otherwise calculate our sleep time else { - quit() if $g{'oneshot'}; + quit(0) if $g{'oneshot'}; $g{'sleep_time'} = -$exceeded; $g{'sleep_time'} = 0 if $g{'sleep_time'} < 0; # just in case! do_log("Sleeping for $g{'sleep_time'} seconds.", 1); @@ -1032,10 +1032,10 @@ # Log and die sub log_fatal { - my ($msg, $verbosity) = @_; + my ($msg, $verbosity,$exitcode) = @_; do_log($msg, $verbosity); - &quit; + quit(1); } @@ -1183,7 +1183,7 @@ do_log("Done",0); # Now quit - &quit; + &quit(0); } @@ -1854,7 +1854,7 @@ } # Now quit - &quit; + &quit(0); } @@ -2010,7 +2010,7 @@ open(STDERR, "+>&STDIN"); # Define ourselves as the master - $0 = 'devmon[master]'; + $0 = 'devmon[master]'; # Set up our signal handlers again, just to be sure $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = \&quit; @@ -2033,7 +2033,7 @@ redo FORK; } elsif($! ne '') { - log_fatal("Can't fork: $!"); + log_fatal("Can't fork: $!",0); } } } @@ -2101,6 +2101,8 @@ # Sub to call when we quit, be it normally or not sub quit { + my ($retcode) = @_; + $retcode = 0 if (!defined $retcode); $g{'shutting_down'} = 1; @@ -2125,7 +2127,7 @@ } - exit 0; + exit $retcode; } END { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <buc...@us...> - 2009-01-05 09:55:29
|
Revision: 108 http://devmon.svn.sourceforge.net/devmon/?rev=108&view=rev Author: buchanmilne Date: 2009-01-05 09:55:21 +0000 (Mon, 05 Jan 2009) Log Message: ----------- Close and re-open log files on HUP Modified Paths: -------------- trunk/modules/dm_config.pm Modified: trunk/modules/dm_config.pm =================================================================== --- trunk/modules/dm_config.pm 2008-12-31 12:59:26 UTC (rev 107) +++ trunk/modules/dm_config.pm 2009-01-05 09:55:21 UTC (rev 108) @@ -217,6 +217,7 @@ # Set up our signal handlers $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = \&quit; + $SIG{HUP} = \&reopen_log; # Parse command line options my($syncconfig,$synctemps,$resetowner,$readhosts); @@ -1007,6 +1008,17 @@ $g{'log'}->autoflush(1); } + # Allow Rotation of log files + sub reopen_log { + my ($signal) = @_; + do_log("Received signal $signal, closing and re-opening log file",3); + if (defined $g{'log'}) { + undef $g{'log'}; + &open_log; + } + do_log("Re-opened log file $g{'logfile'}",3); + return 1; + } # Sub to log data to a logfile and print to screen if verbose @@ -2014,6 +2026,7 @@ # Set up our signal handlers again, just to be sure $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = \&quit; + $SIG{HUP} = \&reopen_log; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <buc...@us...> - 2009-01-05 13:59:11
|
Revision: 109 http://devmon.svn.sourceforge.net/devmon/?rev=109&view=rev Author: buchanmilne Date: 2009-01-05 13:59:03 +0000 (Mon, 05 Jan 2009) Log Message: ----------- Fix "Argument <signal> isn't numeric in exit" Modified Paths: -------------- trunk/modules/dm_config.pm Modified: trunk/modules/dm_config.pm =================================================================== --- trunk/modules/dm_config.pm 2009-01-05 09:55:21 UTC (rev 108) +++ trunk/modules/dm_config.pm 2009-01-05 13:59:03 UTC (rev 109) @@ -2116,6 +2116,10 @@ sub quit { my ($retcode) = @_; $retcode = 0 if (!defined $retcode); + if ($retcode !~ /^\d*$/) { + do_log("Received signal $retcode, shutting down with return code 0",3); + $retcode = 0; + } $g{'shutting_down'} = 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <buc...@us...> - 2009-01-22 16:11:44
|
Revision: 117 http://devmon.svn.sourceforge.net/devmon/?rev=117&view=rev Author: buchanmilne Date: 2009-01-22 16:11:37 +0000 (Thu, 22 Jan 2009) Log Message: ----------- Handle line continuations in bb-hosts file (W.J.M. Nelis) Modified Paths: -------------- trunk/modules/dm_config.pm Modified: trunk/modules/dm_config.pm =================================================================== --- trunk/modules/dm_config.pm 2009-01-09 16:09:24 UTC (rev 116) +++ trunk/modules/dm_config.pm 2009-01-22 16:11:37 UTC (rev 117) @@ -1265,9 +1265,14 @@ } # Now interate through our file and suck out the juicy bits - FILELINE: for my $line (<BBFILE>) { + FILELINE: while ( my $line= <BBFILE> ) { chomp $line; + while ( $line=~ s/\\$// and ! eof(BBFILE) ) { + $line.= <BBFILE> ; # Merge with next line + chomp $line ; + } # of while + # First see if this is an include statement if($line =~ /^\s*(?:disp|net)?include\s+(.+)$/i) { my $file = $1; @@ -1391,8 +1396,8 @@ ++$hosts_left; } } - close BBFILE; } + close BBFILE; } while @bbfiles; # End of do {} loop This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <buc...@us...> - 2009-01-22 17:58:45
|
Revision: 119 http://devmon.svn.sourceforge.net/devmon/?rev=119&view=rev Author: buchanmilne Date: 2009-01-22 17:58:36 +0000 (Thu, 22 Jan 2009) Log Message: ----------- Avoid error messages if environment variables not set Modified Paths: -------------- trunk/modules/dm_config.pm Modified: trunk/modules/dm_config.pm =================================================================== --- trunk/modules/dm_config.pm 2009-01-22 16:35:15 UTC (rev 118) +++ trunk/modules/dm_config.pm 2009-01-22 17:58:36 UTC (rev 119) @@ -122,11 +122,11 @@ 'regex' => 'yes|no', 'set' => 0, 'case' => 0 }, - 'bbhosts' => { 'default' => ($ENV{'BBHOSTS'} ne '') ? $ENV{'BBHOSTS'} : '/home/hobbit/server/etc/bb-hosts', + 'bbhosts' => { 'default' => (defined $ENV{'BBHOSTS'} and $ENV{'BBHOSTS'} ne '') ? $ENV{'BBHOSTS'} : '/home/hobbit/server/etc/bb-hosts', 'regex' => '.+', 'set' => 0, 'case' => 1 }, - 'bblocation' => { 'default' => ($ENV{'BBLOCATION'} ne '') ? $ENV{'BBLOCATION'} : '', + 'bblocation' => { 'default' => (defined $ENV{'BBLOCATION'} and $ENV{'BBLOCATION'} ne '') ? $ENV{'BBLOCATION'} : '', 'regex' => '\w+', 'set' => 0, 'case' => 1 }, @@ -174,15 +174,15 @@ 'regex' => 'bb|hobbit', 'set' => 0, 'case' => 0 }, - 'dispserv' => { 'default' => ($ENV{BBDISP} ne '') ? $ENV{'BBDISP'} : 'localhost', + 'dispserv' => { 'default' => (defined $ENV{'BBDISP'} and $ENV{BBDISP} ne '') ? $ENV{'BBDISP'} : 'localhost', 'regex' => '\S+', 'set' => 0, 'case' => 0 }, - 'dispport' => { 'default' => ($ENV{'BBPORT'} ne '') ? $ENV{'BBPORT'} : 1984, + 'dispport' => { 'default' => (defined $ENV{'BBPORT'} and $ENV{'BBPORT'} ne '') ? $ENV{'BBPORT'} : 1984, 'regex' => '\d+', 'set' => 0, 'case' => 0 }, - 'bbdateformat' => { 'default' => ($ENV{'BBDATEFORMAT'} ne '') ? $ENV{'BBDATEFORMAT'} : '', + 'bbdateformat' => { 'default' => (defined $ENV{'BBDATEFORMAT'} and $ENV{'BBDATEFORMAT'} ne '') ? $ENV{'BBDATEFORMAT'} : '', 'regex' => '.+', 'set' => 0, 'case' => 1 }, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <buc...@us...> - 2009-01-22 18:09:07
|
Revision: 120 http://devmon.svn.sourceforge.net/devmon/?rev=120&view=rev Author: buchanmilne Date: 2009-01-22 18:09:01 +0000 (Thu, 22 Jan 2009) Log Message: ----------- Remove loading POSIX module, as it is not used, but causes warnings on start if present Modified Paths: -------------- trunk/modules/dm_config.pm Modified: trunk/modules/dm_config.pm =================================================================== --- trunk/modules/dm_config.pm 2009-01-22 17:58:36 UTC (rev 119) +++ trunk/modules/dm_config.pm 2009-01-22 18:09:01 UTC (rev 120) @@ -29,7 +29,6 @@ require dm_tests; require dm_templates; use IO::File; - use POSIX; use FindBin; # Load initial program values; only called once at program init This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dba...@us...> - 2009-09-22 05:21:46
|
Revision: 151 http://devmon.svn.sourceforge.net/devmon/?rev=151&view=rev Author: dbaldwin Date: 2009-09-22 05:21:12 +0000 (Tue, 22 Sep 2009) Log Message: ----------- initialise $numdevs and $numtests to eliminate warning when no devices configured Modified Paths: -------------- trunk/modules/dm_config.pm Modified: trunk/modules/dm_config.pm =================================================================== --- trunk/modules/dm_config.pm 2009-09-15 04:49:45 UTC (rev 150) +++ trunk/modules/dm_config.pm 2009-09-22 05:21:12 UTC (rev 151) @@ -1939,8 +1939,8 @@ my %exc_sc = ( 'i' => 'ignore', 'o' => 'only', 'ao' => 'alarm', 'na' => 'noalarm' ); # Statistic variables (done here in singlenode, instead of syncservers) - my $numdevs; - my $numtests; + my $numdevs = 0; + my $numtests = 0; # Check if the hosts file even exists return %hosts if !-e $g{'dbfile'}; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <buc...@us...> - 2009-10-27 07:32:54
|
Revision: 157 http://devmon.svn.sourceforge.net/devmon/?rev=157&view=rev Author: buchanmilne Date: 2009-10-27 07:32:42 +0000 (Tue, 27 Oct 2009) Log Message: ----------- Handle line continuations in bb-hosts file (W.J.M. Nelis) Modified Paths: -------------- trunk/modules/dm_config.pm Modified: trunk/modules/dm_config.pm =================================================================== --- trunk/modules/dm_config.pm 2009-10-26 12:34:38 UTC (rev 156) +++ trunk/modules/dm_config.pm 2009-10-27 07:32:42 UTC (rev 157) @@ -1784,6 +1784,13 @@ "host='$host' and test='$test' and type='$type'"); } } + # Clean up exception types that may have been present in the past + foreach (keys %{$old_hosts{$host}{'except'}{$test}{$oid}}) { + do_log("Checking for stale exception types $_ on host $host test $test oid $oid") if $g{'debug'}; + if (not defined $new_hosts{$host}{'except'}{$test}{$oid}{$_}) { + db_do("delete from custom_excepts where host='$host' and test='$test' and type='$_' and oid='$oid'"); + } + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <buc...@us...> - 2009-11-23 13:59:21
|
Revision: 159 http://devmon.svn.sourceforge.net/devmon/?rev=159&view=rev Author: buchanmilne Date: 2009-11-23 13:59:04 +0000 (Mon, 23 Nov 2009) Log Message: ----------- Export log_fatal, dm_templates uses it to try and tell you it couldnt find the template directory Modified Paths: -------------- trunk/modules/dm_config.pm Modified: trunk/modules/dm_config.pm =================================================================== --- trunk/modules/dm_config.pm 2009-11-02 06:50:45 UTC (rev 158) +++ trunk/modules/dm_config.pm 2009-11-23 13:59:04 UTC (rev 159) @@ -2,7 +2,7 @@ require Exporter; @ISA = qw(Exporter); @EXPORT = qw(initialize sync_servers time_test do_log db_connect - bin_path na nd db_get db_get_array db_do); + bin_path na nd db_get db_get_array db_do log_fatal); @EXPORT_OK = qw(%c); # Devmon: An SNMP data collector & page generator for the BigBrother & This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <buc...@us...> - 2010-03-10 21:13:30
|
Revision: 171 http://devmon.svn.sourceforge.net/devmon/?rev=171&view=rev Author: buchanmilne Date: 2010-03-10 21:13:24 +0000 (Wed, 10 Mar 2010) Log Message: ----------- Log fork signals separately at high debug levels Modified Paths: -------------- trunk/modules/dm_config.pm Modified: trunk/modules/dm_config.pm =================================================================== --- trunk/modules/dm_config.pm 2010-03-10 20:51:36 UTC (rev 170) +++ trunk/modules/dm_config.pm 2010-03-10 21:13:24 UTC (rev 171) @@ -2151,7 +2151,11 @@ my ($retcode) = @_; $retcode = 0 if (!defined $retcode); if ($retcode !~ /^\d*$/) { - do_log("Received signal $retcode, shutting down with return code 0",3); + if($g{'parent'}) { + do_log("Master received signal $retcode, shutting down with return code 0",3); + } else { + do_log("Fork with pid $$ received signal $retcode, shutting down with return code 0",5); + } $retcode = 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <buc...@us...> - 2010-03-10 23:21:36
|
Revision: 180 http://devmon.svn.sourceforge.net/devmon/?rev=180&view=rev Author: buchanmilne Date: 2010-03-10 23:21:27 +0000 (Wed, 10 Mar 2010) Log Message: ----------- Allow debugging in daemon mode Modified Paths: -------------- trunk/modules/dm_config.pm Modified: trunk/modules/dm_config.pm =================================================================== --- trunk/modules/dm_config.pm 2010-03-10 22:51:08 UTC (rev 179) +++ trunk/modules/dm_config.pm 2010-03-10 23:21:27 UTC (rev 180) @@ -265,8 +265,8 @@ - # Dont daemonize if we are printing messages or debug - $g{'daemonize'} = 0 if $g{'print_msg'} or $g{'debug'}; + # Dont daemonize if we are printing messages + $g{'daemonize'} = 0 if $g{'print_msg'}; # Daemonize if need be daemonize(); @@ -293,7 +293,7 @@ } # Now write our pid to the pidfile - if(!$g{'debug'}) { + if($g{'daemonize'}) { my $pid_handle = new IO::File $g{'pidfile'}, 'w' or log_fatal("Cant write to pidfile $g{'pidfile'} ($!)",0); $pid_handle->print($g{'mypid'}); @@ -1008,8 +1008,8 @@ # Open log file sub open_log { - # Dont open the log if we are in debug mode - return if $g{'logfile'} =~ /^\s*$/ or $g{'debug'}; + # Dont open the log if we are not in daemon mode + return if $g{'logfile'} =~ /^\s*$/ or !$g{'daemonize'}; $g{'log'} = new IO::File $g{'logfile'}, 'a' or log_fatal("Unable to open logfile! ($!)",0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <buc...@us...> - 2011-01-11 13:41:54
|
Revision: 188 http://devmon.svn.sourceforge.net/devmon/?rev=188&view=rev Author: buchanmilne Date: 2011-01-11 13:41:47 +0000 (Tue, 11 Jan 2011) Log Message: ----------- Open the log file before daemonize so stderr is still open to report if opening the log file fails, but re-open the log file in daemonize Modified Paths: -------------- trunk/modules/dm_config.pm Modified: trunk/modules/dm_config.pm =================================================================== --- trunk/modules/dm_config.pm 2010-11-30 11:35:45 UTC (rev 187) +++ trunk/modules/dm_config.pm 2011-01-11 13:41:47 UTC (rev 188) @@ -268,12 +268,12 @@ # Dont daemonize if we are printing messages $g{'daemonize'} = 0 if $g{'print_msg'}; + # Open the log file + open_log(); + # Daemonize if need be daemonize(); - # Open the log file - open_log(); - # Set our pid $g{'mypid'} = $$; @@ -1012,14 +1012,14 @@ return if $g{'logfile'} =~ /^\s*$/ or !$g{'daemonize'}; $g{'log'} = new IO::File $g{'logfile'}, 'a' - or log_fatal("Unable to open logfile! ($!)",0); + or log_fatal("ERROR: Unable to open logfile $g{'logfile'} ($!)",0); $g{'log'}->autoflush(1); } # Allow Rotation of log files sub reopen_log { my ($signal) = @_; - do_log("Received signal $signal, closing and re-opening log file",3); + do_log("Received signal $signal, closing and re-opening log file",3) if $signal; if (defined $g{'log'}) { undef $g{'log'}; &open_log; @@ -2062,6 +2062,9 @@ $SIG{INT} = $SIG{QUIT} = $SIG{TERM} = \&quit; $SIG{HUP} = \&reopen_log; + # Re-open the log file to ensure file descriptors are right + reopen_log(); + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <buc...@us...> - 2011-01-24 14:55:56
|
Revision: 204 http://devmon.svn.sourceforge.net/devmon/?rev=204&view=rev Author: buchanmilne Date: 2011-01-24 14:55:49 +0000 (Mon, 24 Jan 2011) Log Message: ----------- Dump all config keys to log at startup in debug mode Modified Paths: -------------- trunk/modules/dm_config.pm Modified: trunk/modules/dm_config.pm =================================================================== --- trunk/modules/dm_config.pm 2011-01-23 13:37:59 UTC (rev 203) +++ trunk/modules/dm_config.pm 2011-01-24 14:55:49 UTC (rev 204) @@ -341,6 +341,17 @@ do_log("Node $g{'my_nodenum'} reporting to $g{'bbtype'} at $g{'dispserv'}",0); do_log("Running under process id: $g{'mypid'}",0); + # Dump some configs in debug mode + if ($g{'debug'}) { + foreach (keys %{$g{'globals'}}) { + do_log(sprintf("DEBUG CONFIG: global %s: %s",$_,$g{$_})); + } + foreach (keys %{$g{'locals'}}) { + do_log(sprintf("DEBUG CONFIG: local %s: %s",$_,$g{$_})); + } + } + + # We are now initialized $g{'initialized'} = 1; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <buc...@us...> - 2011-04-04 10:59:24
|
Revision: 227 http://devmon.svn.sourceforge.net/devmon/?rev=227&view=rev Author: buchanmilne Date: 2011-04-04 10:59:18 +0000 (Mon, 04 Apr 2011) Log Message: ----------- Fix propagation of HUP signal to forks - Only log re-opening of logs when in debug Modified Paths: -------------- trunk/modules/dm_config.pm Modified: trunk/modules/dm_config.pm =================================================================== --- trunk/modules/dm_config.pm 2011-04-04 10:47:24 UTC (rev 226) +++ trunk/modules/dm_config.pm 2011-04-04 10:59:18 UTC (rev 227) @@ -1033,12 +1033,20 @@ # Allow Rotation of log files sub reopen_log { my ($signal) = @_; - do_log("Received signal $signal, closing and re-opening log file",3) if $signal; + if ($g{'parent'}) { + do_log("Sending signal $signal to forks",3) if $g{'debug'}; + for my $fork (keys %{$g{'forks'}}) { + my $pid = $g{'forks'}{$fork}{'pid'}; + kill $signal, $pid if defined $pid; + } + } + + do_log("Received signal $signal, closing and re-opening log file",3) if $g{'debug'}; if (defined $g{'log'}) { undef $g{'log'}; &open_log; } - do_log("Re-opened log file $g{'logfile'}",3); + do_log("Re-opened log file $g{'logfile'}",3) if $g{'debug'}; return 1; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <buc...@us...> - 2011-04-04 12:10:51
|
Revision: 229 http://devmon.svn.sourceforge.net/devmon/?rev=229&view=rev Author: buchanmilne Date: 2011-04-04 12:10:45 +0000 (Mon, 04 Apr 2011) Log Message: ----------- Only do pid file checks when daemonizing, allows non-daemonized copy to run (e.g. for use with -f, specifically when working on templates with -f -p -h xxx) Modified Paths: -------------- trunk/modules/dm_config.pm Modified: trunk/modules/dm_config.pm =================================================================== --- trunk/modules/dm_config.pm 2011-04-04 11:26:02 UTC (rev 228) +++ trunk/modules/dm_config.pm 2011-04-04 12:10:45 UTC (rev 229) @@ -280,6 +280,9 @@ # Set our pid $g{'mypid'} = $$; + + # PID file handling + if($g{'daemonize'}) { # Check to see if a pid file exists if(-e $g{'pidfile'}) { # One exists, let see if its stale @@ -296,7 +299,6 @@ } # Now write our pid to the pidfile - if($g{'daemonize'}) { my $pid_handle = new IO::File $g{'pidfile'}, 'w' or log_fatal("Cant write to pidfile $g{'pidfile'} ($!)",0); $pid_handle->print($g{'mypid'}); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <buc...@us...> - 2011-04-04 12:17:11
|
Revision: 230 http://devmon.svn.sourceforge.net/devmon/?rev=230&view=rev Author: buchanmilne Date: 2011-04-04 12:17:05 +0000 (Mon, 04 Apr 2011) Log Message: ----------- White space changes for previous commit Modified Paths: -------------- trunk/modules/dm_config.pm Modified: trunk/modules/dm_config.pm =================================================================== --- trunk/modules/dm_config.pm 2011-04-04 12:10:45 UTC (rev 229) +++ trunk/modules/dm_config.pm 2011-04-04 12:17:05 UTC (rev 230) @@ -283,29 +283,29 @@ # PID file handling if($g{'daemonize'}) { - # Check to see if a pid file exists - if(-e $g{'pidfile'}) { - # One exists, let see if its stale - my $pid_handle = new IO::File $g{'pidfile'}, 'r' - or log_fatal("Can't read from pid file '$g{'pidfile'}' ($!).", 0); + # Check to see if a pid file exists + if(-e $g{'pidfile'}) { + # One exists, let see if its stale + my $pid_handle = new IO::File $g{'pidfile'}, 'r' + or log_fatal("Can't read from pid file '$g{'pidfile'}' ($!).", 0); - # Read in the old PID - my ($old_pid) = <$pid_handle>; - chomp $old_pid; - $pid_handle->close; + # Read in the old PID + my ($old_pid) = <$pid_handle>; + chomp $old_pid; + $pid_handle->close; - # If it exists, die silently - log_fatal("Devmon already running, quitting.", 1) if kill 0, $old_pid; - } + # If it exists, die silently + log_fatal("Devmon already running, quitting.", 1) if kill 0, $old_pid; + } - # Now write our pid to the pidfile - my $pid_handle = new IO::File $g{'pidfile'}, 'w' - or log_fatal("Cant write to pidfile $g{'pidfile'} ($!)",0); - $pid_handle->print($g{'mypid'}); - $pid_handle->close; + # Now write our pid to the pidfile + my $pid_handle = new IO::File $g{'pidfile'}, 'w' + or log_fatal("Cant write to pidfile $g{'pidfile'} ($!)",0); + $pid_handle->print($g{'mypid'}); + $pid_handle->close; } - # Autodetect our nodename on user request + # Autodetect our nodename on user request if($g{'nodename'} eq 'HOSTNAME') { my $hostname_bin = bin_path('hostname'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <buc...@us...> - 2009-01-09 16:09:29
|
Revision: 116 http://devmon.svn.sourceforge.net/devmon/?rev=116&view=rev Author: buchanmilne Date: 2009-01-09 16:09:24 +0000 (Fri, 09 Jan 2009) Log Message: ----------- Honour Hobbit BBLOCATION / NET tag Modified Paths: -------------- trunk/modules/dm_config.pm Modified: trunk/modules/dm_config.pm =================================================================== --- trunk/modules/dm_config.pm 2009-01-09 16:07:23 UTC (rev 115) +++ trunk/modules/dm_config.pm 2009-01-09 16:09:24 UTC (rev 116) @@ -126,6 +126,10 @@ 'regex' => '.+', 'set' => 0, 'case' => 1 }, + 'bblocation' => { 'default' => ($ENV{'BBLOCATION'} ne '') ? $ENV{'BBLOCATION'} : '', + 'regex' => '\w+', + 'set' => 0, + 'case' => 1 }, 'bbtag' => { 'default' => 'DEVMON', 'regex' => '\w+', 'set' => 0, @@ -1277,6 +1281,15 @@ elsif($line =~ /^\s*(\d+\.\d+\.\d+\.\d+)\s+(\S+)(.*)$/i) { my ($ip, $host, $bbopts) = ($1, $2, $3); + # Skip if the NET tag does not match this site + do_log("Checking if $bbopts matches NET:" . $g{'bblocation'} . ".",2); + if ($g{'bblocation'} ne '') { + if ($bbopts !~ / NET:$g{'bblocation'}/) { + do_log("The NET for $host is not $g{'bblocation'}. Skipping.",1); + next; + } + } + # See if we can find our bbtag to let us know this is a devmon host if($bbopts =~ /$g{'bbtag'}(:\S+|\s+|$)/) { my $options = $1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <buc...@us...> - 2010-03-10 20:52:10
|
Revision: 170 http://devmon.svn.sourceforge.net/devmon/?rev=170&view=rev Author: buchanmilne Date: 2010-03-10 20:51:36 +0000 (Wed, 10 Mar 2010) Log Message: ----------- Avoid divide by zero calculating average tests per node when no active nodes Modified Paths: -------------- trunk/modules/dm_config.pm Modified: trunk/modules/dm_config.pm =================================================================== --- trunk/modules/dm_config.pm 2010-02-03 14:26:23 UTC (rev 169) +++ trunk/modules/dm_config.pm 2010-03-10 20:51:36 UTC (rev 170) @@ -496,7 +496,7 @@ my $num_active_nodes = @active_nodes + 0; # Determine the avg number of tests/node - my $avg_tests_node = int $total_tests / $num_active_nodes; + my $avg_tests_node = $num_active_nodes ? int $total_tests / $num_active_nodes : 0; # Now lets see if we need tests if($my_num_tests < $avg_tests_node) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <buc...@us...> - 2011-01-25 09:00:43
|
Revision: 211 http://devmon.svn.sourceforge.net/devmon/?rev=211&view=rev Author: buchanmilne Date: 2011-01-25 09:00:37 +0000 (Tue, 25 Jan 2011) Log Message: ----------- Support the 'directory' statement in bb-hosts (#2897676) Modified Paths: -------------- trunk/modules/dm_config.pm Modified: trunk/modules/dm_config.pm =================================================================== --- trunk/modules/dm_config.pm 2011-01-24 15:45:24 UTC (rev 210) +++ trunk/modules/dm_config.pm 2011-01-25 09:00:37 UTC (rev 211) @@ -1296,6 +1296,15 @@ push @bbfiles, $file; } + # Similarly, but different, for directory + if($line =~ /^\s*directory\s+(\S+)$/i) { + require File::Find; + import File::Find; + my $dir = $1; + do_log("Looking for bb-hosts files in $dir",3) if $g{'debug'}; + find(sub {push @bbfiles,$File::Find::name},$dir); + } + # Else see if this line matches the ip/host bb-hosts format elsif($line =~ /^\s*(\d+\.\d+\.\d+\.\d+)\s+(\S+)(.*)$/i) { my ($ip, $host, $bbopts) = ($1, $2, $3); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <buc...@us...> - 2011-04-04 10:45:12
|
Revision: 225 http://devmon.svn.sourceforge.net/devmon/?rev=225&view=rev Author: buchanmilne Date: 2011-04-04 10:45:05 +0000 (Mon, 04 Apr 2011) Log Message: ----------- Reduce verbosity of checks on NET tag Modified Paths: -------------- trunk/modules/dm_config.pm Modified: trunk/modules/dm_config.pm =================================================================== --- trunk/modules/dm_config.pm 2011-04-04 10:42:20 UTC (rev 224) +++ trunk/modules/dm_config.pm 2011-04-04 10:45:05 UTC (rev 225) @@ -1313,10 +1313,10 @@ my ($ip, $host, $bbopts) = ($1, $2, $3); # Skip if the NET tag does not match this site - do_log("Checking if $bbopts matches NET:" . $g{'bblocation'} . ".",2); + do_log("Checking if $bbopts matches NET:" . $g{'bblocation'} . ".",4) if $g{'debug'}; if ($g{'bblocation'} ne '') { if ($bbopts !~ / NET:$g{'bblocation'}/) { - do_log("The NET for $host is not $g{'bblocation'}. Skipping.",1); + do_log("The NET for $host is not $g{'bblocation'}. Skipping.",3); next; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |