Skip to content

PostgreSQL

Auto-Discovery
Health Check
Metrics
Logs
Tutorial available Monitoring PostgreSQL with Bleemeo
Read the tutorial

To enable metrics gathering, credentials are required. The agent will find the credentials by itself if PostgreSQL is running in a Docker container and username/password are set through the environment variables POSTGRES_USER (which defaults to postgres) and POSTGRES_PASSWORD.

By default, only sum metrics are gathered, if you want to monitor specific databases you can add them to the detailed_items setting.

If some auto-detected parameters are wrong, or you want to monitor specific databases, you can add the following to /etc/glouton/conf.d/99-local.conf:

service:
[...]
# For a PostgreSQL running outside a container
- type: "postgresql"
username: "USERNAME"
password: "PASSWORD"
address: "127.0.0.1"
port: 5432
# For an additional PostgreSQL running outside a container
- type: "postgresql"
instance: "NAME_ASSOCIATED_WITH_YOUR_ADDITIONAL_SERVICE"
username: "USERNAME"
password: "PASSWORD"
address: "127.0.0.1"
port: 5433
# For a PostgreSQL running in a Docker container.
- type: "postgresql"
instance: "CONTAINER_NAME"
username: "USERNAME"
password: "PASSWORD"
address: "172.17.0.2"
port: 5432
# Monitor the databases called "bleemeo" and "postgres".
detailed_items:
- bleemeo
- postgres

When using Docker, you may use labels to set the databases to monitor and the credentials:

Terminal window
docker run --label glouton.detailed_items="bleemeo,postgres" --label glouton.username="USERNAME" --label glouton.password="PASSWORD" [...]

Agent gathers the following metrics:

Metric Description
service_status Status of PostgreSQL
postgresql_blk_read_utilization PostgreSQL reading data file blocks utilization
postgresql_blk_read_utilization_sum Sum of PostgreSQL reading data file blocks utilization
postgresql_blk_write_utilization PostgreSQL writing data file blocks utilization
postgresql_blk_write_utilization_sum Sum of PostgreSQL writing data file blocks utilization
postgresql_blks_hit_sum Number of blocks read from PostgreSQL cache per second
postgresql_blks_read_sum Number of blocks read from disk per second
postgresql_commit_sum Number of commits per second
postgresql_rollback_sum Number of rollbacks per second
postgresql_temp_bytes_sum Temporary file write throughput in bytes per second
postgresql_temp_files_sum Number of temporary files created per second
postgresql_tup_deleted_sum Number of rows deleted per second
postgresql_tup_fetched_sum Number of rows fetched per second
postgresql_tup_inserted_sum Number of rows inserted per second
postgresql_tup_returned_sum Number of rows returned per second
postgresql_tup_updated_sum Number of rows updated per second

Except for the status metric, all metrics also exist without the _sum suffix if detailed_items is used. For instance, the metric postgresql_commit with the item mycontainer_mydb corresponds to the number of commits per second on the database mydb running in the container mycontainer.