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

Cédric Villemain cedric.villemain.debian at gmail.com
Mon Nov 14 14:21:07 UTC 2011


2011/11/14 Guillaume Lelarge <guillaume at lelarge.info>:
> 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.

but the perfdata is good, maybe we can guess that in absence of named
column, the first one is the good one ?

>
>> => 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
>
> _______________________________________________
> Check_postgres mailing list
> Check_postgres at bucardo.org
> https://mail.endcrypt.com/mailman/listinfo/check_postgres
>



-- 
Cédric Villemain +33 (0)6 20 30 22 52
http://2ndQuadrant.fr/
PostgreSQL: Support 24x7 - Développement, Expertise et Formation


More information about the Check_postgres mailing list