

If you are using AWS RDS PostgreSQL, then it’s really easy to know the available disk space: just use the aws_rds_freeable_memory_average metric!

With this information, now you can assure how much memory usage you can increment for your instance.

You can combine the total memory available for your instance ( kube_pod_container_resource_limits) So, first, we need to be sure that we have enough available memory. But this is not always possible due to potential memory limitations. The solution for a low hit rate is increasing the memory usage of your instance. Let’s create an alert when the cache hit rate is lower than 80 percent.ġ00 * (rate(pg_stat_database_blks_hit) / Low latency can be a consequence of problems with cache in memory, which increments disk usage, so everything is slower.įor analyzing the cache hit rate, we’ll check the in-memory transactions ( pg_stat_database_blks_hit) and the transactions running in disk ( pg_stat_database_blks_read). Let’s create an alert to notify us when we are going to have less than 1 Gb in the next 24 hours. You may remember when we predicted the future in our getting started PromQL guide. You can use the node_filesystem_free_bytes metric from the node_exporter. It depends on how you run your PostgreSQL instance: For this, we’ll use the pg_database_size_bytes metric. We will check the database size, and the disk available.įirst, let’s figure out what is the storage usage of each of the PostgreSQL databases in our instance. Luckily, it’s also a very easy thing to monitor. This could end up in transaction issues affecting persisting data. It also can cause the Write Ahead Log (WAL) to be unable to write on disk. Running out of disk is a common problem in all databases. Time() - pg_postmaster_start_time_seconds 10 Let’s create an alert to notify if the PostgreSQL server was restarted without a known reason in the last hour ( 3600 seconds). The metric of monitoring PostgreSQL availability is pg_postmaster_start_time_seconds. Otherwise, it means that a server has been restarted for unknown reasons. Let’s create an alert that triggers if the PostgreSQL server goes down.Īlso, it’s important to assure that the minimum postmaster service uptime reflects the last known controlled server restart. The metric of monitoring PostgreSQL availability is pg_up. The exporter will monitor the connection and availability of the PostgreSQL instance. Top 10 metrics in PostgreSQL monitoring AvailabilityĬhecking that your PostgreSQL instance is up and running should be the first step in PostgreSQL monitoring.
PROMETHEUS POSTGRES EXPORTER HOW TO
In this article, you’ll learn the top 10 metrics in PostgreSQL monitoring, with alert examples, both for PostgreSQL instances in Kubernetes and AWS RDS PostgreSQL instances.Īlso, we encourage you to download our Top 10 PostgreSQL monitoring metrics cheat sheet to dig deeper on how to monitor PostgreSQL with Prometheus. It’s very popular due to its strong stability and powerful data types. PostgreSQL is an open-source relational database with a powerful community behind it. PostgreSQL monitoring with Prometheus is an easy thing to do thanks to the PostgreSQL Exporter. Security and visibility for cloud applications
