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

Guillaume Lelarge guillaume at lelarge.info
Mon Nov 14 14:39:55 UTC 2011


On Mon, 2011-11-14 at 15:21 +0100, Cédric Villemain wrote:
> 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 ?
> 

Well, if we only have one column, we should probably guess that it's the
value. So, yes. We'll need a patch for that, though :)


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



More information about the Check_postgres mailing list