[check_postgres] FW: Stack with check_postgres

George Lytras george.lytras at shiftenergy.com
Fri Feb 25 20:31:49 UTC 2011

Hi again,


Issue 1) almost fixed, it seemed that I had the semicolon at the end of the
query, when I took it out it worked!!!


I am still getting only the result back through nagios and no data are
displayed. Any thoughts about that one?


Issue 2) So the semicolon seemed to be causing the problem through the
check_by_ssh as well!!!

I used double quoting(") for the check_by_ssh command, and single quoting(')
for the query.

I didn't try to see though what happens if I want to use a third quoting,
e.g. if I want to check a date column.

Oh well, we 'll see then.




From: George Lytras [mailto:george.lytras at shiftenergy.com] 
Sent: February-25-11 9:34 AM
To: 'check_postgres at bucardo.org'
Subject: Stack with check_postgres


Hi Bucardo,


I 've been using your plugin for a few days now , it's being very helpful,
great jobl!!


I'm having 2 issues though, and I was wondering if you could help me out.


1).  I have a postgres function that returns two columns


result, data 

(int), (text)


If I run this command from postgres it returns the proper values and if I
run it from the linux command line like this:


/usr/local/nagios/libexec/check_postgres.pl -H $HOSTADDRESS$ -u postgres -db
monitordb --action=custom_query --critical=1 --query="SELECT * from


It also returns the proper values - 


CRITICAL: DB "monitordb''| time=0.24 some data here 


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



2). It seems that I 'm having problems with quoting (single or double).


Again,if I run this from the linux command line like this:


/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' "


POSTGRES_CUSTOM_QUERY OK: DB "monitordb" (host:..) 1 | time=0.45


Through Nagios I 'm also getting (null).


When I run the same command but check a column that it's values are integer,


/usr/local/nagios/libexec/check_postgres.pl -H $HOSTEDDRESS$ -u postgres
--db=monitordb --action=custom_query --critical=20 --query="SELECT
count(fresh) as result FROM vwfreshness WHERE some_column>100 "


I'm getting the correct results everywhere.


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.


Thanks for your time,




-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mail.endcrypt.com/pipermail/check_postgres/attachments/20110225/3809fe05/attachment.html 

More information about the Check_postgres mailing list