This is the documentation page for an unsupported version of Zabbix.
Is this not what you were looking for? Switch to the current version or choose one from the drop-down menu.

Requirements for PostgreSQL template

Overview

This section contains the required steps to ensure proper operation of Template DB PostgreSQL.

Steps

1. Install Zabbix agent and create a read-only zbx_monitor user with proper access to your PostgreSQL server.

For PostgreSQL version 10 and above:

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

For older PostgreSQL versions:

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

2. Copy postgresql/ to Zabbix agent home directory (/var/lib/zabbix/). The directory contains the files needed to obtain metrics from PostgreSQL.

3. Copy template_db_postgresql.conf (found in the templates directory of the downloaded latest Zabbix version) to Zabbix agent configuration directory (/etc/zabbix/zabbix_agentd.d/) and restart Zabbix agent service.

4. Edit pg_hba.conf to allow connections from Zabbix agent (https://www.postgresql.org/docs/current/auth-pg-hba-conf.html).

Add rows (for example):

host all zbx_monitor 127.0.0.1/32 trust
       host all zbx_monitor 0.0.0.0/0 md5
       host all zbx_monitor ::0/0 md5

5. If you need to monitor a remote server then create a .pgpass file in Zabbix agent home directory (/var/lib/zabbix/) and add the connection details with the instance, port, database, user and password information in the format below (https://www.postgresql.org/docs/current/libpq-pgpass.html).

Add rows, for example:

<REMOTE_HOST1>:5432:postgres:zbx_monitor:<PASSWORD>
       <REMOTE_HOST2>:5432:postgres:zbx_monitor:<PASSWORD>
       ...
       <REMOTE_HOSTN>:5432:postgres:zbx_monitor:<PASSWORD>

Or, example 2:

*:5432:postgres:zbx_monitor:<PASSWORD>

6. Import template_db_postgresql.xml in to Zabbix and link it to the target host.