[check_postgres] custom query problem, getting cache hit rate for a DB.

Craig Sawyer csawyer at yumaed.org
Mon Sep 5 20:44:51 UTC 2011


Hi,

First, thank you for all the stuff you post on bucardo.org!

I'm testing the custom_query option in check_postgres for eventual
inclusion into nagios.  I want to measure the cache hit rate (and
don't see an option in check_postgres for that already).

My query, which seems to output and do everything as required
according to the docs:

psql -h joliet -U craig -c "SELECT
round(SUM(pg_stat_get_db_blocks_hit(d.oid)+0.01)::real /
SUM(pg_stat_get_db_blocks_fetched(d.oid)+0.01)::real*100) AS hit_rate
FROM pg_database d" tempe_prod
 hit_rate
----------
       97
(1 row)

when ran from check_postgres I get:

check_postgres.pl --action=custom_query --db=yuma_prod -H joliet -u
craig --query="SELECT
round(SUM(pg_stat_get_db_blocks_hit(d.oid)+0.01)::real /
SUM(pg_stat_get_db_blocks_fetched(d.oid)+0.01)::real*100) AS hit_rate
FROM pg_database d" -c 97
POSTGRES_CUSTOM_QUERY UNKNOWN: DB "yuma_prod" (host:joliet) Invalid
format returned by custom query | time=0.11

Which seems to be saying it's not getting back an integer, but I
happen to know that 97 is indeed an integer, so I'm not sure what's
going on.

Perhaps you can help me figure out what I'm doing wrong?

Thanks,
-Craig


More information about the Check_postgres mailing list