Postgresql

PostgreSQL, also known as Postgres, is a free and open-source relational database management system emphasizing extensibility and technical standards compliance. It is designed to handle a range of workloads, from single machines to data warehouses or Web services with many concurrent users.

Available solutions

Zabbix version 8.0 7.4 7.2 7.0
Download

PostgreSQL by Zabbix agent

Overview

This template is designed for the deployment of PostgreSQL monitoring by Zabbix via Zabbix agent and uses user parameters to run SQL queries with the psql command-line tool.

Requirements

Zabbix version: 8.0 and higher.

Tested versions

This template has been tested on:

  • PostgreSQL 10-18

Configuration

Zabbix should be configured according to the instructions in the Templates out of the box section.

Setup

Note:

  • The template requires pg_isready and psql utilities to be installed on the same host with Zabbix agent.
  1. Deploy Zabbix agent and create the PostgreSQL user for monitoring (<password> at your discretion) with proper access rights to your PostgreSQL instance.

For PostgreSQL version 10 and above:

CREATE USER zbx_monitor WITH PASSWORD '<PASSWORD>' INHERIT;
GRANT pg_monitor TO zbx_monitor;

For PostgreSQL version 9.6 and below:

CREATE USER zbx_monitor WITH PASSWORD '<PASSWORD>';
GRANT SELECT ON pg_stat_database TO zbx_monitor;

-- To collect WAL metrics, the user must have a `superuser` role.
ALTER USER zbx_monitor WITH SUPERUSER;
  1. Copy the postgresql/ directory to the zabbix user home directory - /var/lib/zabbix/. The postgresql/ directory contains the files with SQL queries needed to obtain metrics from PostgreSQL instance.

If the home directory of the zabbix user doesn't exist, create it first:

mkdir -m u=rwx,g=rwx,o= -p /var/lib/zabbix
chown zabbix:zabbix /var/lib/zabbix
  1. Copy the template_db_postgresql.conf file, containing user parameters, to the Zabbix agent configuration directory /etc/zabbix/zabbix_agentd.d/ and restart Zabbix agent service.

Note: the template and these files are shipped together and have to be updated together. The postgresql/ directory and template_db_postgresql.conf carry a revision number, reported by the User parameters revision item. If the deployed files are older than the template requires, the trigger User parameters are outdated is raised - copy both the directory and the configuration file of the current template version to the host and restart Zabbix agent. Newer files always work with an older template, so the agent side can be updated first.

Note: if you want to use SSL/TLS encryption to protect communications with the remote PostgreSQL instance, you can modify the connection string in user parameters. For example, to enable required encryption in transport mode without identity checks you could append ?sslmode=required to the end of the connection string for all keys that use psql:

