[check_postgres] Getting per-database size values

Cédric Villemain cedric.villemain.debian at gmail.com
Mon Nov 21 15:38:54 UTC 2011


2011/11/21 Emmanuel Lesouef <e.lesouef at crbn.fr>:
> Hi,
>
> I'm currently using check_postgres to get some numerical values (using
> --output=simple) in order to get them in our Zabbix monitoring system.
>
> I would like to get the database size on a per-database basis.
>
> Is it possible ?

yes

>
> I thought I could use it like this :
>
> postgres at pgsql0:~$ /usr/local/bin/check_postgres.pl --output=simple
> --action=database_size -db db1
> 1522500408
> postgres at pgsql0:~$ /usr/local/bin/check_postgres.pl --output=simple
> --action=database_size -db postgis
> 1522500408
>
> But obviously, it returns the size of the whole cluster.
>
> Did I do something wrong ?

yes and no :)
There is difference between the connection elements
(port,db,user,host,service) and the include/exclude to gather
information.

In your case, you are connecting to -db db1 or postgis, good. but you
need to add --include=gis to get the gis db size for example.

see http://bucardo.org/check_postgres/check_postgres.pl.html#basic_filtering


>
> Thanks for your help.

You're welcome.

-- 
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