diff options
author | Greg Sabino Mullane | 2010-12-27 17:04:47 +0000 |
---|---|---|
committer | Greg Sabino Mullane | 2010-12-27 17:04:47 +0000 |
commit | 313372772f6c2d32708308e89dac9af90dff1e81 (patch) | |
tree | f0eedbc2f0be07c0075ab1d8b7ddb28880555b67 /check_postgres.pl | |
parent | 4014de0332cf2510be623d14bf250c79c5fb72db (diff) |
For connection test, return critical, not unknown, on FATAL errors
Diffstat (limited to 'check_postgres.pl')
-rwxr-xr-x | check_postgres.pl | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/check_postgres.pl b/check_postgres.pl index b5ff62de4..085d079bb 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -1932,6 +1932,12 @@ sub run_command { } if ($db->{error} =~ /FATAL/) { + ## If we are just trying to connect, this should be a normal error + if ($action eq 'connection') { + $info->{fatal} = 1; + return $info; + } + if (exists $arg->{fatalregex} and $db->{error} =~ /$arg->{fatalregex}/) { $info->{fatalregex} = $db->{error}; next; @@ -3079,6 +3085,12 @@ sub check_connection { $db = $info->{db}[0]; + if (exists $info->{fatal}) { + $MRTG and do_mrtg({one => 0}); + add_critical $db->{error}; + return; + } + my $ver = ($db->{slurp}[0]{v} =~ /(\d+\.\d+\S+)/o) ? $1 : ''; $MRTG and do_mrtg({one => $ver ? 1 : 0}); @@ -8751,6 +8763,9 @@ Items not specifically attributed are by Greg Sabino Mullane. Fix problem when examining items in pg_settings (Greg Sabino Mullane) + For connection test, return critical, not unknown, on FATAL errors + (Greg Sabino Mullane, reported by Peter Eisentraut in bug #62) + =item B<Version 2.15.0> Add --quiet argument to surpress output on OK Nagios results |