[check_postgres] using a custom query - escaping quote marks in nagios

Ed Greenberg edg at greenberg.org
Wed Mar 4 18:07:39 UTC 2009


Hi Folks,

I'd like to do a custom query. I've verified that basic 
check_postgres.pl functionality works in Nagios but when I try to do this:
define command {
command_name    check_digest_queue
command_line    $USER5$/check_postgres.pl --host=$HOSTADDRESS 
--db=wg_production --action=custom_query --query="select count(*) from 
$ARG1$ where sent_at is null;" --critical=$ARG2$
}


called with
        check_command check_digest_queue!ntt_digest_queue!100000

I get
UNKNOWN:    **ePN /usr/local/nagios/custom/libexec/check_postgres.pl: "

The command line works at the shell, even when user is nagios, so I 
believe that the problem is that quotes are being stripped.  What are 
others doing to make sure that the quoted arguments stay together?  Or 
are others getting good results without escaping the quotes.

Thanks,
</edg>



More information about the Check_postgres mailing list