UserParameter=pgsql.bgwriter[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5"?sslmode=required -f "/var/lib/zabbix/postgresql/pgsql.bgwriter.sql"

Consult the PostgreSQL documentation about protection modes and client connection parameters.

Also, it is assumed that you set up the PostgreSQL instance to work in the desired encryption mode. Check the PostgreSQL documentation for details.

  1. Edit the pg_hba.conf configuration file to allow connections for the user zbx_monitor. For example, you could add one of the following rows to allow local TCP connections from the same host:
# TYPE  DATABASE        USER            ADDRESS                 METHOD
  host       all        zbx_monitor     localhost               trust
  host       all        zbx_monitor     127.0.0.1/32            md5
  host       all        zbx_monitor     ::1/128                 scram-sha-256

For more information please read the PostgreSQL documentation https://www.postgresql.org/docs/current/auth-pg-hba-conf.html.

  1. Specify the host name or IP address in the {$PG.HOST} macro. Adjust the port number with {$PG.PORT} macro if needed.

  2. Set the password that you specified in step 1 in the macro {$PG.PASSWORD}.

Macros used

Name Description Default
{$PG.HOST}

Hostname or IP of PostgreSQL host.

localhost
{$PG.PORT}

PostgreSQL service port.

5432
{$PG.USER}

PostgreSQL username.

zbx_monitor
{$PG.PASSWORD}

PostgreSQL user password.

{$PG.DATABASE}

Default PostgreSQL database for the connection.

postgres
{$PG.LLD.FILTER.DBNAME}

Filter of discoverable databases.

.+
{$PG.LLD.FILTER.SCHEMA}

Filter of discoverable schemas.

.+
{$PG.LLD.FILTER.SUBSCRIPTION}

Filter of discoverable logical replication subscriptions.

.+
{$PG.LLD.FILTER.TABLESPACE}

Filter of discoverable tablespaces.

.+
{$PG.CACHE_HITRATIO.MIN.WARN}

Minimum cache hit ratio percentage for trigger expression.

90
{$PG.CHECKPOINTS_REQ.MAX.WARN}

Maximum required checkpoint occurrences for trigger expression.

5
{$PG.CONFLICTS.MAX.WARN}

Maximum number of recovery conflicts for trigger expression.

0
{$PG.CONN_TOTAL_PCT.MAX.WARN}

Maximum percentage of current connections for trigger expression.

90
{$PG.DEADLOCKS.MAX.WARN}

Maximum number of detected deadlocks for trigger expression.

0
{$PG.FROZENXID_PCT_STOP.MIN.HIGH}

Minimum frozen XID before stop percentage for trigger expression.

75
{$PG.IO.CACHE.MIN.WARN}

Minimum shared buffers hit ratio percentage for trigger expression.

90
{$PG.LOCKS.MAX.WARN}

Maximum number of locks for trigger expression.

100
{$PG.PING_TIME.MAX.WARN}

Maximum time of connection response for trigger expression.

1s
{$PG.QUERY_EXECUTION_TIME.MAX.WARN}

Execution time limit for count of slow queries.

30
{$PG.REPLICATION.SLOTS.RETAINING.MAX.HIGH}

Critical number of inactive replication slots retaining WAL for trigger expression.

2
{$PG.REPLICATION.SLOTS.RETAINING.MAX.WARN}

Maximum number of inactive replication slots retaining WAL for trigger expression.

1
{$PG.REPL_LAG.MAX.WARN}

Maximum replication lag time for trigger expression.

10m
{$PG.SLOW_QUERIES.MAX.WARN}

Slow queries count threshold for a trigger.

5
{$PG.SLRU.CACHE.MIN.HIGH}

Critical SLRU cache hit ratio percentage for trigger expression.

95
{$PG.SLRU.CACHE.MIN.WARN}

Minimum SLRU cache hit ratio percentage for trigger expression.

98
{$PG.SUBSCRIPTION.ERRORS.MAX.WARN}

Maximum number of logical replication subscription errors for trigger expression.

2
{$PG.TABLESPACE.SIZE.MAX.HIGH}

Critical tablespace size for trigger expression.

15G
{$PG.TABLESPACE.SIZE.MAX.WARN}

Maximum tablespace size for trigger expression.

5G
{$PG.WAL.BUFFERS_FULL.MAX.WARN}

Maximum number of WAL buffer exhaustions per second for trigger expression.

10

Items

Name Description Type Key and additional info
Bgwriter: Buffers allocated per second

Number of buffers allocated per second.

Dependent item pgsql.bgwriter.buffers_alloc.rate

Preprocessing

  • JSON Path: $.buffers_alloc

  • Change per second
Bgwriter: Buffers written directly by a backend per second

Number of buffers written directly by a backend per second. Available in PostgreSQL versions prior to 17.

Dependent item pgsql.bgwriter.buffers_backend.rate

Preprocessing

  • JSON Path: $.buffers_backend

    ⛔️Custom on fail: Discard value

  • Change per second
Bgwriter: Times a backend executed its own fsync per second

Number of times a backend had to execute its own fsync call per second (normally the background writer handles those even when the backend does its own write). Available in PostgreSQL versions prior to 17.

Dependent item pgsql.bgwriter.buffers_backend_fsync.rate

Preprocessing

  • JSON Path: $.buffers_backend_fsync

    ⛔️Custom on fail: Discard value

  • Change per second
Checkpoint: Buffers written during checkpoints per second

Number of buffers written during checkpoints per second.

Dependent item pgsql.bgwriter.buffers_checkpoint.rate

Preprocessing

  • JSON Path: $.buffers_checkpoint

  • Change per second
Checkpoint: Buffers written by the background writer per second

Number of buffers written by the background writer per second.

Dependent item pgsql.bgwriter.buffers_clean.rate

Preprocessing

  • JSON Path: $.buffers_clean

  • Change per second
Checkpoint: Requested per second

Number of requested checkpoints that have been performed per second.

Dependent item pgsql.bgwriter.checkpoints_req.rate

Preprocessing

  • JSON Path: $.checkpoints_req

  • Change per second
Checkpoint: Scheduled per second

Number of scheduled checkpoints that have been performed per second.

Dependent item pgsql.bgwriter.checkpoints_timed.rate

Preprocessing

  • JSON Path: $.checkpoints_timed

  • Change per second
Checkpoint: Checkpoint sync time per second

Total amount of time per second that has been spent in the portion of checkpoint processing where files are synchronized to disk.

Dependent item pgsql.bgwriter.checkpoint_sync_time.rate

Preprocessing

  • JSON Path: $.checkpoint_sync_time

  • Custom multiplier: 0.001

  • Change per second
Checkpoint: Checkpoint write time per second

Total amount of time per second that has been spent in the portion of checkpoint processing where files are written to disk.

Dependent item pgsql.bgwriter.checkpoint_write_time.rate

Preprocessing

  • JSON Path: $.checkpoint_write_time

  • Custom multiplier: 0.001

  • Change per second
Bgwriter: Number of bgwriter cleaning scan stopped per second

Number of times the background writer stopped a cleaning scan because it had written too many buffers per second.

Dependent item pgsql.bgwriter.maxwritten_clean.rate

Preprocessing

  • JSON Path: $.maxwritten_clean

  • Change per second
Get bgwriter

Collect all metrics from pg_stat_bgwriter:

https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-BGWRITER-VIEW

Zabbix agent pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]
Cache hit ratio, %

Cache hit ratio.

