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

Philippe webmaster at leworm.fr
Tue Nov 15 04:43:36 UTC 2011


Le 14/11/2011 15:02, Guillaume Lelarge a écrit :
> 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.
Thank you it's working i add As result in the query :
  => /usr/local/nagios/libexec/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
POSTGRES_CUSTOM_QUERY OK: DB "ipplan" (host:192.168.123.25) 617 | 
time=0.02s
>
>> =>  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.
>
>


-- 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mail.endcrypt.com/pipermail/check_postgres/attachments/20111115/140833c5/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.png
Type: image/png
Size: 2449 bytes
Desc: not available
Url : https://mail.endcrypt.com/pipermail/check_postgres/attachments/20111115/140833c5/attachment.png 


More information about the Check_postgres mailing list