From: Russ Allbery Date: Tue, 19 Oct 2010 16:32:41 +0000 (-0700) Subject: Report a warning if the salvager is running X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=959a73cd00aec633a1cde7166aede42c67a57de2;p=packages%2Fa%2Fafs-monitor.git Report a warning if the salvager is running If the salvager is running (such as when started manually with bos salvage), check_bos now reports a warning stating that, rather than a critical error showing the auxiliary status line. Reported by Steve Rader. --- diff --git a/NEWS b/NEWS index bee8767..ee8362d 100644 --- a/NEWS +++ b/NEWS @@ -4,3 +4,8 @@ afs-monitor 2.0 (unreleased) Initial tarball release, based on check_afsspace 1.16, check_bos 1.7, check_rxdebug 1.11, and check_udebug 1.3. + + If the salvager is running (such as when started manually with bos + salvage), check_bos now reports a warning stating that, rather than a + critical error showing the auxiliary status line. Reported by Steve + Rader. diff --git a/check_bos b/check_bos index 870726e..e0363b8 100755 --- a/check_bos +++ b/check_bos @@ -102,6 +102,7 @@ if ($? != 0) { # Scan the output. If we see anything that we don't expect, immediately # report it as a fatal error. +my $prev_line = ''; for my $line (@bos) { my $okay = 0; for my $regex (@OKAY) { @@ -113,8 +114,13 @@ for my $line (@bos) { unless ($okay) { $line =~ s/^\s+//; $line =~ s/\s+$//; - print "BOS CRITICAL - $line\n"; - exit 2; + if ($prev_line =~ /^Instance salvage,/ && $line =~ /running now/) { + print "BOS WARNING - salvage is running\n"; + exit 1; + } else { + print "BOS CRITICAL - $line\n"; + exit 2; + } } } print "BOS OK\n"; @@ -142,14 +148,16 @@ may require some customization. B will always print out a single line of output. If there is a line that isn't matched by any regexes identifying acceptable lines, it -will output the first non-matching line prefixed by C. -Otherwise, it will output B. Note that this monitoring may not -catch such things as a service being constantly restarted if it happens to -be up and running normally each time the probe runs; it doesn't pay any -attention to the last start time, the last error exit status, the presence -of core files, and the like. It mostly just looks for the "running -normally" part of the B output and makes sure the auxilliary status -is also "running normally" for a file server process. +will output the first non-matching line prefixed by C. If +the salvager is running (such as when started by C, it will +print that out prefixed by C. Otherwise, it will output +B. Note that this monitoring may not catch such things as a +service being constantly restarted if it happens to be up and running +normally each time the probe runs; it doesn't pay any attention to the +last start time, the last error exit status, the presence of core files, +and the like. It mostly just looks for the "running normally" part of the +B output and makes sure the auxilliary status is also "running +normally" for a file server process. =head1 OPTIONS @@ -179,9 +187,10 @@ Print out the version of B and quit. =head1 EXIT STATUS B follows the standard Nagios exit status requirements. This -means that it will exit with status 0 if there are no problems or with -status 2 if there is a problem detected. For other errors, such as -invalid syntax, B will exit with status 3. +means that it will exit with status 0 if there are no problems, with +status 1 if the salvager is running, or with status 2 if there is a +problem detected. For other errors, such as invalid syntax, B +will exit with status 3. =head1 BUGS