[check_postgres] [check_postgresql.pl] make test problem and chack_postgresql result problem

Guillaume Lelarge guillaume at lelarge.info
Mon Nov 14 14:02:50 UTC 2011


Hi,

On Sat, 2011-11-12 at 22:13 +0100, Philippe wrote:
> [...]
> I have 2 problems :
> 1°) i have a non conform return for a query :
> => with your script :
> /usr/local/bin/check_postgres.pl -H=192.168.123.25 -u=postgres 
> --db=ipplan --critical=350 --action=custom_query --query="select 
> count(*)  from ipaddr" --reverse
> POSTGRES_CUSTOM_QUERY UNKNOWN: DB "ipplan" (host:192.168.123.25) Format 
> invalide renvoyr la requpersonnalis time=0.01s count=617;;350
> if I add :
> use encoding 'utf8';
> i have :
> /usr/local/bin/check_postgres.pl -H=192.168.123.25 -u=postgres 
> --db=ipplan --critical=350 --action=custom_query --query="select 
> count(*)  from ipaddr" --reverse
> POSTGRES_CUSTOM_QUERY UNKNOWN: DB "ipplan" (host:192.168.123.25) Format 
> invalide renvoyé par la requête personnalisée | time=0.01s count=617;;350
> 
> The result is good : count=617 where is the problem, why the retur is 
> UNKNOWN ?
> 

Because you didn't name the result column. Try this:

/usr/local/bin/check_postgres.pl -H=192.168.123.25 -u=postgres
--db=ipplan --critical=350 --action=custom_query --query="select
count(*) AS result from ipaddr" --reverse

note the "AS result" in the query string.

> => the query in psql :
> postgres=# \c ipplan
> psql (8.4.9)
> Vous êtes maintenant connecté à la base de données « ipplan ».
> ipplan=# SELECT "count"(*) FROM ipaddr;
>   count
> -------
>     617
> (1 ligne)
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 2°) the make test report (my locale is FR:
>   => make test
> postgres at postgres1:/var/sources/appz/system/nagios/plugins/check_postgres-2.18.0$ 
> make test
[...]
> Files=42, Tests=3, 68 wallclock secs ( 0.01 usr  0.02 sys +  0.27 cusr  
> 0.24 csys =  0.54 CPU)
> Result: FAIL
> Failed 37/42 test programs. 0/3 subtests failed.
> make: *** [test_dynamic] Erreur 255
> 

The tests are only good when you're using english. I didn't try it, but
I guess a "LANG=C make test" should work better.


-- 
Guillaume
  http://blog.guillaume.lelarge.info
  http://www.dalibo.com



More information about the Check_postgres mailing list