Package: check-postgres Version: 2.19.0-1 Severity: normal Tags: patch Hi,
I'm running this, rebuilt but otherwise unmodified, on a squeeze system. Most of the checks should indeed return UNKNOWN when the check fails owing to basic connection problems, but shouldn't the 'connection' check return CRITICAL if the connection fails? It sort of looks like this is intended, but doesn't catch the case where the postgres server isn't listening. Fixed by the following, fairly rough, but working, patch: --- /usr/bin/check_postgres 2013-02-14 18:06:03.000000000 +0000 +++ /tmp/check_postgres 2013-02-18 15:51:25.000000000 +0000 @@ -2353,6 +2353,14 @@ ndie msg('runcommand-timeout', $timeout); } + if ($db->{error} =~ /could not connect/) { + ## If we are just trying to connect, this should be a normal error + if ($action eq 'connection') { + $info->{fatal} = 1; + return $info; + } + } + if ($db->{fail} and !$arg->{failok} and !$arg->{noverify}) { ## Check if problem is due to backend being too old for this check @@ -3966,7 +3974,7 @@ for $db (@{$info->{db}}) { my $err = $db->{error} || ''; - if ($err =~ /FATAL/) { + if ($err =~ /FATAL|could not connect/) { $MRTG and do_mrtg({one => 0}); add_critical $db->{error}; return; -- Dominic Hargreaves, Systems Development and Support Section IT Services, University of Oxford
signature.asc
Description: Digital signature