[check_postgres] misbehavior in check_bloat ?

Cédric Villemain cedric.villemain at dalibo.com
Tue Aug 4 13:31:16 UTC 2009


Hello,

while reading check_bloat code in order to recode the nagios output I find a 
strange thing.
I usually use a warning and critical in GB or MB, then for test I used %.
It happen that the folowing is used to check the bloat percentage : 
  ROUND(CASE WHEN otta=0 THEN 0.0 ELSE sml.relpages/otta::numeric END,1) 
and *100 to compare with warning or critical.
Ex: 
  check_postgres.pl --action bloat -w "40%" --perflimit 1
  POSTGRES_BLOAT WARNING: DB "postgres" (host:localhost) (db postgres) table 
pg_catalog.pg_class lignes:260 pages:11 devrait être:7 (1.6X) place 
perdue:32768 (32 kB)

I need to set -w "161%" to remove this warning when I expect to put 40 % :
round((11-7)*100/11) = 36  
is the percentage of the wasted space of the *current* real relation size.

I suggest to change the bloat check that way : 
  ROUND(CASE WHEN sml.relpages=0 THEN 0.0 ELSE (sml.relpages-
otta::numeric)*100/sml.relpages END,0) 

If you agree, I can provide a patch for that.
----
Cédric Villemain
Administrateur de Base de Données
Cel: +33 (0)6 74 15 56 53
http://dalibo.com - http://dalibo.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : https://mail.endcrypt.com/pipermail/check_postgres/attachments/20090804/ad389a61/attachment.bin 


More information about the Check_postgres mailing list