[check_postgres] Stack with check_postgres

Greg Sabino Mullane greg at endpoint.com
Mon Jul 4 22:11:29 UTC 2011


> 1).  I have a postgres function that returns two columns
...
> But when I insert it in the commands.cfg and watch this through the Nagios
> frontend it return (null).
> 
> The log file doesn't contain any detailed information for debugging this.
> So, what can I do to get to the bottom of this issue - any help greatly
> appreciated

Have not seen a reply to this other than the ones on stack overflow, 
but as they say there make sure everything is escaped properly. Otherwise 
you might check all the log files for clues: Postgres and Nagios. If it 
is still an issue, post the exact commands from the config files here.

> 2). It seems that I 'm having problems with quoting (single or double).
...
> /usr/local/nagios/libexec/check_postgres.pl -H $HOSTADDRESS$ -u postgres
> --db=monitordb --action=custom_query --critical=20 --query="SELECT
> count(fresh) as result FROM vwfreshness WHERE fresh='stale' "
...
> The quoting issue is really important for me, because I'm using check_by_ssh
> for another DB and I don't know how to face the double quoting for the SQL
> command, in the double quoting for the check_by_ssh command.

If all else fails, you could make a view that contains the quoted WHERE 
clause and call that:

CREATE VIEW foobar AS SELECT count(fresh) AS result FROM vwfreshness
  WHERE fresh = 'stale';

... --query="SELECT result FROM foobar"


-- 
Greg Sabino Mullane greg at endpoint.com
End Point Corporation
PGP Key: 0x14964AC8
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 163 bytes
Desc: not available
Url : https://mail.endcrypt.com/pipermail/check_postgres/attachments/20110704/52cea964/attachment.bin 


More information about the Check_postgres mailing list