diff --git a/Postgresql/Config/postgresql_mon_queries.zip b/Postgresql/Config/postgresql_mon_queries.zip new file mode 100644 index 0000000000000000000000000000000000000000..905801305bbf791386e42ff6a79998e8c186831d Binary files /dev/null and b/Postgresql/Config/postgresql_mon_queries.zip differ diff --git a/Postgresql/Config/userparameter_postgresql.conf b/Postgresql/Config/userparameter_postgresql.conf new file mode 100644 index 0000000000000000000000000000000000000000..283fea9015850f20cdade1c8ac162649910eb36c --- /dev/null +++ b/Postgresql/Config/userparameter_postgresql.conf @@ -0,0 +1,29 @@ +UserParameter=pgsql.bgwriter[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -f "/var/lib/zabbix/postgresql/pgsql.bgwriter.sql" + +UserParameter=pgsql.connections.sum[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -f "/var/lib/zabbix/postgresql/pgsql.connections.sum.sql" +UserParameter=pgsql.connections[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -f "/var/lib/zabbix/postgresql/pgsql.connections.sql" +UserParameter=pgsql.connections.prepared[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -f "/var/lib/zabbix/postgresql/pgsql.connections.prepared.sql" + +UserParameter=pgsql.dbstat.sum[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -f "/var/lib/zabbix/postgresql/pgsql.dbstat.sum.sql" +UserParameter=pgsql.dbstat[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -f "/var/lib/zabbix/postgresql/pgsql.dbstat.sql" + +UserParameter=pgsql.transactions[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -f "/var/lib/zabbix/postgresql/pgsql.transactions.sql" +UserParameter=pgsql.config.hash[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -f "/var/lib/zabbix/postgresql/pgsql.config.hash.sql" +UserParameter=pgsql.wal.stat[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -f "/var/lib/zabbix/postgresql/pgsql.wal.stat.sql" +UserParameter=pgsql.locks[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -f "/var/lib/zabbix/postgresql/pgsql.locks.sql" +UserParameter=pgsql.queries[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -v tmax=$6 -f "/var/lib/zabbix/postgresql/pgsql.query.time.sql" +UserParameter=pgsql.uptime[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -f "/var/lib/zabbix/postgresql/pgsql.uptime.sql" +UserParameter=pgsql.cache.hit[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -f "/var/lib/zabbix/postgresql/pgsql.cache.hit.sql" +UserParameter=pgsql.scans[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -f "/var/lib/zabbix/postgresql/pgsql.scans.sql" +UserParameter=pgsql.frozenxid[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -f "/var/lib/zabbix/postgresql/pgsql.frozenxid.sql" + +UserParameter=pgsql.discovery.db[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -f "/var/lib/zabbix/postgresql/pgsql.discovery.db.sql" +UserParameter=pgsql.db.size[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -c "SELECT pg_database_size('$6')" +UserParameter=pgsql.ping[*], pg_isready -h "$1" -p "$2" +UserParameter=pgsql.ping.time[*], LANG=C.UTF-8 psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -f "/var/lib/zabbix/postgresql/pgsql.ping.time.sql" +UserParameter=pgsql.version[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -c "SELECT version();" + +UserParameter=pgsql.replication.count[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -c "SELECT count(*) FROM pg_stat_replication" +UserParameter=pgsql.replication.recovery_role[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -f "/var/lib/zabbix/postgresql/pgsql.replication.recovery_role.sql" +UserParameter=pgsql.replication.lag.sec[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -f "/var/lib/zabbix/postgresql/pgsql.replication.lag.sql" +UserParameter=pgsql.replication.status[*], psql -qtAX postgresql://"$3":"$4"@"$1":"$2"/"$5" -f "/var/lib/zabbix/postgresql/pgsql.replication.status.sql" diff --git a/Postgresql/Template/template_db_postgresql.xml b/Postgresql/Template/template_db_postgresql.xml new file mode 100644 index 0000000000000000000000000000000000000000..40f812c43e2bdaa9f67a6be79d9105b4627d1348 --- /dev/null +++ b/Postgresql/Template/template_db_postgresql.xml @@ -0,0 +1,2776 @@ +<?xml version="1.0" encoding="UTF-8"?> +<zabbix_export> + <version>5.0</version> + <date>2022-01-12T15:45:39Z</date> + <groups> + <group> + <name>Templates/Databases</name> + </group> + </groups> + <templates> + <template> + <template>Template DB PostgreSQL by user parameters</template> + <name>Template DB PostgreSQL by user parameters</name> + <description>You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/384190-%C2%A0discussion-thread-for-official-zabbix-template-db-postgresql + +Template tooling version used: 0.39</description> + <groups> + <group> + <name>Templates/Databases</name> + </group> + </groups> + <applications> + <application> + <name>PostgreSQL</name> + </application> + <application> + <name>Zabbix raw items</name> + </application> + </applications> + <items> + <item> + <name>Bgwriter: Buffers allocated per second</name> + <type>DEPENDENT</type> + <key>pgsql.bgwriter.buffers_alloc.rate</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <units>Bps</units> + <description>Number of buffers allocated</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.buffers_alloc</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item> + <item> + <name>Bgwriter: Buffers backend fsync per second</name> + <type>DEPENDENT</type> + <key>pgsql.bgwriter.buffers_backend_fsync.rate</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <description>Number of times a backend had to execute its own fsync call (normally the background writer handles those even when the backend does its own write)</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.buffers_backend_fsync</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item> + <item> + <name>Bgwriter: Buffers written directly by a backend per second</name> + <type>DEPENDENT</type> + <key>pgsql.bgwriter.buffers_backend.rate</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <units>Bps</units> + <description>Number of buffers written directly by a backend</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.buffers_backend</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item> + <item> + <name>Bgwriter: Buffers written during checkpoints per second</name> + <type>DEPENDENT</type> + <key>pgsql.bgwriter.buffers_checkpoint.rate</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <units>Bps</units> + <description>Number of buffers written during checkpoints</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.buffers_checkpoint</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item> + <item> + <name>Bgwriter: Buffers written by the background writer per second</name> + <type>DEPENDENT</type> + <key>pgsql.bgwriter.buffers_clean.rate</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <units>Bps</units> + <description>Number of buffers written by the background writer</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.buffers_clean</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item> + <item> + <name>Bgwriter: Checkpoint sync time</name> + <type>DEPENDENT</type> + <key>pgsql.bgwriter.checkpoint_sync_time</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <units>s</units> + <description>Total amount of time that has been spent in the portion of checkpoint processing where files are synchronized to disk</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.checkpoint_sync_time</params> + </step> + <step> + <type>MULTIPLIER</type> + <params>0.001</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item> + <item> + <name>Bgwriter: Checkpoint write time</name> + <type>DEPENDENT</type> + <key>pgsql.bgwriter.checkpoint_write_time</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <units>s</units> + <description>Total amount of time that has been spent in the portion of checkpoint processing where files are written to disk, in milliseconds</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.checkpoint_write_time</params> + </step> + <step> + <type>MULTIPLIER</type> + <params>0.001</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item> + <item> + <name>Bgwriter: Requested checkpoints per second</name> + <type>DEPENDENT</type> + <key>pgsql.bgwriter.checkpoints_req.rate</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <description>Number of requested checkpoints that have been performed</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.checkpoints_req</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + <triggers> + <trigger> + <expression>{last()} > {$PG.CHECKPOINTS_REQ.MAX.WARN}</expression> + <name>PostgreSQL: Required checkpoints occurs too frequently (over {$PG.CHECKPOINTS_REQ.MAX.WARN})</name> + <priority>AVERAGE</priority> + <description>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</description> + </trigger> + </triggers> + </item> + <item> + <name>Bgwriter: Scheduled checkpoints per second</name> + <type>DEPENDENT</type> + <key>pgsql.bgwriter.checkpoints_timed.rate</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <description>Number of scheduled checkpoints that have been performed</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.checkpoints_timed</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item> + <item> + <name>Bgwriter: Max written per second</name> + <type>DEPENDENT</type> + <key>pgsql.bgwriter.maxwritten_clean.rate</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <description>Number of times the background writer stopped a cleaning scan because it had written too many buffers</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.maxwritten_clean</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item> + <item> + <name>PostgreSQL: Get bgwriter</name> + <key>pgsql.bgwriter["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + <history>1h</history> + <trends>0</trends> + <value_type>TEXT</value_type> + <description>Statistics about the background writer process's activity</description> + <applications> + <application> + <name>Zabbix raw items</name> + </application> + </applications> + <triggers> + <trigger> + <expression>{nodata(30m)} = 1</expression> + <name>PostgreSQL: Failed to get items (no data for 30m)</name> + <priority>WARNING</priority> + <description>Zabbix has not received data for items for the last 30 minutes</description> + <dependencies> + <dependency> + <name>PostgreSQL: Service is down</name> + <expression>{Template DB PostgreSQL by user parameters:pgsql.ping["{$PG.HOST}","{$PG.PORT}"].last()} = 0</expression> + </dependency> + </dependencies> + </trigger> + </triggers> + </item> + <item> + <name>Status: Cache hit ratio %</name> + <key>pgsql.cache.hit["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + <history>7d</history> + <value_type>FLOAT</value_type> + <units>%</units> + <description>Cache hit ratio</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <triggers> + <trigger> + <expression>{max(5m)} < {$PG.CACHE_HITRATIO.MIN.WARN}</expression> + <name>PostgreSQL: Cache hit ratio too low (under {$PG.CACHE_HITRATIO.MIN.WARN} in 5m)</name> + <priority>WARNING</priority> + </trigger> + </triggers> + </item> + <item> + <name>Status: Config hash</name> + <key>pgsql.config.hash["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + <delay>15m</delay> + <history>7d</history> + <trends>0</trends> + <value_type>TEXT</value_type> + <description>PostgreSQL configuration hash</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>DISCARD_UNCHANGED_HEARTBEAT</type> + <params>1h</params> + </step> + </preprocessing> + <triggers> + <trigger> + <expression>{diff()}=1 and {strlen()}>0</expression> + <name>PostgreSQL: Configuration has changed</name> + <priority>INFO</priority> + </trigger> + </triggers> + </item> + <item> + <name>Connections sum: Active</name> + <type>DEPENDENT</type> + <key>pgsql.connections.sum.active</key> + <delay>0</delay> + <history>7d</history> + <description>Total number of connections executing a query</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.active</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.connections.sum["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item> + <item> + <name>Connections sum: Idle</name> + <type>DEPENDENT</type> + <key>pgsql.connections.sum.idle</key> + <delay>0</delay> + <history>7d</history> + <description>Total number of connections waiting for a new client command</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.idle</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.connections.sum["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item> + <item> + <name>Connections sum: Idle in transaction</name> + <type>DEPENDENT</type> + <key>pgsql.connections.sum.idle_in_transaction</key> + <delay>0</delay> + <history>7d</history> + <description>Total number of connections in a transaction state, but not executing a query</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.idle_in_transaction</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.connections.sum["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item> + <item> + <name>Connections sum: Prepared</name> + <type>DEPENDENT</type> + <key>pgsql.connections.sum.prepared</key> + <delay>0</delay> + <history>7d</history> + <description>Total number of prepared transactions +https://www.postgresql.org/docs/current/sql-prepare-transaction.html</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.prepared</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.connections.sum["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item> + <item> + <name>Connections sum: Total</name> + <type>DEPENDENT</type> + <key>pgsql.connections.sum.total</key> + <delay>0</delay> + <history>7d</history> + <description>Total number of connections</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.total</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.connections.sum["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item> + <item> + <name>Connections sum: Total %</name> + <type>DEPENDENT</type> + <key>pgsql.connections.sum.total_pct</key> + <delay>0</delay> + <history>7d</history> + <units>%</units> + <description>Total number of connections in percentage</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.total_pct</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.connections.sum["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + <triggers> + <trigger> + <expression>{min(5m)} > {$PG.CONN_TOTAL_PCT.MAX.WARN}</expression> + <name>PostgreSQL: Total number of connections is too high (over {$PG.CONN_TOTAL_PCT.MAX.WARN} in 5m)</name> + <priority>AVERAGE</priority> + </trigger> + </triggers> + </item> + <item> + <name>Connections sum: Waiting</name> + <type>DEPENDENT</type> + <key>pgsql.connections.sum.waiting</key> + <delay>0</delay> + <history>7d</history> + <description>Total number of waiting connections +https://www.postgresql.org/docs/current/monitoring-stats.html#WAIT-EVENT-TABLE</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.waiting</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.connections.sum["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item> + <item> + <name>PostgreSQL: Get connections sum</name> + <key>pgsql.connections.sum["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + <history>1h</history> + <trends>0</trends> + <value_type>TEXT</value_type> + <description>Collect all metrics from pg_stat_activity +https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-ACTIVITY-VIEW</description> + <applications> + <application> + <name>Zabbix raw items</name> + </application> + </applications> + </item> + <item> + <name>PostgreSQL: Get dbstat</name> + <key>pgsql.dbstat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + <history>1h</history> + <trends>0</trends> + <value_type>TEXT</value_type> + <description>Collect all metrics from pg_stat_database per database +https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-DATABASE-VIEW</description> + <applications> + <application> + <name>Zabbix raw items</name> + </application> + </applications> + </item> + <item> + <name>PostgreSQL: Get locks</name> + <key>pgsql.locks["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + <history>1h</history> + <trends>0</trends> + <value_type>TEXT</value_type> + <description>Collect all metrics from pg_locks per database +https://www.postgresql.org/docs/current/explicit-locking.html#LOCKING-TABLES</description> + <applications> + <application> + <name>Zabbix raw items</name> + </application> + </applications> + </item> + <item> + <name>Status: Ping time</name> + <key>pgsql.ping.time["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + <history>7d</history> + <value_type>FLOAT</value_type> + <units>s</units> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>REGEX</type> + <params>Time:\s+(\d+\.\d+)\s+ms +\1</params> + </step> + <step> + <type>MULTIPLIER</type> + <params>0.001</params> + </step> + </preprocessing> + <triggers> + <trigger> + <expression>{min(5m)} > {$PG.PING_TIME.MAX.WARN}</expression> + <name>PostgreSQL: Response too long (over {$PG.PING_TIME.MAX.WARN})</name> + <priority>AVERAGE</priority> + <dependencies> + <dependency> + <name>PostgreSQL: Service is down</name> + <expression>{Template DB PostgreSQL by user parameters:pgsql.ping["{$PG.HOST}","{$PG.PORT}"].last()} = 0</expression> + </dependency> + </dependencies> + </trigger> + </triggers> + </item> + <item> + <name>Status: Ping</name> + <key>pgsql.ping["{$PG.HOST}","{$PG.PORT}"]</key> + <history>7d</history> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <valuemap> + <name>Service state</name> + </valuemap> + <preprocessing> + <step> + <type>JAVASCRIPT</type> + <params>return value.search(/accepting connections/)>0 ? 1 : 0</params> + </step> + <step> + <type>DISCARD_UNCHANGED_HEARTBEAT</type> + <params>1h</params> + </step> + </preprocessing> + <triggers> + <trigger> + <expression>{last()} = 0</expression> + <name>PostgreSQL: Service is down</name> + <priority>HIGH</priority> + </trigger> + </triggers> + </item> + <item> + <name>PostgreSQL: Get queries</name> + <key>pgsql.queries["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}","{$PG.QUERY_ETIME.MAX.WARN}"]</key> + <history>1h</history> + <trends>0</trends> + <value_type>TEXT</value_type> + <description>Collect all metrics by query execution time</description> + <applications> + <application> + <name>Zabbix raw items</name> + </application> + </applications> + </item> + <item> + <name>Replication: standby count</name> + <key>pgsql.replication.count["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + <history>7d</history> + <description>Number of standby servers</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + </item> + <item> + <name>Replication: lag in seconds</name> + <key>pgsql.replication.lag.sec["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + <history>7d</history> + <units>s</units> + <description>Replication lag with Master in seconds</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <triggers> + <trigger> + <expression>{min(5m)} > {$PG.REPL_LAG.MAX.WARN}</expression> + <name>PostgreSQL: Streaming lag with {#MASTER} is too high (over {$PG.REPL_LAG.MAX.WARN} in 5m)</name> + <priority>AVERAGE</priority> + </trigger> + </triggers> + </item> + <item> + <name>Replication: recovery role</name> + <key>pgsql.replication.recovery_role["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + <history>7d</history> + <description>Replication role: 1 — recovery is still in progress (standby mode), 0 — master mode.</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <valuemap> + <name>PostgreSQL recovery role</name> + </valuemap> + </item> + <item> + <name>Replication: status</name> + <key>pgsql.replication.status["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + <history>7d</history> + <description>Replication status: 0 — streaming is down, 1 — streaming is up, 2 — master mode</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <valuemap> + <name>PostgreSQL replication status</name> + </valuemap> + <triggers> + <trigger> + <expression>{max(5m)}=0</expression> + <name>PostgreSQL: Replication is down</name> + <priority>AVERAGE</priority> + </trigger> + </triggers> + </item> + <item> + <name>Transactions: Max active transaction time</name> + <type>DEPENDENT</type> + <key>pgsql.transactions.active</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <units>s</units> + <description>Current max active transaction time</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.active</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.transactions["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item> + <item> + <name>Transactions: Max idle transaction time</name> + <type>DEPENDENT</type> + <key>pgsql.transactions.idle</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <units>s</units> + <description>Current max idle transaction time</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.idle</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.transactions["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item> + <item> + <name>Transactions: Max prepared transaction time</name> + <type>DEPENDENT</type> + <key>pgsql.transactions.prepared</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <units>s</units> + <description>Current max prepared transaction time</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.prepared</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.transactions["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item> + <item> + <name>Transactions: Max waiting transaction time</name> + <type>DEPENDENT</type> + <key>pgsql.transactions.waiting</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <units>s</units> + <description>Current max waiting transaction time</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.waiting</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.transactions["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item> + <item> + <name>PostgreSQL: Get transactions</name> + <key>pgsql.transactions["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + <history>1h</history> + <trends>0</trends> + <value_type>TEXT</value_type> + <description>Collect metrics by transaction execution time</description> + <applications> + <application> + <name>Zabbix raw items</name> + </application> + </applications> + </item> + <item> + <name>Status: Uptime</name> + <key>pgsql.uptime["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + <history>7d</history> + <units>uptime</units> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <triggers> + <trigger> + <expression>{last()} < 10m</expression> + <name>PostgreSQL: Service has been restarted (uptime < 10m)</name> + <priority>INFO</priority> + <description>PostgreSQL uptime is less than 10 minutes</description> + </trigger> + </triggers> + </item> + <item> + <name>Status: Version</name> + <key>pgsql.version["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + <delay>15m</delay> + <history>7d</history> + <trends>0</trends> + <value_type>CHAR</value_type> + <description>PostgreSQL version</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>DISCARD_UNCHANGED_HEARTBEAT</type> + <params>1d</params> + </step> + </preprocessing> + <triggers> + <trigger> + <expression>{diff()}=1 and {strlen()}>0</expression> + <name>PostgreSQL: Version has changed (new version value received: {ITEM.VALUE})</name> + <priority>INFO</priority> + </trigger> + </triggers> + </item> + <item> + <name>WAL: Segments count</name> + <type>DEPENDENT</type> + <key>pgsql.wal.count</key> + <delay>0</delay> + <history>7d</history> + <description>Number of WAL segments</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.count</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.wal.stat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item> + <item> + <name>PostgreSQL: Get WAL</name> + <key>pgsql.wal.stat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + <delay>5m</delay> + <history>1h</history> + <trends>0</trends> + <value_type>TEXT</value_type> + <description>Master item to collect WAL metrics</description> + <applications> + <application> + <name>Zabbix raw items</name> + </application> + </applications> + </item> + <item> + <name>WAL: Bytes written</name> + <type>DEPENDENT</type> + <key>pgsql.wal.write</key> + <delay>0</delay> + <history>7d</history> + <units>B</units> + <description>WAL write in bytes</description> + <applications> + <application> + <name>PostgreSQL</name> + </application> + </applications> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.write</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.wal.stat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item> + </items> + <discovery_rules> + <discovery_rule> + <name>Database discovery</name> + <key>pgsql.discovery.db["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + <delay>1h</delay> + <filter> + <conditions> + <condition> + <macro>{#DBNAME}</macro> + <value>{$PG.LLD.FILTER.DBNAME}</value> + <formulaid>A</formulaid> + </condition> + </conditions> + </filter> + <item_prototypes> + <item_prototype> + <name>DB {#DBNAME}: Database size</name> + <key>pgsql.db.size["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}","{#DBNAME}"]</key> + <delay>15m</delay> + <history>7d</history> + <units>B</units> + <description>Database size</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Blocks hit per second</name> + <type>DEPENDENT</type> + <key>pgsql.dbstat.blks_hit.rate["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <description>Total number of times disk blocks were found already in the buffer cache, so that a read was not necessary</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$['{#DBNAME}'].blks_hit</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.dbstat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Disk blocks read per second</name> + <type>DEPENDENT</type> + <key>pgsql.dbstat.blks_read.rate["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <description>Total number of disk blocks read in this database</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$['{#DBNAME}'].blks_read</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.dbstat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Detected conflicts per second</name> + <type>DEPENDENT</type> + <key>pgsql.dbstat.conflicts.rate["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <description>Total number of queries canceled due to conflicts with recovery in this database</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$['{#DBNAME}'].conflicts</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.dbstat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + <trigger_prototypes> + <trigger_prototype> + <expression>{min(5m)} > {$PG.CONFLICTS.MAX.WARN:"{#DBNAME}"}</expression> + <name>DB {#DBNAME}: Too many recovery conflicts (over {$PG.CONFLICTS.MAX.WARN:"{#DBNAME}"} in 5m)</name> + <priority>AVERAGE</priority> + <description>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</description> + </trigger_prototype> + </trigger_prototypes> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Detected deadlocks per second</name> + <type>DEPENDENT</type> + <key>pgsql.dbstat.deadlocks.rate["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <description>Total number of detected deadlocks in this database</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$['{#DBNAME}'].deadlocks</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.dbstat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + <trigger_prototypes> + <trigger_prototype> + <expression>{min(5m)} > {$PG.DEADLOCKS.MAX.WARN:"{#DBNAME}"}</expression> + <name>DB {#DBNAME}: Deadlock occurred (over {$PG.DEADLOCKS.MAX.WARN:"{#DBNAME}"} in 5m)</name> + <priority>HIGH</priority> + </trigger_prototype> + </trigger_prototypes> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Temp_bytes written per second</name> + <type>DEPENDENT</type> + <key>pgsql.dbstat.temp_bytes.rate["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <units>B</units> + <description>Total amount of data written to temporary files by queries in this database</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$['{#DBNAME}'].temp_bytes</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.dbstat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Temp_files created per second</name> + <type>DEPENDENT</type> + <key>pgsql.dbstat.temp_files.rate["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <description>Total number of temporary files created by queries in this database</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$['{#DBNAME}'].temp_files</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.dbstat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Tuples deleted per second</name> + <type>DEPENDENT</type> + <key>pgsql.dbstat.tup_deleted.rate["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <description>Total number of rows deleted by queries in this database</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$['{#DBNAME}'].tup_deleted</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.dbstat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Tuples fetched per second</name> + <type>DEPENDENT</type> + <key>pgsql.dbstat.tup_fetched.rate["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <description>Total number of rows fetched by queries in this database</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$['{#DBNAME}'].tup_fetched</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.dbstat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Tuples inserted per second</name> + <type>DEPENDENT</type> + <key>pgsql.dbstat.tup_inserted.rate["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <description>Total number of rows inserted by queries in this database</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$['{#DBNAME}'].tup_inserted</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.dbstat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Tuples returned per second</name> + <type>DEPENDENT</type> + <key>pgsql.dbstat.tup_returned.rate["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <description>Total number of rows updated by queries in this database</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$['{#DBNAME}'].tup_returned</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.dbstat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Tuples updated per second</name> + <type>DEPENDENT</type> + <key>pgsql.dbstat.tup_updated.rate["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <description>Total number of rows updated by queries in this database</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$['{#DBNAME}'].tup_updated</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.dbstat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Commits per second</name> + <type>DEPENDENT</type> + <key>pgsql.dbstat.xact_commit.rate["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <description>Number of transactions in this database that have been committed</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$['{#DBNAME}'].xact_commit</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.dbstat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Rollbacks per second</name> + <type>DEPENDENT</type> + <key>pgsql.dbstat.xact_rollback.rate["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <description>Total number of transactions in this database that have been rolled back</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$['{#DBNAME}'].xact_rollback</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.dbstat["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Frozen XID before avtovacuum %</name> + <type>DEPENDENT</type> + <key>pgsql.frozenxid.prc_before_av["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <units>%</units> + <description>reventing Transaction ID Wraparound Failures +https://www.postgresql.org/docs/current/routine-vacuuming.html#VACUUM-FOR-WRAPAROUND</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.prc_before_av</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.frozenxid["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]</key> + </master_item> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Frozen XID before stop %</name> + <type>DEPENDENT</type> + <key>pgsql.frozenxid.prc_before_stop["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <units>%</units> + <description>Preventing Transaction ID Wraparound Failures +https://www.postgresql.org/docs/current/routine-vacuuming.html#VACUUM-FOR-WRAPAROUND</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.prc_before_stop</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.frozenxid["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]</key> + </master_item> + <trigger_prototypes> + <trigger_prototype> + <expression>{last()}<{$PG.FROZENXID_PCT_STOP.MIN.HIGH:"{#DBNAME}"}</expression> + <name>DB {#DBNAME}: VACUUM FREEZE is required to prevent wraparound (frozen XID less than {$PG.FROZENXID_PCT_STOP.MIN.HIGH:"{#DBNAME}"} %)</name> + <priority>AVERAGE</priority> + <description>Preventing Transaction ID Wraparound Failures +https://www.postgresql.org/docs/current/routine-vacuuming.html#VACUUM-FOR-WRAPAROUND</description> + </trigger_prototype> + </trigger_prototypes> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Get frozen XID</name> + <key>pgsql.frozenxid["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]</key> + <history>1h</history> + <trends>0</trends> + <value_type>TEXT</value_type> + <applications> + <application> + <name>Zabbix raw items</name> + </application> + </applications> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Locks total</name> + <type>DEPENDENT</type> + <key>pgsql.locks.total["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <description>Total number of locks in the database</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$['{#DBNAME}'].total</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.locks["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </master_item> + <trigger_prototypes> + <trigger_prototype> + <expression>{min(5m)}>{$PG.LOCKS.MAX.WARN:"{#DBNAME}"}</expression> + <name>DB {#DBNAME}: Number of locks is too high (over {$PG.LOCKS.MAX.WARN:"{#DBNAME}"} in 5m)</name> + <priority>WARNING</priority> + </trigger_prototype> + </trigger_prototypes> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Queries slow maintenance count</name> + <type>DEPENDENT</type> + <key>pgsql.queries.mro.slow_count["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <description>Slow maintenance query count</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$['{#DBNAME}'].mro_slow_count</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.queries["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}","{$PG.QUERY_ETIME.MAX.WARN}"]</key> + </master_item> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Queries max maintenance time</name> + <type>DEPENDENT</type> + <key>pgsql.queries.mro.time_max["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <units>s</units> + <description>Max maintenance query time</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$['{#DBNAME}'].mro_time_max</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.queries["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}","{$PG.QUERY_ETIME.MAX.WARN}"]</key> + </master_item> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Queries sum maintenance time</name> + <type>DEPENDENT</type> + <key>pgsql.queries.mro.time_sum["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <units>s</units> + <description>Sum maintenance query time</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$['{#DBNAME}'].mro_time_sum</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.queries["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}","{$PG.QUERY_ETIME.MAX.WARN}"]</key> + </master_item> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Queries slow query count</name> + <type>DEPENDENT</type> + <key>pgsql.queries.query.slow_count["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <description>Slow query count</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$['{#DBNAME}'].query_slow_count</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.queries["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}","{$PG.QUERY_ETIME.MAX.WARN}"]</key> + </master_item> + <trigger_prototypes> + <trigger_prototype> + <expression>{min(5m)}>{$PG.SLOW_QUERIES.MAX.WARN:"{#DBNAME}"}</expression> + <name>DB {#DBNAME}: Too many slow queries (over {$PG.SLOW_QUERIES.MAX.WARN:"{#DBNAME}"} in 5m)</name> + <priority>WARNING</priority> + </trigger_prototype> + </trigger_prototypes> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Queries max query time</name> + <type>DEPENDENT</type> + <key>pgsql.queries.query.time_max["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <units>s</units> + <description>Max query time</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$['{#DBNAME}'].query_time_max</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.queries["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}","{$PG.QUERY_ETIME.MAX.WARN}"]</key> + </master_item> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Queries sum query time</name> + <type>DEPENDENT</type> + <key>pgsql.queries.query.time_sum["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <units>s</units> + <description>Sum query time</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$['{#DBNAME}'].query_time_sum</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.queries["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}","{$PG.QUERY_ETIME.MAX.WARN}"]</key> + </master_item> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Queries slow transaction count</name> + <type>DEPENDENT</type> + <key>pgsql.queries.tx.slow_count["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <description>Slow transaction query count</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$['{#DBNAME}'].tx_slow_count</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.queries["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}","{$PG.QUERY_ETIME.MAX.WARN}"]</key> + </master_item> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Queries max transaction time</name> + <type>DEPENDENT</type> + <key>pgsql.queries.tx.time_max["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <units>s</units> + <description>Max transaction query time</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$['{#DBNAME}'].tx_time_max</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.queries["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}","{$PG.QUERY_ETIME.MAX.WARN}"]</key> + </master_item> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Queries sum transaction time</name> + <type>DEPENDENT</type> + <key>pgsql.queries.tx.time_sum["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <units>s</units> + <description>Sum transaction query time</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$['{#DBNAME}'].tx_time_sum</params> + </step> + </preprocessing> + <master_item> + <key>pgsql.queries["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}","{$PG.QUERY_ETIME.MAX.WARN}"]</key> + </master_item> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Index scans per second</name> + <type>DEPENDENT</type> + <key>pgsql.scans.idx.rate["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <description>Number of index scans in the database</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.idx</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.scans["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]</key> + </master_item> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Sequential scans per second</name> + <type>DEPENDENT</type> + <key>pgsql.scans.seq.rate["{#DBNAME}"]</key> + <delay>0</delay> + <history>7d</history> + <value_type>FLOAT</value_type> + <description>Number of sequential scans in the database</description> + <application_prototypes> + <application_prototype> + <name>PostgreSQL: DB {#DBNAME}</name> + </application_prototype> + </application_prototypes> + <preprocessing> + <step> + <type>JSONPATH</type> + <params>$.seq</params> + </step> + <step> + <type>CHANGE_PER_SECOND</type> + <params/> + </step> + </preprocessing> + <master_item> + <key>pgsql.scans["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]</key> + </master_item> + </item_prototype> + <item_prototype> + <name>DB {#DBNAME}: Get scans</name> + <key>pgsql.scans["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{#DBNAME}"]</key> + <history>1h</history> + <trends>0</trends> + <value_type>TEXT</value_type> + <description>Number of scans done for table/index in the database</description> + <applications> + <application> + <name>Zabbix raw items</name> + </application> + </applications> + </item_prototype> + </item_prototypes> + <graph_prototypes> + <graph_prototype> + <name>DB {#DBNAME}: Block hit/read</name> + <ymin_type_1>FIXED</ymin_type_1> + <graph_items> + <graph_item> + <color>1A7C11</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.dbstat.blks_hit.rate["{#DBNAME}"]</key> + </item> + </graph_item> + <graph_item> + <sortorder>1</sortorder> + <color>2774A4</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.dbstat.blks_read.rate["{#DBNAME}"]</key> + </item> + </graph_item> + </graph_items> + </graph_prototype> + <graph_prototype> + <name>DB {#DBNAME}: Database size</name> + <ymin_type_1>FIXED</ymin_type_1> + <graph_items> + <graph_item> + <color>1A7C11</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.db.size["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}","{#DBNAME}"]</key> + </item> + </graph_item> + </graph_items> + </graph_prototype> + <graph_prototype> + <name>DB {#DBNAME}: Events</name> + <ymin_type_1>FIXED</ymin_type_1> + <graph_items> + <graph_item> + <drawtype>GRADIENT_LINE</drawtype> + <color>1A7C11</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.dbstat.xact_commit.rate["{#DBNAME}"]</key> + </item> + </graph_item> + <graph_item> + <sortorder>1</sortorder> + <color>2774A4</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.dbstat.conflicts.rate["{#DBNAME}"]</key> + </item> + </graph_item> + <graph_item> + <sortorder>2</sortorder> + <color>F63100</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.dbstat.deadlocks.rate["{#DBNAME}"]</key> + </item> + </graph_item> + <graph_item> + <sortorder>3</sortorder> + <color>A54F10</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.dbstat.xact_rollback.rate["{#DBNAME}"]</key> + </item> + </graph_item> + </graph_items> + </graph_prototype> + <graph_prototype> + <name>DB {#DBNAME}: Locks</name> + <ymin_type_1>FIXED</ymin_type_1> + <graph_items> + <graph_item> + <color>1A7C11</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.locks.total["{#DBNAME}"]</key> + </item> + </graph_item> + </graph_items> + </graph_prototype> + <graph_prototype> + <name>DB {#DBNAME}: Queries</name> + <ymin_type_1>FIXED</ymin_type_1> + <graph_items> + <graph_item> + <color>1A7C11</color> + <yaxisside>RIGHT</yaxisside> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.queries.mro.time_max["{#DBNAME}"]</key> + </item> + </graph_item> + <graph_item> + <sortorder>1</sortorder> + <color>2774A4</color> + <yaxisside>RIGHT</yaxisside> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.queries.query.time_max["{#DBNAME}"]</key> + </item> + </graph_item> + <graph_item> + <sortorder>2</sortorder> + <color>F63100</color> + <yaxisside>RIGHT</yaxisside> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.queries.tx.time_max["{#DBNAME}"]</key> + </item> + </graph_item> + <graph_item> + <sortorder>3</sortorder> + <drawtype>GRADIENT_LINE</drawtype> + <color>A54F10</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.queries.mro.time_sum["{#DBNAME}"]</key> + </item> + </graph_item> + <graph_item> + <sortorder>4</sortorder> + <drawtype>GRADIENT_LINE</drawtype> + <color>FC6EA3</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.queries.query.time_sum["{#DBNAME}"]</key> + </item> + </graph_item> + <graph_item> + <sortorder>5</sortorder> + <drawtype>GRADIENT_LINE</drawtype> + <color>6C59DC</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.queries.tx.time_sum["{#DBNAME}"]</key> + </item> + </graph_item> + </graph_items> + </graph_prototype> + <graph_prototype> + <name>DB {#DBNAME}: Slow queries</name> + <ymin_type_1>FIXED</ymin_type_1> + <graph_items> + <graph_item> + <color>1A7C11</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.queries.mro.slow_count["{#DBNAME}"]</key> + </item> + </graph_item> + <graph_item> + <sortorder>1</sortorder> + <color>2774A4</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.queries.query.slow_count["{#DBNAME}"]</key> + </item> + </graph_item> + <graph_item> + <sortorder>2</sortorder> + <color>F63100</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.queries.tx.slow_count["{#DBNAME}"]</key> + </item> + </graph_item> + </graph_items> + </graph_prototype> + <graph_prototype> + <name>DB {#DBNAME}: Temp files</name> + <graph_items> + <graph_item> + <drawtype>GRADIENT_LINE</drawtype> + <color>1A7C11</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.dbstat.temp_bytes.rate["{#DBNAME}"]</key> + </item> + </graph_item> + <graph_item> + <sortorder>1</sortorder> + <color>2774A4</color> + <yaxisside>RIGHT</yaxisside> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.dbstat.temp_files.rate["{#DBNAME}"]</key> + </item> + </graph_item> + </graph_items> + </graph_prototype> + <graph_prototype> + <name>DB {#DBNAME}: Tuples</name> + <ymin_type_1>FIXED</ymin_type_1> + <graph_items> + <graph_item> + <color>1A7C11</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.dbstat.tup_deleted.rate["{#DBNAME}"]</key> + </item> + </graph_item> + <graph_item> + <sortorder>1</sortorder> + <color>2774A4</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.dbstat.tup_fetched.rate["{#DBNAME}"]</key> + </item> + </graph_item> + <graph_item> + <sortorder>2</sortorder> + <color>F63100</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.dbstat.tup_inserted.rate["{#DBNAME}"]</key> + </item> + </graph_item> + <graph_item> + <sortorder>3</sortorder> + <color>A54F10</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.dbstat.tup_returned.rate["{#DBNAME}"]</key> + </item> + </graph_item> + <graph_item> + <sortorder>4</sortorder> + <color>FC6EA3</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.dbstat.tup_updated.rate["{#DBNAME}"]</key> + </item> + </graph_item> + </graph_items> + </graph_prototype> + </graph_prototypes> + </discovery_rule> + </discovery_rules> + <macros> + <macro> + <macro>{$PG.CACHE_HITRATIO.MIN.WARN}</macro> + <value>90</value> + </macro> + <macro> + <macro>{$PG.CHECKPOINTS_REQ.MAX.WARN}</macro> + <value>5</value> + </macro> + <macro> + <macro>{$PG.CONFLICTS.MAX.WARN}</macro> + <value>0</value> + </macro> + <macro> + <macro>{$PG.CONN_IDLE_IN_TRANS.MAX.WARN}</macro> + <value>5</value> + </macro> + <macro> + <macro>{$PG.CONN_TOTAL_PCT.MAX.WARN}</macro> + <value>90</value> + </macro> + <macro> + <macro>{$PG.CONN_WAIT.MAX.WARN}</macro> + <value>0</value> + </macro> + <macro> + <macro>{$PG.DB}</macro> + <value>postgres</value> + </macro> + <macro> + <macro>{$PG.DEADLOCKS.MAX.WARN}</macro> + <value>0</value> + </macro> + <macro> + <macro>{$PG.FROZENXID_PCT_STOP.MIN.HIGH}</macro> + <value>75</value> + </macro> + <macro> + <macro>{$PG.HOST}</macro> + <value>127.0.0.1</value> + </macro> + <macro> + <macro>{$PG.LLD.FILTER.DBNAME}</macro> + <value>(.*)</value> + </macro> + <macro> + <macro>{$PG.LOCKS.MAX.WARN}</macro> + <value>100</value> + </macro> + <macro> + <macro>{$PG.PASSWORD}</macro> + <description>Please set user's password in this macro.</description> + </macro> + <macro> + <macro>{$PG.PING_TIME.MAX.WARN}</macro> + <value>1s</value> + </macro> + <macro> + <macro>{$PG.PORT}</macro> + <value>5432</value> + </macro> + <macro> + <macro>{$PG.QUERY_ETIME.MAX.WARN}</macro> + <value>30</value> + </macro> + <macro> + <macro>{$PG.REPL_LAG.MAX.WARN}</macro> + <value>10m</value> + </macro> + <macro> + <macro>{$PG.SLOW_QUERIES.MAX.WARN}</macro> + <value>5</value> + </macro> + <macro> + <macro>{$PG.TRANS_ACTIVE.MAX.WARN}</macro> + <value>30s</value> + </macro> + <macro> + <macro>{$PG.TRANS_IDLE.MAX.WARN}</macro> + <value>30s</value> + </macro> + <macro> + <macro>{$PG.TRANS_WAIT.MAX.WARN}</macro> + <value>30s</value> + </macro> + <macro> + <macro>{$PG.USER}</macro> + <value>zbx_monitor</value> + </macro> + </macros> + <screens> + <screen> + <name>PostgreSQL databases</name> + <hsize>2</hsize> + <vsize>4</vsize> + <screen_items> + <screen_item> + <resourcetype>20</resourcetype> + <style>0</style> + <resource> + <name>DB {#DBNAME}: Tuples</name> + <host>Template DB PostgreSQL by user parameters</host> + </resource> + <width>500</width> + <height>200</height> + <x>0</x> + <y>0</y> + <colspan>1</colspan> + <rowspan>1</rowspan> + <elements>0</elements> + <valign>0</valign> + <halign>0</halign> + <dynamic>0</dynamic> + <sort_triggers>0</sort_triggers> + <url/> + <application/> + <max_columns>3</max_columns> + </screen_item> + <screen_item> + <resourcetype>20</resourcetype> + <style>0</style> + <resource> + <name>DB {#DBNAME}: Events</name> + <host>Template DB PostgreSQL by user parameters</host> + </resource> + <width>500</width> + <height>200</height> + <x>1</x> + <y>0</y> + <colspan>1</colspan> + <rowspan>1</rowspan> + <elements>0</elements> + <valign>0</valign> + <halign>0</halign> + <dynamic>0</dynamic> + <sort_triggers>0</sort_triggers> + <url/> + <application/> + <max_columns>3</max_columns> + </screen_item> + <screen_item> + <resourcetype>20</resourcetype> + <style>0</style> + <resource> + <name>DB {#DBNAME}: Block hit/read</name> + <host>Template DB PostgreSQL by user parameters</host> + </resource> + <width>500</width> + <height>200</height> + <x>0</x> + <y>1</y> + <colspan>1</colspan> + <rowspan>1</rowspan> + <elements>0</elements> + <valign>0</valign> + <halign>0</halign> + <dynamic>0</dynamic> + <sort_triggers>0</sort_triggers> + <url/> + <application/> + <max_columns>3</max_columns> + </screen_item> + <screen_item> + <resourcetype>20</resourcetype> + <style>0</style> + <resource> + <name>DB {#DBNAME}: Temp files</name> + <host>Template DB PostgreSQL by user parameters</host> + </resource> + <width>500</width> + <height>200</height> + <x>1</x> + <y>1</y> + <colspan>1</colspan> + <rowspan>1</rowspan> + <elements>0</elements> + <valign>0</valign> + <halign>0</halign> + <dynamic>0</dynamic> + <sort_triggers>0</sort_triggers> + <url/> + <application/> + <max_columns>3</max_columns> + </screen_item> + <screen_item> + <resourcetype>20</resourcetype> + <style>0</style> + <resource> + <name>DB {#DBNAME}: Locks</name> + <host>Template DB PostgreSQL by user parameters</host> + </resource> + <width>500</width> + <height>200</height> + <x>0</x> + <y>2</y> + <colspan>1</colspan> + <rowspan>1</rowspan> + <elements>0</elements> + <valign>0</valign> + <halign>0</halign> + <dynamic>0</dynamic> + <sort_triggers>0</sort_triggers> + <url/> + <application/> + <max_columns>3</max_columns> + </screen_item> + <screen_item> + <resourcetype>20</resourcetype> + <style>0</style> + <resource> + <name>DB {#DBNAME}: Database size</name> + <host>Template DB PostgreSQL by user parameters</host> + </resource> + <width>500</width> + <height>200</height> + <x>1</x> + <y>2</y> + <colspan>1</colspan> + <rowspan>1</rowspan> + <elements>0</elements> + <valign>0</valign> + <halign>0</halign> + <dynamic>0</dynamic> + <sort_triggers>0</sort_triggers> + <url/> + <application/> + <max_columns>3</max_columns> + </screen_item> + <screen_item> + <resourcetype>20</resourcetype> + <style>0</style> + <resource> + <name>DB {#DBNAME}: Queries</name> + <host>Template DB PostgreSQL by user parameters</host> + </resource> + <width>500</width> + <height>200</height> + <x>0</x> + <y>3</y> + <colspan>1</colspan> + <rowspan>1</rowspan> + <elements>0</elements> + <valign>0</valign> + <halign>0</halign> + <dynamic>0</dynamic> + <sort_triggers>0</sort_triggers> + <url/> + <application/> + <max_columns>3</max_columns> + </screen_item> + <screen_item> + <resourcetype>20</resourcetype> + <style>0</style> + <resource> + <name>DB {#DBNAME}: Slow queries</name> + <host>Template DB PostgreSQL by user parameters</host> + </resource> + <width>500</width> + <height>200</height> + <x>1</x> + <y>3</y> + <colspan>1</colspan> + <rowspan>1</rowspan> + <elements>0</elements> + <valign>0</valign> + <halign>0</halign> + <dynamic>0</dynamic> + <sort_triggers>0</sort_triggers> + <url/> + <application/> + <max_columns>3</max_columns> + </screen_item> + </screen_items> + </screen> + <screen> + <name>PostgreSQL stat</name> + <hsize>2</hsize> + <vsize>4</vsize> + <screen_items> + <screen_item> + <resourcetype>0</resourcetype> + <style>0</style> + <resource> + <name>PostgreSQL connections</name> + <host>Template DB PostgreSQL by user parameters</host> + </resource> + <width>500</width> + <height>200</height> + <x>0</x> + <y>0</y> + <colspan>1</colspan> + <rowspan>1</rowspan> + <elements>0</elements> + <valign>0</valign> + <halign>0</halign> + <dynamic>0</dynamic> + <sort_triggers>0</sort_triggers> + <url/> + <application/> + <max_columns>3</max_columns> + </screen_item> + <screen_item> + <resourcetype>0</resourcetype> + <style>0</style> + <resource> + <name>PostgreSQL transactions</name> + <host>Template DB PostgreSQL by user parameters</host> + </resource> + <width>500</width> + <height>200</height> + <x>1</x> + <y>0</y> + <colspan>1</colspan> + <rowspan>1</rowspan> + <elements>0</elements> + <valign>0</valign> + <halign>0</halign> + <dynamic>0</dynamic> + <sort_triggers>0</sort_triggers> + <url/> + <application/> + <max_columns>3</max_columns> + </screen_item> + <screen_item> + <resourcetype>0</resourcetype> + <style>0</style> + <resource> + <name>PostgreSQL ping</name> + <host>Template DB PostgreSQL by user parameters</host> + </resource> + <width>500</width> + <height>200</height> + <x>0</x> + <y>1</y> + <colspan>1</colspan> + <rowspan>1</rowspan> + <elements>0</elements> + <valign>0</valign> + <halign>0</halign> + <dynamic>0</dynamic> + <sort_triggers>0</sort_triggers> + <url/> + <application/> + <max_columns>3</max_columns> + </screen_item> + <screen_item> + <resourcetype>0</resourcetype> + <style>0</style> + <resource> + <name>PostgreSQL uptime</name> + <host>Template DB PostgreSQL by user parameters</host> + </resource> + <width>500</width> + <height>200</height> + <x>1</x> + <y>1</y> + <colspan>1</colspan> + <rowspan>1</rowspan> + <elements>0</elements> + <valign>0</valign> + <halign>0</halign> + <dynamic>0</dynamic> + <sort_triggers>0</sort_triggers> + <url/> + <application/> + <max_columns>3</max_columns> + </screen_item> + <screen_item> + <resourcetype>0</resourcetype> + <style>0</style> + <resource> + <name>PostgreSQL replication lag</name> + <host>Template DB PostgreSQL by user parameters</host> + </resource> + <width>500</width> + <height>200</height> + <x>0</x> + <y>2</y> + <colspan>1</colspan> + <rowspan>1</rowspan> + <elements>0</elements> + <valign>0</valign> + <halign>0</halign> + <dynamic>0</dynamic> + <sort_triggers>0</sort_triggers> + <url/> + <application/> + <max_columns>3</max_columns> + </screen_item> + <screen_item> + <resourcetype>0</resourcetype> + <style>0</style> + <resource> + <name>PostgreSQL WAL</name> + <host>Template DB PostgreSQL by user parameters</host> + </resource> + <width>500</width> + <height>200</height> + <x>1</x> + <y>2</y> + <colspan>1</colspan> + <rowspan>1</rowspan> + <elements>0</elements> + <valign>0</valign> + <halign>0</halign> + <dynamic>0</dynamic> + <sort_triggers>0</sort_triggers> + <url/> + <application/> + <max_columns>3</max_columns> + </screen_item> + <screen_item> + <resourcetype>0</resourcetype> + <style>0</style> + <resource> + <name>PostgreSQL bgwriter</name> + <host>Template DB PostgreSQL by user parameters</host> + </resource> + <width>500</width> + <height>200</height> + <x>0</x> + <y>3</y> + <colspan>1</colspan> + <rowspan>1</rowspan> + <elements>0</elements> + <valign>0</valign> + <halign>0</halign> + <dynamic>0</dynamic> + <sort_triggers>0</sort_triggers> + <url/> + <application/> + <max_columns>3</max_columns> + </screen_item> + <screen_item> + <resourcetype>0</resourcetype> + <style>0</style> + <resource> + <name>PostgreSQL checkpoints</name> + <host>Template DB PostgreSQL by user parameters</host> + </resource> + <width>500</width> + <height>200</height> + <x>1</x> + <y>3</y> + <colspan>1</colspan> + <rowspan>1</rowspan> + <elements>0</elements> + <valign>0</valign> + <halign>0</halign> + <dynamic>0</dynamic> + <sort_triggers>0</sort_triggers> + <url/> + <application/> + <max_columns>3</max_columns> + </screen_item> + </screen_items> + </screen> + </screens> + </template> + </templates> + <graphs> + <graph> + <name>PostgreSQL bgwriter</name> + <ymin_type_1>FIXED</ymin_type_1> + <graph_items> + <graph_item> + <color>1A7C11</color> + <yaxisside>RIGHT</yaxisside> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.bgwriter.buffers_alloc.rate</key> + </item> + </graph_item> + <graph_item> + <sortorder>1</sortorder> + <color>2774A4</color> + <yaxisside>RIGHT</yaxisside> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.bgwriter.buffers_clean.rate</key> + </item> + </graph_item> + <graph_item> + <sortorder>2</sortorder> + <color>F63100</color> + <yaxisside>RIGHT</yaxisside> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.bgwriter.buffers_backend.rate</key> + </item> + </graph_item> + <graph_item> + <sortorder>3</sortorder> + <color>A54F10</color> + <yaxisside>RIGHT</yaxisside> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.bgwriter.buffers_checkpoint.rate</key> + </item> + </graph_item> + <graph_item> + <sortorder>4</sortorder> + <color>FC6EA3</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.bgwriter.maxwritten_clean.rate</key> + </item> + </graph_item> + <graph_item> + <sortorder>5</sortorder> + <color>6C59DC</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.bgwriter.buffers_backend_fsync.rate</key> + </item> + </graph_item> + </graph_items> + </graph> + <graph> + <name>PostgreSQL checkpoints</name> + <ymin_type_1>FIXED</ymin_type_1> + <graph_items> + <graph_item> + <color>1A7C11</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.bgwriter.checkpoints_timed.rate</key> + </item> + </graph_item> + <graph_item> + <sortorder>1</sortorder> + <color>2774A4</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.bgwriter.checkpoints_req.rate</key> + </item> + </graph_item> + <graph_item> + <sortorder>2</sortorder> + <color>F63100</color> + <yaxisside>RIGHT</yaxisside> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.bgwriter.checkpoint_sync_time</key> + </item> + </graph_item> + <graph_item> + <sortorder>3</sortorder> + <color>A54F10</color> + <yaxisside>RIGHT</yaxisside> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.bgwriter.checkpoint_write_time</key> + </item> + </graph_item> + </graph_items> + </graph> + <graph> + <name>PostgreSQL connections</name> + <ymin_type_1>FIXED</ymin_type_1> + <graph_items> + <graph_item> + <drawtype>GRADIENT_LINE</drawtype> + <color>1A7C11</color> + <yaxisside>RIGHT</yaxisside> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.connections.sum.total</key> + </item> + </graph_item> + <graph_item> + <sortorder>1</sortorder> + <color>2774A4</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.connections.sum.total_pct</key> + </item> + </graph_item> + <graph_item> + <sortorder>2</sortorder> + <color>F63100</color> + <yaxisside>RIGHT</yaxisside> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.connections.sum.active</key> + </item> + </graph_item> + <graph_item> + <sortorder>3</sortorder> + <color>A54F10</color> + <yaxisside>RIGHT</yaxisside> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.connections.sum.idle</key> + </item> + </graph_item> + <graph_item> + <sortorder>4</sortorder> + <color>FC6EA3</color> + <yaxisside>RIGHT</yaxisside> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.connections.sum.idle_in_transaction</key> + </item> + </graph_item> + <graph_item> + <sortorder>5</sortorder> + <color>6C59DC</color> + <yaxisside>RIGHT</yaxisside> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.connections.sum.prepared</key> + </item> + </graph_item> + <graph_item> + <sortorder>6</sortorder> + <color>AC8C14</color> + <yaxisside>RIGHT</yaxisside> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.connections.sum.waiting</key> + </item> + </graph_item> + </graph_items> + </graph> + <graph> + <name>PostgreSQL ping</name> + <ymin_type_1>FIXED</ymin_type_1> + <graph_items> + <graph_item> + <drawtype>GRADIENT_LINE</drawtype> + <color>1A7C11</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.ping["{$PG.HOST}","{$PG.PORT}"]</key> + </item> + </graph_item> + <graph_item> + <sortorder>1</sortorder> + <color>2774A4</color> + <yaxisside>RIGHT</yaxisside> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.ping.time["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </item> + </graph_item> + </graph_items> + </graph> + <graph> + <name>PostgreSQL replication lag</name> + <ymin_type_1>FIXED</ymin_type_1> + <graph_items> + <graph_item> + <color>1A7C11</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.replication.lag.sec["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </item> + </graph_item> + </graph_items> + </graph> + <graph> + <name>PostgreSQL transactions</name> + <ymin_type_1>FIXED</ymin_type_1> + <graph_items> + <graph_item> + <color>1A7C11</color> + <yaxisside>RIGHT</yaxisside> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.transactions.active</key> + </item> + </graph_item> + <graph_item> + <sortorder>1</sortorder> + <color>2774A4</color> + <yaxisside>RIGHT</yaxisside> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.transactions.idle</key> + </item> + </graph_item> + <graph_item> + <sortorder>2</sortorder> + <color>F63100</color> + <yaxisside>RIGHT</yaxisside> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.transactions.prepared</key> + </item> + </graph_item> + <graph_item> + <sortorder>3</sortorder> + <color>A54F10</color> + <yaxisside>RIGHT</yaxisside> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.transactions.waiting</key> + </item> + </graph_item> + </graph_items> + </graph> + <graph> + <name>PostgreSQL uptime</name> + <show_triggers>NO</show_triggers> + <ymin_type_1>FIXED</ymin_type_1> + <graph_items> + <graph_item> + <color>1A7C11</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.uptime["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </item> + </graph_item> + <graph_item> + <sortorder>1</sortorder> + <color>2774A4</color> + <yaxisside>RIGHT</yaxisside> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.cache.hit["{$PG.HOST}","{$PG.PORT}","{$PG.USER}","{$PG.PASSWORD}","{$PG.DB}"]</key> + </item> + </graph_item> + </graph_items> + </graph> + <graph> + <name>PostgreSQL WAL</name> + <ymin_type_1>FIXED</ymin_type_1> + <graph_items> + <graph_item> + <color>1A7C11</color> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.wal.write</key> + </item> + </graph_item> + <graph_item> + <sortorder>1</sortorder> + <color>2774A4</color> + <yaxisside>RIGHT</yaxisside> + <item> + <host>Template DB PostgreSQL by user parameters</host> + <key>pgsql.wal.count</key> + </item> + </graph_item> + </graph_items> + </graph> + </graphs> + <value_maps> + <value_map> + <name>PostgreSQL recovery role</name> + <mappings> + <mapping> + <value>0</value> + <newvalue>Master</newvalue> + </mapping> + <mapping> + <value>1</value> + <newvalue>Standby</newvalue> + </mapping> + </mappings> + </value_map> + <value_map> + <name>PostgreSQL replication status</name> + <mappings> + <mapping> + <value>0</value> + <newvalue>Down</newvalue> + </mapping> + <mapping> + <value>1</value> + <newvalue>Up</newvalue> + </mapping> + <mapping> + <value>2</value> + <newvalue>Master</newvalue> + </mapping> + </mappings> + </value_map> + <value_map> + <name>Service state</name> + <mappings> + <mapping> + <value>0</value> + <newvalue>Down</newvalue> + </mapping> + <mapping> + <value>1</value> + <newvalue>Up</newvalue> + </mapping> + </mappings> + </value_map> + </value_maps> +</zabbix_export>