Zabbix agent pgsql.cache.hit["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]
Config hash

PostgreSQL configuration hash.

Zabbix agent pgsql.config.hash["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]

Preprocessing

  • Discard unchanged with heartbeat: 1h

Connections sum: Active

Total number of connections executing a query.

Dependent item pgsql.connections.sum.active

Preprocessing

  • JSON Path: $.active

Connections sum: Idle

Total number of connections waiting for a new client command.

Dependent item pgsql.connections.sum.idle

Preprocessing

  • JSON Path: $.idle

Connections sum: Idle in transaction

Total number of connections in a transaction state but not executing a query.

Dependent item pgsql.connections.sum.idle_in_transaction

Preprocessing

  • JSON Path: $.idle_in_transaction

Connections sum: Prepared

Total number of prepared transactions:

https://www.postgresql.org/docs/current/sql-prepare-transaction.html

Dependent item pgsql.connections.sum.prepared

Preprocessing

  • JSON Path: $.prepared

Connections sum: Total

Total number of connections.

Dependent item pgsql.connections.sum.total

Preprocessing

  • JSON Path: $.total

Connections sum: Total, %

Total number of connections, in percentage.

Dependent item pgsql.connections.sum.total_pct

Preprocessing

  • JSON Path: $.total_pct

Connections sum: Waiting

Total number of waiting connections:

https://www.postgresql.org/docs/current/monitoring-stats.html#WAIT-EVENT-TABLE

Dependent item pgsql.connections.sum.waiting

Preprocessing

  • JSON Path: $.waiting

Get connections sum

Collect all metrics from pg_stat_activity:

https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-ACTIVITY-VIEW

Zabbix agent pgsql.connections.sum["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]
Get dbstat

Collect all metrics from pg_stat_database per database:

https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-DATABASE-VIEW

Zabbix agent pgsql.dbstat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]
Get locks

Collect all metrics from pg_locks per database:

https://www.postgresql.org/docs/current/explicit-locking.html#LOCKING-TABLES

Zabbix agent pgsql.locks["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]
Ping time

Used to get the SELECT 1 query execution time.

Zabbix agent pgsql.ping.time["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]

Preprocessing

  • Regular expression: Time:\s+(\d+\.\d+)\s+ms \1

  • Custom multiplier: 0.001

Ping

Used to test a connection to see if it is alive. It is set to 0 if the instance doesn't accept the connections.

Zabbix agent pgsql.ping["{$PG.HOST}","{$PG.PORT}"]

Preprocessing

  • JavaScript: return value.search(/accepting connections/)>0 ? 1 : 0

  • Discard unchanged with heartbeat: 1h

Get queries

Collect all metrics by query execution time.

Zabbix agent pgsql.queries["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}","{$PG.QUERY_EXECUTION_TIME.MAX.WARN}"]
Get relation sizes

Collects the on-disk size of the tables, their indexes and TOAST data, summed per schema of the "{$PG.DATABASE}" database.

Reads the size metadata of every relation, therefore it is polled less frequently than the other metrics.

Zabbix agent pgsql.relation.size["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]
Replication: Standby count

Number of standby servers.

Zabbix agent pgsql.replication.count["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]
Replication: Lag in seconds

Replication lag with master, in seconds.

Zabbix agent pgsql.replication.lag.sec["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]
Replication: Recovery role

Replication role: 1 — recovery is still in progress (standby mode), 0 — master mode.

Zabbix agent pgsql.replication.recovery_role["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]
Replication: Status

Replication status: 0 — streaming is down, 1 — streaming is up, 2 — master mode.

Zabbix agent pgsql.replication.status["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]
Get subscription stats

Collects the error counters of the logical replication subscriptions from pg_stat_subscription_stats:

https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-SUBSCRIPTION-STATS

Zabbix agent pgsql.subscription.stats["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]
Get tablespace sizes

Collects the size, location and owner of every tablespace of the instance.

Scans the tablespace directories, therefore it is polled less frequently than the other metrics.

Zabbix agent pgsql.tablespace.size["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]
Transactions: Max active transaction time

Current max active transaction time.

Dependent item pgsql.transactions.active

Preprocessing

  • JSON Path: $.active

Transactions: Max idle transaction time

Current max idle transaction time.

Dependent item pgsql.transactions.idle

Preprocessing

  • JSON Path: $.idle

Transactions: Max prepared transaction time

Current max prepared transaction time.

Dependent item pgsql.transactions.prepared

Preprocessing

  • JSON Path: $.prepared

Transactions: Max waiting transaction time

Current max waiting transaction time.

Dependent item pgsql.transactions.waiting

Preprocessing

  • JSON Path: $.waiting

Get transactions

Collect metrics by transaction execution time.

Zabbix agent pgsql.transactions["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]
Uptime

Time since the server started.

Zabbix agent pgsql.uptime["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]
User parameters revision

Revision of the user parameter files deployed on the host with Zabbix agent.

Reported by the pgsql.userparam.revision user parameter; 0 means the deployed files are older than the revision mechanism itself.

Zabbix agent pgsql.userparam.revision

Preprocessing

  • Check for not supported value: any error

    ⛔️Custom on fail: Set value to: 0

  • Discard unchanged with heartbeat: 1d

Version

PostgreSQL version.

Zabbix agent pgsql.version["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]

Preprocessing

  • Discard unchanged with heartbeat: 1d

Version (numeric)

The PostgreSQL version as an integer, the same way server_version_num reports it - 18.4 becomes 180004.

Dependent item pgsql.version.num

Preprocessing

  • JavaScript: The text is too long. Please see the template.

  • Discard unchanged with heartbeat: 1d

Version validator

Converts the PostgreSQL version into low-level discovery data: one entry with a {#BELOW_V<major>} macro per release that introduced monitored metrics.

Discovery rules filter on those macros, which is how version-specific metrics are created only where PostgreSQL provides them.

Dependent item pgsql.version.validator

Preprocessing

  • JavaScript: The text is too long. Please see the template.

WAL: Segments count

Number of WAL segments.

Dependent item pgsql.wal.count

Preprocessing

  • JSON Path: $.count

Get WAL

Collect write-ahead log (WAL) metrics.

Zabbix agent pgsql.wal.stat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]
WAL: Bytes written

WAL write, in bytes.

Dependent item pgsql.wal.write

Preprocessing

  • JSON Path: $.write

  • Change per second

Triggers

Name Description Expression Severity Dependencies and additional info
PostgreSQL: Required checkpoints occur too frequently

Checkpoints are points in the sequence of transactions at which it is guaranteed that the heap and index data files have been updated with all information written before that checkpoint. At checkpoint time, all dirty data pages are flushed to disk and a special checkpoint record is written to the log file.
https://www.postgresql.org/docs/current/wal-configuration.html

last(/PostgreSQL by Zabbix agent/pgsql.bgwriter.checkpoints_req.rate) > {$PG.CHECKPOINTS_REQ.MAX.WARN} Average
PostgreSQL: Failed to get items

Zabbix has not received any data for items for the last 30 minutes.

nodata(/PostgreSQL by Zabbix agent/pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"],30m) = 1 Warning Depends on:
  • PostgreSQL: Service is down
PostgreSQL: Cache hit ratio too low

Cache hit ratio is lower than {$PG.CACHE_HITRATIO.MIN.WARN} for 5m.

max(/PostgreSQL by Zabbix agent/pgsql.cache.hit["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"],5m) < {$PG.CACHE_HITRATIO.MIN.WARN} Warning
PostgreSQL: Configuration has changed

PostgreSQL configuration has changed.

last(/PostgreSQL by Zabbix agent/pgsql.config.hash["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"],#1)<>last(/PostgreSQL by Zabbix agent/pgsql.config.hash["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"],#2) and length(last(/PostgreSQL by Zabbix agent/pgsql.config.hash["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]))>0 Info
PostgreSQL: Total number of connections is too high

Total number of current connections exceeds the limit of {$PG.CONN_TOTAL_PCT.MAX.WARN}% out of the maximum number of concurrent connections to the database server (the "max_connections" setting).

min(/PostgreSQL by Zabbix agent/pgsql.connections.sum.total_pct,5m) > {$PG.CONN_TOTAL_PCT.MAX.WARN} Average
PostgreSQL: Response too long

Response is taking too long (over {$PG.PING_TIME.MAX.WARN} for 5m).

min(/PostgreSQL by Zabbix agent/pgsql.ping.time["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"],5m) > {$PG.PING_TIME.MAX.WARN} Average Depends on:
  • PostgreSQL: Service is down
PostgreSQL: Service is down

Last test of a connection was unsuccessful.

last(/PostgreSQL by Zabbix agent/pgsql.ping["{$PG.HOST}","{$PG.PORT}"]) = 0 High
PostgreSQL: Streaming lag with master is too high

Replication lag with master is higher than {$PG.REPL_LAG.MAX.WARN} for 5m.

min(/PostgreSQL by Zabbix agent/pgsql.replication.lag.sec["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"],5m) > {$PG.REPL_LAG.MAX.WARN} Average
PostgreSQL: Replication is down

Replication is enabled and data streaming was down for 5m.

max(/PostgreSQL by Zabbix agent/pgsql.replication.status["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"],5m)=0 Average
PostgreSQL: Service has been restarted

PostgreSQL uptime is less than 10 minutes.

last(/PostgreSQL by Zabbix agent/pgsql.uptime["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]) < 10m Average
PostgreSQL: User parameters are outdated

The user parameter files deployed on the host with Zabbix agent are older than this template version, so some items cannot collect data.
Copy the postgresql/ directory and the template_db_postgresql.conf file of this template version to the host with Zabbix agent and restart the agent.

last(/PostgreSQL by Zabbix agent/pgsql.userparam.revision) < 2 Warning
PostgreSQL: Version has changed

The PostgreSQL version has changed. Check whether the update was planned, since a major version change can affect the availability of the collected metrics.

last(/PostgreSQL by Zabbix agent/pgsql.version["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"],#1)<>last(/PostgreSQL by Zabbix agent/pgsql.version["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"],#2) and length(last(/PostgreSQL by Zabbix agent/pgsql.version["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]))>0 Info

LLD rule Database discovery

Name Description Type Key and additional info
Database discovery

Discovers databases (DB) in the database management system (DBMS), except:

- templates;

- default "postgres" DB;

- DBs that do not allow connections.

Zabbix agent pgsql.discovery.db["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}"]

Item prototypes for Database discovery

Name Description Type Key and additional info
DB [{#DBNAME}]: Get dbstat

Get dbstat metrics for database "{#DBNAME}".

Dependent item pgsql.dbstat.get_metrics["{#DBNAME}"]

Preprocessing

  • JSON Path: $['{#DBNAME}']

    ⛔️Custom on fail: Discard value

DB [{#DBNAME}]: Get queries

Get queries metrics for database "{#DBNAME}".

Dependent item pgsql.queries.get_metrics["{#DBNAME}"]

Preprocessing

  • JSON Path: $['{#DBNAME}']

    ⛔️Custom on fail: Discard value

DB [{#DBNAME}]: Database size

Database size.

Zabbix agent pgsql.db.size["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}","{#DBNAME}"]
DB [{#DBNAME}]: Blocks hit per second

Total number of times per second disk blocks were found already in the buffer cache, so that a read was not necessary.

Dependent item pgsql.dbstat.blks_hit.rate["{#DBNAME}"]

Preprocessing

  • JSON Path: $.blks_hit

  • Change per second
DB [{#DBNAME}]: Disk blocks read per second

Total number of disk blocks read per second in this database.

Dependent item pgsql.dbstat.blks_read.rate["{#DBNAME}"]

Preprocessing

  • JSON Path: $.blks_read

  • Change per second
DB [{#DBNAME}]: Detected conflicts per second

Total number of queries canceled due to conflicts with recovery in this database per second.

Dependent item pgsql.dbstat.conflicts.rate["{#DBNAME}"]

Preprocessing

  • JSON Path: $.conflicts

  • Change per second
DB [{#DBNAME}]: Detected deadlocks per second

Total number of detected deadlocks in this database per second.

Dependent item pgsql.dbstat.deadlocks.rate["{#DBNAME}"]

Preprocessing

  • JSON Path: $.deadlocks

  • Change per second
DB [{#DBNAME}]: Temp_bytes written per second

Total amount of data written to temporary files by queries in this database.

Dependent item pgsql.dbstat.temp_bytes.rate["{#DBNAME}"]

Preprocessing

  • JSON Path: $.temp_bytes

  • Change per second
DB [{#DBNAME}]: Temp_files created per second

Total number of temporary files created by queries in this database.

Dependent item pgsql.dbstat.temp_files.rate["{#DBNAME}"]

Preprocessing

  • JSON Path: $.temp_files

  • Change per second
DB [{#DBNAME}]: Tuples deleted per second

Total number of rows deleted by queries in this database per second.

Dependent item pgsql.dbstat.tup_deleted.rate["{#DBNAME}"]

Preprocessing

  • JSON Path: $.tup_deleted

  • Change per second
DB [{#DBNAME}]: Tuples fetched per second

Total number of rows fetched by queries in this database per second.

Dependent item pgsql.dbstat.tup_fetched.rate["{#DBNAME}"]

Preprocessing

  • JSON Path: $.tup_fetched

  • Change per second
DB [{#DBNAME}]: Tuples inserted per second

Total number of rows inserted by queries in this database per second.

Dependent item pgsql.dbstat.tup_inserted.rate["{#DBNAME}"]

Preprocessing

  • JSON Path: $.tup_inserted

  • Change per second
DB [{#DBNAME}]: Tuples returned per second

Number of rows returned by queries in this database per second.

Dependent item pgsql.dbstat.tup_returned.rate["{#DBNAME}"]

Preprocessing

  • JSON Path: $.tup_returned

  • Change per second
DB [{#DBNAME}]: Tuples updated per second

Total number of rows updated by queries in this database per second.

Dependent item pgsql.dbstat.tup_updated.rate["{#DBNAME}"]

Preprocessing

  • JSON Path: $.tup_updated

  • Change per second
DB [{#DBNAME}]: Commits per second

Number of transactions in this database that have been committed per second.

Dependent item pgsql.dbstat.xact_commit.rate["{#DBNAME}"]

Preprocessing

  • JSON Path: $.xact_commit

  • Change per second
DB [{#DBNAME}]: Rollbacks per second

Total number of transactions in this database that have been rolled back.

Dependent item pgsql.dbstat.xact_rollback.rate["{#DBNAME}"]

Preprocessing

  • JSON Path: $.xact_rollback

  • Change per second
DB [{#DBNAME}]: Frozen XID before autovacuum, %

Preventing Transaction ID Wraparound Failures:

https://www.postgresql.org/docs/current/routine-vacuuming.html#VACUUM-FOR-WRAPAROUND

Dependent item pgsql.frozenxid.prc_before_av["{#DBNAME}"]

Preprocessing

  • JSON Path: $.prc_before_av

DB [{#DBNAME}]: Frozen XID before stop, %

Preventing Transaction ID Wraparound Failures:

https://www.postgresql.org/docs/current/routine-vacuuming.html#VACUUM-FOR-WRAPAROUND

Dependent item pgsql.frozenxid.prc_before_stop["{#DBNAME}"]

Preprocessing

  • JSON Path: $.prc_before_stop

DB [{#DBNAME}]: Get frozen XID Zabbix agent pgsql.frozenxid["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]
DB [{#DBNAME}]: Num of locks total

Total number of locks in this database.

Dependent item pgsql.locks.total["{#DBNAME}"]

Preprocessing

  • JSON Path: $['{#DBNAME}'].total

DB [{#DBNAME}]: Queries slow maintenance count

Slow maintenance query count for this database.

Dependent item pgsql.queries.mro.slow_count["{#DBNAME}"]

Preprocessing

  • JSON Path: $.mro_slow_count

DB [{#DBNAME}]: Queries max maintenance time

Max maintenance query time for this database.

Dependent item pgsql.queries.mro.time_max["{#DBNAME}"]

Preprocessing

  • JSON Path: $.mro_time_max

DB [{#DBNAME}]: Queries sum maintenance time

Sum maintenance query time for this database.

Dependent item pgsql.queries.mro.time_sum["{#DBNAME}"]

Preprocessing

  • JSON Path: $.mro_time_sum

DB [{#DBNAME}]: Queries slow query count

Slow query count for this database.

Dependent item pgsql.queries.query.slow_count["{#DBNAME}"]

Preprocessing

  • JSON Path: $.query_slow_count

DB [{#DBNAME}]: Queries max query time

Max query time for this database.

Dependent item pgsql.queries.query.time_max["{#DBNAME}"]

Preprocessing

  • JSON Path: $.query_time_max

DB [{#DBNAME}]: Queries sum query time

Sum query time for this database.

Dependent item pgsql.queries.query.time_sum["{#DBNAME}"]

Preprocessing

  • JSON Path: $.query_time_sum

DB [{#DBNAME}]: Queries slow transaction count

Slow transaction query count for this database.

Dependent item pgsql.queries.tx.slow_count["{#DBNAME}"]

Preprocessing

  • JSON Path: $.tx_slow_count

DB [{#DBNAME}]: Queries max transaction time

Max transaction query time for this database.

Dependent item pgsql.queries.tx.time_max["{#DBNAME}"]

Preprocessing

  • JSON Path: $.tx_time_max

DB [{#DBNAME}]: Queries sum transaction time

Sum transaction query time for this database.

Dependent item pgsql.queries.tx.time_sum["{#DBNAME}"]

Preprocessing

  • JSON Path: $.tx_time_sum

DB [{#DBNAME}]: Index scans per second

Number of index scans in the database per second.

Dependent item pgsql.scans.idx.rate["{#DBNAME}"]

Preprocessing

  • JSON Path: $.idx

  • Change per second
DB [{#DBNAME}]: Sequential scans per second

Number of sequential scans in this database per second.

Dependent item pgsql.scans.seq.rate["{#DBNAME}"]

Preprocessing

  • JSON Path: $.seq

  • Change per second
DB [{#DBNAME}]: Get scans

Number of scans done for table/index in this database.

Zabbix agent pgsql.scans["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]

Trigger prototypes for Database discovery

Name Description Expression Severity Dependencies and additional info
PostgreSQL: DB [{#DBNAME}]: Too many recovery conflicts

The primary and standby servers are in many ways loosely connected. Actions on the primary will have an effect on the standby. As a result, there is potential for negative interactions or conflicts between them.
https://www.postgresql.org/docs/current/hot-standby.html#HOT-STANDBY-CONFLICT

min(/PostgreSQL by Zabbix agent/pgsql.dbstat.conflicts.rate["{#DBNAME}"],5m) > {$PG.CONFLICTS.MAX.WARN:"{#DBNAME}"} Average
PostgreSQL: DB [{#DBNAME}]: Deadlock occurred

Number of deadlocks detected per second exceeds {$PG.DEADLOCKS.MAX.WARN:"{#DBNAME}"} for 5m.

min(/PostgreSQL by Zabbix agent/pgsql.dbstat.deadlocks.rate["{#DBNAME}"],5m) > {$PG.DEADLOCKS.MAX.WARN:"{#DBNAME}"} High
PostgreSQL: DB [{#DBNAME}]: VACUUM FREEZE is required to prevent wraparound

Preventing Transaction ID Wraparound Failures:
https://www.postgresql.org/docs/current/routine-vacuuming.html#VACUUM-FOR-WRAPAROUND

last(/PostgreSQL by Zabbix agent/pgsql.frozenxid.prc_before_stop["{#DBNAME}"])<{$PG.FROZENXID_PCT_STOP.MIN.HIGH:"{#DBNAME}"} Average
PostgreSQL: DB [{#DBNAME}]: Number of locks is too high

The number of locks in the database "{#DBNAME}" has exceeded {$PG.LOCKS.MAX.WARN:"{#DBNAME}"} for 5m. A growing number of locks indicates contention between transactions and can lead to queries waiting instead of being executed.

min(/PostgreSQL by Zabbix agent/pgsql.locks.total["{#DBNAME}"],5m)>{$PG.LOCKS.MAX.WARN:"{#DBNAME}"} Warning
PostgreSQL: DB [{#DBNAME}]: Too many slow queries

The number of detected slow queries exceeds the limit of {$PG.SLOW_QUERIES.MAX.WARN:"{#DBNAME}"}.

min(/PostgreSQL by Zabbix agent/pgsql.queries.query.slow_count["{#DBNAME}"],5m)>{$PG.SLOW_QUERIES.MAX.WARN:"{#DBNAME}"} Warning

LLD rule WAL statistics metrics discovery

Name Description Type Key and additional info
WAL statistics metrics discovery

Discovers the pg_stat_wal metrics available in PostgreSQL 14 and newer.

Dependent item pgsql.stat.wal.discovery

Preprocessing

  • Discard unchanged with heartbeat: 1h

Item prototypes for WAL statistics metrics discovery

Name Description Type Key and additional info
WAL statistics: Get data

Collects write-ahead log activity from pg_stat_wal:

https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-WAL-VIEW

Zabbix agent pgsql.stat.wal["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}","{#SINGLETON}"]
WAL statistics: Bytes generated total

Total amount of WAL generated since the last statistics reset.

Dependent item pgsql.stat.wal.bytes[{#SINGLETON}]

Preprocessing

  • JSON Path: $.wal_bytes

WAL statistics: Records total

Total number of WAL records generated since the last statistics reset.

Dependent item pgsql.stat.wal.records[{#SINGLETON}]

Preprocessing

  • JSON Path: $.wal_records

WAL statistics: Full page images total

Total number of full page images written to WAL since the last statistics reset.

Full page images increase the WAL volume and are usually caused by frequent checkpoints.

Dependent item pgsql.stat.wal.fpi[{#SINGLETON}]

Preprocessing

  • JSON Path: $.wal_fpi

WAL statistics: Buffers full total

Total number of times the WAL buffers were full and WAL had to be written out before the transaction could continue, since the last statistics reset.

A growing value indicates WAL buffer pressure - consider increasing wal_buffers.

Dependent item pgsql.stat.wal.buffers_full[{#SINGLETON}]

Preprocessing

  • JSON Path: $.wal_buffers_full

WAL statistics: Buffers full per second

Number of times per second the WAL buffers were full and had to be written out.

Dependent item pgsql.stat.wal.buffers_full.rate[{#SINGLETON}]

Preprocessing

  • JSON Path: $.wal_buffers_full

  • Change per second
WAL statistics: Statistics reset time

Time of the last reset of the WAL statistics. The totals above are counted from this moment.

Dependent item pgsql.stat.wal.reset_time[{#SINGLETON}]

Preprocessing

  • JSON Path: $.stats_reset

  • Discard unchanged with heartbeat: 7d

Trigger prototypes for WAL statistics metrics discovery

Name Description Expression Severity Dependencies and additional info
PostgreSQL: WAL statistics: WAL buffers are full too often

The WAL buffers are exhausted more than {$PG.WAL.BUFFERS_FULL.MAX.WARN} times per second, so backends have to flush WAL themselves instead of doing useful work.
Increasing wal_buffers usually removes the bottleneck.

min(/PostgreSQL by Zabbix agent/pgsql.stat.wal.buffers_full.rate[{#SINGLETON}],15m) > {$PG.WAL.BUFFERS_FULL.MAX.WARN} Warning

LLD rule SLRU metrics discovery

Name Description Type Key and additional info
SLRU metrics discovery

Discovers the pg_stat_slru metrics available in PostgreSQL 13 and newer.

Dependent item pgsql.stat.slru.discovery

Preprocessing

  • Discard unchanged with heartbeat: 1h

Item prototypes for SLRU metrics discovery

Name Description Type Key and additional info
SLRU: Get data

Collects the SLRU cache statistics from pg_stat_slru:

https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-SLRU-VIEW

Zabbix agent pgsql.stat.slru["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}","{#SINGLETON}"]
SLRU: Blocks read total

Total number of blocks read from disk into the SLRU caches since the last statistics reset.

Dependent item pgsql.stat.slru.blks_read[{#SINGLETON}]

Preprocessing

  • JSON Path: $[*].blks_read

  • JavaScript: The text is too long. Please see the template.

SLRU: Blocks read per second

Number of blocks per second read from disk into the SLRU caches.

Dependent item pgsql.stat.slru.blks_read.rate[{#SINGLETON}]

Preprocessing

  • JSON Path: $[*].blks_read

  • JavaScript: The text is too long. Please see the template.

  • Change per second
SLRU: Blocks hit total

Total number of blocks found in the SLRU caches since the last statistics reset.

Dependent item pgsql.stat.slru.blks_hit[{#SINGLETON}]

Preprocessing

  • JSON Path: $[*].blks_hit

  • JavaScript: The text is too long. Please see the template.

SLRU: Blocks written total

Total number of dirty SLRU blocks written to disk since the last statistics reset.

Dependent item pgsql.stat.slru.blks_written[{#SINGLETON}]

Preprocessing

  • JSON Path: $[*].blks_written

  • JavaScript: The text is too long. Please see the template.

SLRU: Cache hit ratio

Percentage of the SLRU cache lookups served from memory, over all caches.

A dropping ratio means the transaction status and multixact caches no longer fit, which shows up as extra disk reads under high concurrency.

Dependent item pgsql.stat.slru.hit_ratio[{#SINGLETON}]

Preprocessing

  • JavaScript: The text is too long. Please see the template.

Trigger prototypes for SLRU metrics discovery

Name Description Expression Severity Dependencies and additional info
PostgreSQL: SLRU: Cache hit ratio too low

The SLRU caches serve less than {$PG.SLRU.CACHE.MIN.WARN}% of their lookups from memory. Check the disk load and the concurrency of transactions using multixacts (SELECT ... FOR SHARE, subtransactions).

max(/PostgreSQL by Zabbix agent/pgsql.stat.slru.hit_ratio[{#SINGLETON}],5m) < {$PG.SLRU.CACHE.MIN.WARN} Warning Depends on:
  • PostgreSQL: SLRU: Cache hit ratio is critically low
PostgreSQL: SLRU: Cache hit ratio is critically low

The SLRU caches serve less than {$PG.SLRU.CACHE.MIN.HIGH}% of their lookups from memory, so the instance is doing significant extra I/O for transaction status lookups.

max(/PostgreSQL by Zabbix agent/pgsql.stat.slru.hit_ratio[{#SINGLETON}],5m) < {$PG.SLRU.CACHE.MIN.HIGH} High

LLD rule Replication slots metrics discovery

Name Description Type Key and additional info
Replication slots metrics discovery

Discovers the pg_replication_slots metrics available in PostgreSQL 14 and newer.

Dependent item pgsql.replication.slots.discovery

Preprocessing

  • Discard unchanged with heartbeat: 1h

Item prototypes for Replication slots metrics discovery

Name Description Type Key and additional info
Replication slots: Get data

Collects the state of the replication slots from pg_replication_slots:

https://www.postgresql.org/docs/current/view-pg-replication-slots.html

Zabbix agent pgsql.replication.slots["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}","{#SINGLETON}"]
Replication slots: Total

Total number of replication slots.

Dependent item pgsql.replication.slots.total[{#SINGLETON}]

Preprocessing

  • JSON Path: $.slots_total

Replication slots: Active

Number of replication slots currently in use by a connected consumer.

Dependent item pgsql.replication.slots.active[{#SINGLETON}]

Preprocessing

  • JSON Path: $.slots_active

Replication slots: Inactive

Number of replication slots without a connected consumer.

Dependent item pgsql.replication.slots.inactive[{#SINGLETON}]

Preprocessing

  • JSON Path: $.slots_inactive

Replication slots: Worst slot lag

Amount of WAL the most lagging slot has not confirmed yet. Reported as 0 on a standby, where the current WAL position is not defined.

Dependent item pgsql.replication.slots.worst_lag[{#SINGLETON}]

Preprocessing

  • JSON Path: $.worst_slot_lag_bytes

Replication slots: Min safe WAL size

Amount of WAL that can still be written before the slot closest to the limit starts losing the data it needs.

Turns negative once that slot is past its safety margin: the WAL it needs is only kept until the next checkpoint.

Always 0 when max_slot_wal_keep_size is not limited.

Dependent item pgsql.replication.slots.min_safe_wal_size[{#SINGLETON}]

Preprocessing

  • JSON Path: $.min_safe_wal_size

Replication slots: Inactive retaining WAL

Number of inactive replication slots that still hold WAL segments.

Such slots prevent WAL cleanup and are the usual cause of a slowly filling disk on the primary.

Dependent item pgsql.replication.slots.inactive_retaining[{#SINGLETON}]

Preprocessing

  • JSON Path: $.inactive_retaining_slots

Trigger prototypes for Replication slots metrics discovery

Name Description Expression Severity Dependencies and additional info
PostgreSQL: Replication slots: Inactive slots are retaining WAL

Inactive replication slots are holding WAL segments. Check whether the consumers are gone for good and drop the slots that are no longer needed.

min(/PostgreSQL by Zabbix agent/pgsql.replication.slots.inactive_retaining[{#SINGLETON}],5m) > {$PG.REPLICATION.SLOTS.RETAINING.MAX.WARN} Warning Depends on:
  • PostgreSQL: Replication slots: Too many inactive slots are retaining WAL
PostgreSQL: Replication slots: Too many inactive slots are retaining WAL

Several inactive replication slots are holding WAL segments, which can fill the disk and stop the instance from accepting writes. Drop the slots that are no longer needed.

min(/PostgreSQL by Zabbix agent/pgsql.replication.slots.inactive_retaining[{#SINGLETON}],5m) > {$PG.REPLICATION.SLOTS.RETAINING.MAX.HIGH} High

LLD rule Subscription discovery

Name Description Type Key and additional info
Subscription discovery

Discovers the logical replication subscriptions of the instance.

Dependent item pgsql.subscription.discovery

Preprocessing

  • Discard unchanged with heartbeat: 1h

Item prototypes for Subscription discovery

Name Description Type Key and additional info
Subscription [{#SUBNAME}]: Get subscription stats

Subscription stats of the "{#SUBNAME}" subscription.

Dependent item pgsql.subscription.get_metrics["{#SUBNAME}"]

Preprocessing

  • JSON Path: $[?(@.subname=="{#SUBNAME}")].first()

    ⛔️Custom on fail: Discard value

Subscription [{#SUBNAME}]: Apply errors

Number of errors that occurred while applying the changes received from the publisher, since the last statistics reset.

Dependent item pgsql.subscription.apply_errors["{#SUBNAME}"]

Preprocessing

  • JSON Path: $.apply_error_count

Subscription [{#SUBNAME}]: Sync errors

Number of errors that occurred during the initial data copy of the subscribed tables, since the last statistics reset.

Dependent item pgsql.subscription.sync_errors["{#SUBNAME}"]

Preprocessing

  • JSON Path: $.sync_error_count

Subscription [{#SUBNAME}]: Statistics reset time

Time of the last reset of the subscription statistics. The error counters above are counted from this moment.

Dependent item pgsql.subscription.reset_time["{#SUBNAME}"]

Preprocessing

  • JSON Path: $.stats_reset

  • Discard unchanged with heartbeat: 7d

Trigger prototypes for Subscription discovery

Name Description Expression Severity Dependencies and additional info
PostgreSQL: Subscription [{#SUBNAME}]: Errors while applying changes

The subscription "{#SUBNAME}" fails to apply the changes it receives, so the subscriber data is drifting away from the publisher. Check the subscription worker errors in the PostgreSQL log.

min(/PostgreSQL by Zabbix agent/pgsql.subscription.apply_errors["{#SUBNAME}"],5m) > {$PG.SUBSCRIPTION.ERRORS.MAX.WARN:"{#SUBNAME}"} Warning
PostgreSQL: Subscription [{#SUBNAME}]: Errors while synchronizing tables

The initial table synchronization of the subscription "{#SUBNAME}" keeps failing, so the subscribed tables never reach a consistent state. Check the table sync worker errors in the PostgreSQL log.

min(/PostgreSQL by Zabbix agent/pgsql.subscription.sync_errors["{#SUBNAME}"],5m) > {$PG.SUBSCRIPTION.ERRORS.MAX.WARN:"{#SUBNAME}"} Warning

LLD rule I/O metrics discovery

Name Description Type Key and additional info
I/O metrics discovery

Discovers the pg_stat_io metrics available in PostgreSQL 16 and newer.

Dependent item pgsql.stat.io.discovery

Preprocessing

  • Discard unchanged with heartbeat: 1h

Item prototypes for I/O metrics discovery

Name Description Type Key and additional info
I/O: Get data

Collects the I/O activity of the instance from pg_stat_io:

https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-IO-VIEW

Zabbix agent pgsql.stat.io["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DATABASE}","{#SINGLETON}"]
I/O: Reads per second

Number of read operations per second the instance issues to the storage. Reads mean the data was not found in the shared buffers.

Dependent item pgsql.stat.io.reads.rate[{#SINGLETON}]

Preprocessing

  • JSON Path: $.reads

  • Change per second
I/O: Writes per second

Number of write operations per second the instance issues to the storage.

Dependent item pgsql.stat.io.writes.rate[{#SINGLETON}]

Preprocessing

  • JSON Path: $.writes

  • Change per second
I/O: Read per second

Amount of data per second the instance reads from the storage.

Dependent item pgsql.stat.io.read_bytes.rate[{#SINGLETON}]

Preprocessing

  • JSON Path: $.read_bytes

  • Change per second
I/O: Written per second

Amount of data per second the instance writes to the storage.

Dependent item pgsql.stat.io.write_bytes.rate[{#SINGLETON}]

Preprocessing

  • JSON Path: $.write_bytes

  • Change per second
I/O: Fsyncs per second

Number of fsync calls per second issued by the instance.

Most of them are normally done by the checkpointer, so a high rate from other backends points at a checkpoint or WAL configuration problem.

Dependent item pgsql.stat.io.fsyncs.rate[{#SINGLETON}]

Preprocessing

  • JSON Path: $.fsyncs

  • Change per second
I/O: Time spent per second

Time per second the instance spends waiting for reads and writes to complete.

Requires track_io_timing to be enabled, otherwise it stays at zero.

Dependent item pgsql.stat.io.time.rate[{#SINGLETON}]

Preprocessing

  • JSON Path: $.io_time_ms

  • Change per second
  • Custom multiplier: 0.001

I/O: Buffer hit ratio

Percentage of the block requests served from the shared buffers instead of the storage, since the last statistics reset.

A low value means the working set does not fit into shared_buffers.

Dependent item pgsql.stat.io.hit_ratio[{#SINGLETON}]

Preprocessing

  • JavaScript: The text is too long. Please see the template.

Trigger prototypes for I/O metrics discovery

Name Description Expression Severity Dependencies and additional info
PostgreSQL: I/O: Buffer hit ratio too low

Less than {$PG.IO.CACHE.MIN.WARN}% of the block requests are served from the shared buffers, so the instance keeps going to the storage for data. Consider increasing shared_buffers or reviewing the queries that read the most data.

max(/PostgreSQL by Zabbix agent/pgsql.stat.io.hit_ratio[{#SINGLETON}],15m) < {$PG.IO.CACHE.MIN.WARN} Warning

LLD rule Schema discovery

Name Description Type Key and additional info
Schema discovery

Discovers the schemas of the "{$PG.DATABASE}" database, except the system ones.

Dependent item pgsql.relation.discovery

Preprocessing

  • Discard unchanged with heartbeat: 1h

Item prototypes for Schema discovery

Name Description Type Key and additional info
Schema [{#SCHEMA.NAME}]: Size

Total on-disk size of the tables of the schema "{#SCHEMA.NAME}", including their indexes and TOAST data.

Dependent item pgsql.relation.size["{#SCHEMA.NAME}"]

Preprocessing

  • JSON Path: $[?(@.name=="{#SCHEMA.NAME}")].total_bytes.first()

    ⛔️Custom on fail: Discard value

Schema [{#SCHEMA.NAME}]: Number of tables

Number of tables in the schema "{#SCHEMA.NAME}", partitioned tables included.

Dependent item pgsql.relation.tables["{#SCHEMA.NAME}"]

Preprocessing

  • JSON Path: $[?(@.name=="{#SCHEMA.NAME}")].table_count.first()

    ⛔️Custom on fail: Discard value

  • Discard unchanged with heartbeat: 1d

LLD rule Tablespace discovery

Name Description Type Key and additional info
Tablespace discovery

Discovers the tablespaces of the instance, including the built-in pg_default and pg_global.

Dependent item pgsql.tablespace.discovery

Preprocessing

  • Discard unchanged with heartbeat: 1h

Item prototypes for Tablespace discovery

Name Description Type Key and additional info
Tablespace [{#TABLESPACE.NAME}]: Get tablespace data

Data of the tablespace "{#TABLESPACE.NAME}".

Dependent item pgsql.tablespace.get_metrics["{#TABLESPACE.NAME}"]

Preprocessing

  • JSON Path: $[?(@.name=="{#TABLESPACE.NAME}")].first()

    ⛔️Custom on fail: Discard value

Tablespace [{#TABLESPACE.NAME}]: Size

Total size of the files stored in the tablespace "{#TABLESPACE.NAME}".

Dependent item pgsql.tablespace.size["{#TABLESPACE.NAME}"]

Preprocessing

  • JSON Path: $.size_bytes

Tablespace [{#TABLESPACE.NAME}]: Location

Directory the tablespace "{#TABLESPACE.NAME}" is stored in. Empty for the built-in pg_default and pg_global tablespaces, which live in the data directory.

Dependent item pgsql.tablespace.location["{#TABLESPACE.NAME}"]

Preprocessing

  • JSON Path: $.location

  • Discard unchanged with heartbeat: 1d

Tablespace [{#TABLESPACE.NAME}]: Owner

Owner of the tablespace "{#TABLESPACE.NAME}".

Dependent item pgsql.tablespace.owner["{#TABLESPACE.NAME}"]

Preprocessing

  • JSON Path: $.owner

  • Discard unchanged with heartbeat: 1d

Trigger prototypes for Tablespace discovery

Name Description Expression Severity Dependencies and additional info
PostgreSQL: Tablespace [{#TABLESPACE.NAME}]: Size is too big

The tablespace "{#TABLESPACE.NAME}" has grown beyond the expected size. Check the storage capacity and the growth rate before it becomes a problem.

min(/PostgreSQL by Zabbix agent/pgsql.tablespace.size["{#TABLESPACE.NAME}"],5m) > {$PG.TABLESPACE.SIZE.MAX.WARN:"{#TABLESPACE.NAME}"} Warning Depends on:
  • PostgreSQL: Tablespace [{#TABLESPACE.NAME}]: Size is critically big
PostgreSQL: Tablespace [{#TABLESPACE.NAME}]: Size is critically big

The tablespace "{#TABLESPACE.NAME}" is close to exhausting its storage. Free up space or move relations to another tablespace - a full disk stops the instance from accepting writes.

min(/PostgreSQL by Zabbix agent/pgsql.tablespace.size["{#TABLESPACE.NAME}"],5m) > {$PG.TABLESPACE.SIZE.MAX.HIGH:"{#TABLESPACE.NAME}"} High

Feedback

Please report any issues with the template at https://support.zabbix.com

You can also provide feedback, discuss the template, or ask for help at ZABBIX forums

Sie können die Integration nicht finden, die Sie benötigen?