diff --git a/pgmon_templates.yaml b/pgmon_templates.yaml new file mode 100644 index 0000000..63c9ac4 --- /dev/null +++ b/pgmon_templates.yaml @@ -0,0 +1,646 @@ +zabbix_export: + version: '6.4' + template_groups: + - uuid: b9390195ecad4986968746a2a9b56354 + name: 'My Templates' + templates: + - uuid: f93f2a3535a74718b28ee81cf88cdab9 + template: 'PostgreSQL by pgmon' + name: 'PostgreSQL by pgmon' + description: 'Monitor PostgreSQL using pgmon' + groups: + - name: 'My Templates' + items: + - uuid: 818721b38324495a949cfe8c10a00eec + name: 'Max Frozen XID Age' + key: 'pgmon[max_frozen_age]' + description: 'Maximum age of any frozen XID in any database' + tags: + - tag: Application + value: PostgreSQL + - uuid: e73d02840f4043288f5fe5cc8b7c997b + name: 'PostgreSQL version' + key: 'pgmon[version]' + delay: 1h + description: 'PostgreSQL Server version number' + tags: + - tag: Application + value: PostgreSQL + discovery_rules: + - uuid: 35222acc25d34e008edd88f6b6ff7ad7 + name: 'Discover Databases' + key: 'pgmon[discover_dbs]' + delay: 10m + item_prototypes: + - uuid: 4bd8ecf7677a4eed97409ed86d8d0e64 + name: 'Database Stats for {#DBNAME}' + key: 'pgmon[db_stats,datname={#DBNAME}]' + history: '0' + trends: '0' + value_type: TEXT + tags: + - tag: Application + value: PostgreSQL + - uuid: 98efbb23589b4de6ae95ab61d08c78b0 + name: 'Time spent executing statements on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_db[active_time,{#DBNAME}]' + delay: '0' + value_type: FLOAT + units: s + description: 'Time spent executing SQL statements in this database, in milliseconds (this corresponds to the states active and fastpath function call in pg_stat_activity)' + preprocessing: + - type: JSONPATH + parameters: + - $.active_time + - type: MULTIPLIER + parameters: + - '0.001' + master_item: + key: 'pgmon[db_stats,datname={#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - uuid: c8e998f898b64af3b6452313d4bb8573 + name: 'Number of backends on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_db[backends,{#DBNAME}]' + delay: '0' + description: 'Number of backends currently connected to this database, or NULL for shared objects. This is the only column in this view that returns a value reflecting current state; all other columns return the accumulated values since the last reset.' + preprocessing: + - type: JSONPATH + parameters: + - $.numbackends + master_item: + key: 'pgmon[db_stats,datname={#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - uuid: 569ed1c8849747a9b5b90ff2d859ea89 + name: 'Blocks hit on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_db[blks_hit,{#DBNAME}]' + delay: '0' + description: 'Number of times disk blocks were found already in the buffer cache, so that a read was not necessary (this only includes hits in the PostgreSQL buffer cache, not the operating system''s file system cache)' + preprocessing: + - type: JSONPATH + parameters: + - $.blks_hit + master_item: + key: 'pgmon[db_stats,datname={#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - uuid: 88a3eebdf53b43c0b8b8ef60aba56116 + name: 'Blocks read on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_db[blks_read,{#DBNAME}]' + delay: '0' + description: 'Number of disk blocks read in this database' + preprocessing: + - type: JSONPATH + parameters: + - $.blks_read + master_item: + key: 'pgmon[db_stats,datname={#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - uuid: 05a62cf75aa34435bb8275d4b84875bb + name: 'Time spent reading blocks on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_db[blk_read_time,{#DBNAME}]' + delay: '0' + value_type: FLOAT + units: s + description: 'Time spent reading data file blocks by backends in this database, in milliseconds (if track_io_timing is enabled, otherwise zero)' + preprocessing: + - type: JSONPATH + parameters: + - $.blk_read_time + - type: MULTIPLIER + parameters: + - '0.001' + master_item: + key: 'pgmon[db_stats,datname={#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - uuid: 51ae24232a3d484a9fe6bdc0edc5ec96 + name: 'Time spent writing blocks on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_db[blk_write_time,{#DBNAME}]' + delay: '0' + value_type: FLOAT + units: s + description: 'Time spent writing data file blocks by backends in this database, in milliseconds (if track_io_timing is enabled, otherwise zero)' + preprocessing: + - type: JSONPATH + parameters: + - $.blk_write_time + - type: MULTIPLIER + parameters: + - '0.001' + master_item: + key: 'pgmon[db_stats,datname={#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - uuid: bfae7ca4d10f497694b799d5abf15de8 + name: 'Total number of checksum failures on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_db[checksum_failures,{#DBNAME}]' + delay: '0' + description: 'Number of data page checksum failures detected in this database (or on a shared object), or NULL if data checksums are not enabled.' + preprocessing: + - type: JSONPATH + parameters: + - $.checksum_failures + - type: MATCHES_REGEX + parameters: + - '^[0-9]+$' + error_handler: CUSTOM_VALUE + error_handler_params: '0' + master_item: + key: 'pgmon[db_stats,datname={#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - uuid: eb72f62ae8b24c2688a9832ed5f51792 + name: 'Total number of conflicts on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_db[conflicts,{#DBNAME}]' + delay: '0' + description: 'Number of queries canceled due to conflicts with recovery in this database. (Conflicts occur only on standby servers; see pg_stat_database_conflicts for details.)' + preprocessing: + - type: JSONPATH + parameters: + - $.conflicts + master_item: + key: 'pgmon[db_stats,datname={#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - uuid: 5a039ddd9f27497a818e145bb912fe25 + name: 'Total number of deadlocks on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_db[deadlocks,{#DBNAME}]' + delay: '0' + description: 'Number of deadlocks detected in this database' + preprocessing: + - type: JSONPATH + parameters: + - $.deadlocks + master_item: + key: 'pgmon[db_stats,datname={#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - uuid: f2d1c3c0540a4f2da0e48260b1ce556b + name: 'Time spent in idle transactions on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_db[idle_in_transaction_time,{#DBNAME}]' + delay: '0' + value_type: FLOAT + units: s + description: 'Time spent idling while in a transaction in this database, in milliseconds (this corresponds to the states idle in transaction and idle in transaction (aborted) in pg_stat_activity)' + preprocessing: + - type: JSONPATH + parameters: + - $.idle_in_transaction_time + - type: MULTIPLIER + parameters: + - '0.001' + master_item: + key: 'pgmon[db_stats,datname={#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - uuid: f52b9b40acac43b8aa130c7c7ba7c55e + name: 'Total number of sessions on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_db[sessions,{#DBNAME}]' + delay: '0' + units: b + description: 'Total number of sessions established to this database' + preprocessing: + - type: JSONPATH + parameters: + - $.sessions + master_item: + key: 'pgmon[db_stats,datname={#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - uuid: 7dfe2f7842e14967bf48fb73f90f5568 + name: 'Total number of abandoned sessions on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_db[sessions_abandoned,{#DBNAME}]' + delay: '0' + units: b + description: 'Number of database sessions to this database that were terminated because connection to the client was lost' + preprocessing: + - type: JSONPATH + parameters: + - $.sessions_abandoned + master_item: + key: 'pgmon[db_stats,datname={#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - uuid: e8bb24eba9c04d7b9bff05798d751f6f + name: 'Total number of fatal sessions on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_db[sessions_fatal,{#DBNAME}]' + delay: '0' + units: b + description: 'Number of database sessions to this database that were terminated by fatal errors' + preprocessing: + - type: JSONPATH + parameters: + - $.sessions_fatal + master_item: + key: 'pgmon[db_stats,datname={#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - uuid: aaf735d7125c494e9dfc504f3ebbc7e4 + name: 'Total number of terminated sessions on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_db[sessions_killed,{#DBNAME}]' + delay: '0' + units: b + description: 'Number of database sessions to this database that were terminated by operator intervention' + preprocessing: + - type: JSONPATH + parameters: + - $.sessions_killed + master_item: + key: 'pgmon[db_stats,datname={#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - uuid: 58ede113f9ab46188239b5fa094107a2 + name: 'Total temp file size on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_db[temp_bytes,{#DBNAME}]' + delay: '0' + units: b + description: 'Total amount of data written to temporary files by queries in this database. All temporary files are counted, regardless of why the temporary file was created, and regardless of the log_temp_files setting.' + preprocessing: + - type: JSONPATH + parameters: + - $.temp_bytes + master_item: + key: 'pgmon[db_stats,datname={#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - uuid: 3e837ab01d904d1fb10c50b843ffb25e + name: 'Total number of temp files on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_db[temp_files,{#DBNAME}]' + delay: '0' + description: 'Number of temporary files created by queries in this database. All temporary files are counted, regardless of why the temporary file was created (e.g., sorting or hashing), and regardless of the log_temp_files setting.' + preprocessing: + - type: JSONPATH + parameters: + - $.temp_files + master_item: + key: 'pgmon[db_stats,datname={#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - uuid: 5eade95d8a374122b2e5ab861c179918 + name: 'Tuples deleted on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_db[tup_deleted,{#DBNAME}]' + delay: '0' + description: 'Number of rows deleted by queries in this database' + preprocessing: + - type: JSONPATH + parameters: + - $.tup_deleted + master_item: + key: 'pgmon[db_stats,datname={#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - uuid: 40992ae903c64104ad719365575f7ac9 + name: 'Tuples fetched by index scans on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_db[tup_fetched,{#DBNAME}]' + delay: '0' + description: 'Number of live rows fetched by index scans in this database' + preprocessing: + - type: JSONPATH + parameters: + - $.tup_fetched + master_item: + key: 'pgmon[db_stats,datname={#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - uuid: 8f317cab436b429b8898643c9b36ab71 + name: 'Tuples inserted on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_db[tup_inserted,{#DBNAME}]' + delay: '0' + description: 'Number of rows inserted by queries in this database' + preprocessing: + - type: JSONPATH + parameters: + - $.tup_inserted + master_item: + key: 'pgmon[db_stats,datname={#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - uuid: cb791a01a44840e8ad355411e3ce41be + name: 'Tuples returned by sequential scans on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_db[tup_retruned,{#DBNAME}]' + delay: '0' + description: 'Number of live rows fetched by sequential scans and index entries returned by index scans in this database' + preprocessing: + - type: JSONPATH + parameters: + - $.tup_returned + master_item: + key: 'pgmon[db_stats,datname={#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - uuid: cc8da1b703c9424d8b08e55e61c3dd23 + name: 'Tuples updated on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_db[tup_updated,{#DBNAME}]' + delay: '0' + description: 'Number of rows updated by queries in this database' + preprocessing: + - type: JSONPATH + parameters: + - $.tup_updated + master_item: + key: 'pgmon[db_stats,datname={#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - uuid: e0b4c77f621b49c590f1b73d3f6bbd8a + name: 'Total number of commits on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_db[xact_commit,{#DBNAME}]' + delay: '0' + description: 'Number of transactions in this database that have been committed' + preprocessing: + - type: JSONPATH + parameters: + - $.xact_commit + master_item: + key: 'pgmon[db_stats,datname={#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - uuid: 016eb3789cc84340bfeee252073317ac + name: 'Total number of rollbacks on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_db[xact_rollback,{#DBNAME}]' + delay: '0' + description: 'Number of transactions in this database that have been rolled back' + preprocessing: + - type: JSONPATH + parameters: + - $.xact_rollback + master_item: + key: 'pgmon[db_stats,datname={#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - uuid: 3f2b24137fab474fbe3e7c66b82e68f0 + name: 'Tuples fetched by index scans on {#DBNAME} - 1h delta' + type: CALCULATED + key: 'pgmon_db_delta[tup_fetched,1h,{#DBNAME}]' + delay: 10m + params: 'last(//pgmon_db[tup_fetched,{#DBNAME}]) - last(//pgmon_db[tup_fetched,{#DBNAME}], #1:now-1h)' + tags: + - tag: Application + value: PostgreSQL + - uuid: 73bcb7f2272f4277ae64624f88a42d16 + name: 'Tuples fetched by index scans on {#DBNAME} - 1m delta' + type: CALCULATED + key: 'pgmon_db_delta[tup_fetched,1m,{#DBNAME}]' + params: 'last(//pgmon_db[tup_fetched,{#DBNAME}]) - last(//pgmon_db[tup_fetched,{#DBNAME}], #1:now-1m)' + tags: + - tag: Application + value: PostgreSQL + - uuid: be104f19788a40b98ddffa390448fb96 + name: 'Tuples fetched by index scans on {#DBNAME} - 5m delta' + type: CALCULATED + key: 'pgmon_db_delta[tup_fetched,5m,{#DBNAME}]' + params: 'last(//pgmon_db[tup_fetched,{#DBNAME}]) - last(//pgmon_db[tup_fetched,{#DBNAME}], #1:now-5m)' + tags: + - tag: Application + value: PostgreSQL + - uuid: 9516e42e590e430e96d8df9d71e55fad + name: 'Tuples returned by sequential scans on {#DBNAME} - 1h delta' + type: CALCULATED + key: 'pgmon_db_delta[tup_returned,1h,{#DBNAME}]' + delay: 10m + params: 'last(//pgmon_db[tup_returned,{#DBNAME}]) - last(//pgmon_db[tup_returned,{#DBNAME}], #1:now-1h)' + tags: + - tag: Application + value: PostgreSQL + - uuid: 4b361814e2e2414d8ee589f00330cc79 + name: 'Tuples returned by sequential scans on {#DBNAME} - 1m delta' + type: CALCULATED + key: 'pgmon_db_delta[tup_returned,1m,{#DBNAME}]' + delay: 10m + params: 'last(//pgmon_db[tup_returned,{#DBNAME}]) - last(//pgmon_db[tup_returned,{#DBNAME}], #1:now-1m)' + tags: + - tag: Application + value: PostgreSQL + - uuid: 77204dc6d31e465eab99e780ea647a78 + name: 'Tuples returned by sequential scans on {#DBNAME} - 5m delta' + type: CALCULATED + key: 'pgmon_db_delta[tup_returned,5m,{#DBNAME}]' + delay: 10m + params: 'last(//pgmon_db[tup_returned,{#DBNAME}]) - last(//pgmon_db[tup_returned,{#DBNAME}], #1:now-5m)' + tags: + - tag: Application + value: PostgreSQL + lld_macro_paths: + - lld_macro: '{#DBNAME}' + path: $.datname + - uuid: fd2db56cbc4d4ad38595d51a8f5c1d1b + name: 'Discover Replication' + key: 'pgmon[discover_rep]' + delay: 10m + item_prototypes: + - uuid: 127c3e28248e4b2bb0937e5ea34cc847 + name: 'Replication Stats for {#REPID}' + key: 'pgmon[rep_stats,repid={#REPID}]' + history: '0' + trends: '0' + value_type: TEXT + - uuid: 333f6f3c7ae749d998ea3e679f52fee1 + name: 'Flush lag for {#REPID}' + type: DEPENDENT + key: 'pgmon_rep[flush_lag,repid={#REPID}]' + delay: '0' + value_type: FLOAT + description: 'Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written and flushed it (but not yet applied it). This can be used to gauge the delay that synchronous_commit level on incurred while committing if this server was configured as a synchronous standby.' + preprocessing: + - type: JSONPATH + parameters: + - $.flush_lag + master_item: + key: 'pgmon[rep_stats,repid={#REPID}]' + tags: + - tag: Application + value: PostgreSQL + - tag: Component + value: Replication + - uuid: 42303bb6d62c4288a19049352a0752d7 + name: 'Last flush LSN for {#REPID}' + type: DEPENDENT + key: 'pgmon_rep[flush_lsn,repid={#REPID}]' + delay: '0' + trends: '0' + value_type: TEXT + description: 'Last write-ahead log location flushed to disk by this standby server' + preprocessing: + - type: JSONPATH + parameters: + - $.flush_lsn + master_item: + key: 'pgmon[rep_stats,repid={#REPID}]' + tags: + - tag: Application + value: PostgreSQL + - tag: Component + value: Replication + - uuid: 5838b1afd66e4063b793ee4b597e89fa + name: 'Replay lag for {#REPID}' + type: DEPENDENT + key: 'pgmon_rep[replay_lag,repid={#REPID}]' + delay: '0' + value_type: FLOAT + description: 'Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written, flushed and applied it. This can be used to gauge the delay that synchronous_commit level remote_apply incurred while committing if this server was configured as a synchronous standby.' + preprocessing: + - type: JSONPATH + parameters: + - $.replay_lag + master_item: + key: 'pgmon[rep_stats,repid={#REPID}]' + tags: + - tag: Application + value: PostgreSQL + - tag: Component + value: Replication + - uuid: 9fdd3add95b04e65ba4e14f1fa2af864 + name: 'Last replay LSN for {#REPID}' + type: DEPENDENT + key: 'pgmon_rep[replay_lsn,repid={#REPID}]' + delay: '0' + trends: '0' + value_type: TEXT + description: 'Last write-ahead log location replayed into the database on this standby server' + preprocessing: + - type: JSONPATH + parameters: + - $.replay_lsn + master_item: + key: 'pgmon[rep_stats,repid={#REPID}]' + tags: + - tag: Application + value: PostgreSQL + - tag: Component + value: Replication + - uuid: 2c8088ff43c548e2b30511468a0446aa + name: 'Last sent LSN for {#REPID}' + type: DEPENDENT + key: 'pgmon_rep[sent_lsn,repid={#REPID}]' + delay: '0' + trends: '0' + value_type: TEXT + description: 'Last write-ahead log location sent on this connection' + preprocessing: + - type: JSONPATH + parameters: + - $.sent_lsn + master_item: + key: 'pgmon[rep_stats,repid={#REPID}]' + tags: + - tag: Application + value: PostgreSQL + - tag: Component + value: Replication + - uuid: 1f3371bfd3d84af8aca6080024dc14aa + name: 'Replication state for {#REPID}' + type: DEPENDENT + key: 'pgmon_rep[state,repid={#REPID}]' + delay: '0' + trends: '0' + value_type: TEXT + description: | + Current WAL sender state. Possible values are: + * startup: This WAL sender is starting up. + * catchup: This WAL sender's connected standby is catching up with the primary. + * streaming: This WAL sender is streaming changes after its connected standby server has caught up with the primary. + * backup: This WAL sender is sending a backup. + * stopping: This WAL sender is stopping. + preprocessing: + - type: JSONPATH + parameters: + - $.state + master_item: + key: 'pgmon[rep_stats,repid={#REPID}]' + tags: + - tag: Application + value: PostgreSQL + - tag: Component + value: Replication + - uuid: 69bfddf63bba4740a3ddc1d729eac0f4 + name: 'Write lag for {#REPID}' + type: DEPENDENT + key: 'pgmon_rep[write_lag,repid={#REPID}]' + delay: '0' + value_type: FLOAT + description: 'Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written it (but not yet flushed it or applied it). This can be used to gauge the delay that synchronous_commit level remote_write incurred while committing if this server was configured as a synchronous standby.' + preprocessing: + - type: JSONPATH + parameters: + - $.write_lag + master_item: + key: 'pgmon[rep_stats,repid={#REPID}]' + tags: + - tag: Application + value: PostgreSQL + - tag: Component + value: Replication + - uuid: 53185c929b8c430e854d7ffb28a9ce8f + name: 'Last write LSN for {#REPID}' + type: DEPENDENT + key: 'pgmon_rep[write_lsn,repid={#REPID}]' + delay: '0' + trends: '0' + value_type: TEXT + description: 'Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written it (but not yet flushed it or applied it). This can be used to gauge the delay that synchronous_commit level remote_write incurred while committing if this server was configured as a synchronous standby.' + preprocessing: + - type: JSONPATH + parameters: + - $.write_lsn + master_item: + key: 'pgmon[rep_stats,repid={#REPID}]' + tags: + - tag: Application + value: PostgreSQL + - tag: Component + value: Replication + lld_macro_paths: + - lld_macro: '{#CLIENT_ADDR}' + path: $.client_addr + - lld_macro: '{#REPID}' + path: $.repid + - lld_macro: '{#STATE}' + path: $.state