From e7b97a9e88c6ef47dd99312e7f26f57a75d4cf9d Mon Sep 17 00:00:00 2001 From: James Campbell Date: Fri, 17 Oct 2025 01:24:33 -0400 Subject: [PATCH] Add items to template * Add items to the Zabbix template for: - Backgroubd writer / checkpoint stats - Lock stats - Connection states --- sample-config/pgmon-metrics.yml | 2 + zabbix_templates/pgmon_templates.yaml | 507 ++++++++++++++++++++++++++ 2 files changed, 509 insertions(+) diff --git a/sample-config/pgmon-metrics.yml b/sample-config/pgmon-metrics.yml index b20662c..92b83a2 100644 --- a/sample-config/pgmon-metrics.yml +++ b/sample-config/pgmon-metrics.yml @@ -318,3 +318,5 @@ metrics: type: value query: 0: SELECT count(*) AS ntables FROM pg_stat_user_tables + + #sequence_usage: diff --git a/zabbix_templates/pgmon_templates.yaml b/zabbix_templates/pgmon_templates.yaml index 1f552d1..260dec3 100644 --- a/zabbix_templates/pgmon_templates.yaml +++ b/zabbix_templates/pgmon_templates.yaml @@ -49,6 +49,206 @@ zabbix_export: tags: - tag: Application value: PostgreSQL + - uuid: 1dd74025ca0e463bb9eee5cb473f30db + name: 'Total buffers allocated' + type: DEPENDENT + key: 'pgmon.bgwriter[buffers_alloc,total]' + delay: '0' + history: 90d + description: 'Total number of shared buffers that have been allocated' + preprocessing: + - type: JSONPATH + parameters: + - $.buffers_alloc + master_item: + key: 'pgmon[bgwriter]' + tags: + - tag: Application + value: PostgreSQL + - uuid: 4ab405996e71444a8113b95c65d73be2 + name: 'Total buffers written by backends' + type: DEPENDENT + key: 'pgmon.bgwriter[buffers_backend,total]' + delay: '0' + history: 90d + description: 'Total number of shared buffers written by backends' + preprocessing: + - type: JSONPATH + parameters: + - $.buffers_backend + master_item: + key: 'pgmon[bgwriter]' + tags: + - tag: Application + value: PostgreSQL + - uuid: e8b440a1d6ff4ca6b3cb27e2e76f9d06 + name: 'Total number of fsyncs from backends' + type: DEPENDENT + key: 'pgmon.bgwriter[buffers_backend_fsync,total]' + delay: '0' + history: 90d + description: 'Total number of times backends have issued their own fsync calls' + preprocessing: + - type: JSONPATH + parameters: + - $.buffers_backend_fsync + master_item: + key: 'pgmon[bgwriter]' + tags: + - tag: Application + value: PostgreSQL + - uuid: f8a14885edf34b5cbf2e92432e8fa4c2 + name: 'Total buffers written during checkpoints' + type: DEPENDENT + key: 'pgmon.bgwriter[buffers_checkpoint,total]' + delay: '0' + history: 90d + description: 'Total number of shared buffers written during checkpoints' + preprocessing: + - type: JSONPATH + parameters: + - $.buffers_checkpoint + master_item: + key: 'pgmon[bgwriter]' + tags: + - tag: Application + value: PostgreSQL + - uuid: f09956f7aaad4b99b0d67339edf26dcf + name: 'Total buffers written by the background writer' + type: DEPENDENT + key: 'pgmon.bgwriter[buffers_clean,total]' + delay: '0' + history: 90d + description: 'Total number of shared buffers written by the background writer' + preprocessing: + - type: JSONPATH + parameters: + - $.buffers_clean + master_item: + key: 'pgmon[bgwriter]' + tags: + - tag: Application + value: PostgreSQL + - uuid: f1c6bd9346b14964bd492d7ccf8baf50 + name: 'Total checkpoints due to changes' + type: DEPENDENT + key: 'pgmon.bgwriter[checkpoints_changes,total]' + delay: '0' + history: 90d + description: 'Total number of checkpoints that have occurred due to the number of row changes' + preprocessing: + - type: JSONPATH + parameters: + - $.checkpoints_req + master_item: + key: 'pgmon[bgwriter]' + tags: + - tag: Application + value: PostgreSQL + - uuid: 04c4587d2f2f4f5fbad866d70938cbb3 + name: 'Total checkpoints due to time limit' + type: DEPENDENT + key: 'pgmon.bgwriter[checkpoints_timed,total]' + delay: '0' + history: 90d + description: 'Total number of checkpoints that have occurred due to the configured time limit' + preprocessing: + - type: JSONPATH + parameters: + - $.checkpoints_timed + master_item: + key: 'pgmon[bgwriter]' + tags: + - tag: Application + value: PostgreSQL + - uuid: 580a7e632b644aafa1166c534185ba92 + name: 'Total time spent syncing files for checkpoints' + type: DEPENDENT + key: 'pgmon.bgwriter[checkpoint_sync_time,total]' + delay: '0' + history: 90d + units: s + description: 'Total time spent syncing files for checkpoints' + preprocessing: + - type: JSONPATH + parameters: + - $.checkpoint_sync_time + - type: MULTIPLIER + parameters: + - '0.001' + master_item: + key: 'pgmon[bgwriter]' + tags: + - tag: Application + value: PostgreSQL + - uuid: 4faa33b55fae4fc68561020636573a46 + name: 'Total time spent writing checkpoints' + type: DEPENDENT + key: 'pgmon.bgwriter[checkpoint_write_time,total]' + delay: '0' + history: 90d + units: s + description: 'Total time spent writing checkpoints' + preprocessing: + - type: JSONPATH + parameters: + - $.checkpoint_write_time + - type: MULTIPLIER + parameters: + - '0.001' + master_item: + key: 'pgmon[bgwriter]' + tags: + - tag: Application + value: PostgreSQL + - uuid: c0c829c6cdc046a4b5d216e10362e4bb + name: 'Total number of times the background writer stopped' + type: DEPENDENT + key: 'pgmon.bgwriter[maxwritten_clean,total]' + delay: '0' + history: 90d + description: 'Total number of times the background writer stopped due to reaching the maximum number of buffers it''s allowed to write in a single scan' + preprocessing: + - type: JSONPATH + parameters: + - $.maxwritten_clean + master_item: + key: 'pgmon[bgwriter]' + tags: + - tag: Application + value: PostgreSQL + - uuid: 645fef7b55cd48c69b11de3201e88d78 + name: 'Number of locks' + type: DEPENDENT + key: pgmon.locks.count + delay: '0' + history: 90d + description: 'Total number of locks in any database' + preprocessing: + - type: JSONPATH + parameters: + - $.total + master_item: + key: 'pgmon[locks]' + tags: + - tag: Application + value: PostgreSQL + - uuid: a56ad753b1f341928867a47b14ed8b77 + name: 'Number of granted locks' + type: DEPENDENT + key: pgmon.locks.granted + delay: '0' + history: 90d + description: 'Total number of granted locks in any database' + preprocessing: + - type: JSONPATH + parameters: + - $.granted + master_item: + key: 'pgmon[locks]' + tags: + - tag: Application + value: PostgreSQL - uuid: de1fa757395440118026f4c7a7c4ebbe name: 'PostgreSQL latest supported version' type: DEPENDENT @@ -95,6 +295,21 @@ zabbix_export: tags: - tag: Application value: PostgreSQL + - uuid: 91baea76ebb240b19c5a5d3913d0b989 + name: 'PostgreSQL BGWriter Info' + type: HTTP_AGENT + key: 'pgmon[bgwriter]' + delay: 5m + history: '0' + value_type: TEXT + trends: '0' + description: 'Maximum age of any frozen XID and MXID in any database' + url: 'http://localhost:{$AGENT_PORT}/bgwriter' + tags: + - tag: Application + value: PostgreSQL + - tag: Type + value: Raw - uuid: 06b1d082ed1e4796bc31cc25f7db6326 name: 'PostgreSQL Backend IO Info' type: HTTP_AGENT @@ -124,6 +339,21 @@ zabbix_export: value: PostgreSQL - tag: Type value: Raw + - uuid: 4627c156923f4d53bc04789b9b88c133 + name: 'PostgreSQL Lock Info' + type: HTTP_AGENT + key: 'pgmon[locks]' + delay: 5m + history: '0' + value_type: TEXT + trends: '0' + description: 'Maximum age of any frozen XID and MXID in any database' + url: 'http://localhost:{$AGENT_PORT}/locks' + tags: + - tag: Application + value: PostgreSQL + - tag: Type + value: Raw - uuid: 8706eccb7edc4fa394f552fc31f401a9 name: 'PostgreSQL ID Age Info' type: HTTP_AGENT @@ -170,6 +400,283 @@ zabbix_export: enabled_lifetime_type: DISABLE_AFTER enabled_lifetime: 1d item_prototypes: + - uuid: 28d5fe3a4f6848149afed33aa645f677 + name: 'Max connection age: active on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_connection_states[active,age,{#DBNAME}]' + delay: '0' + history: 90d + value_type: FLOAT + description: 'Number of disk blocks read in this database' + preprocessing: + - type: JSONPATH + parameters: + - '$[?(@.state == "active")].max_state_time' + master_item: + key: 'pgmon_connection_states[{#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - tag: Database + value: '{#DBNAME}' + - uuid: ff1b817c3d1f43dc8b49bfd0dcb0d10a + name: 'Connection count: active on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_connection_states[active,count,{#DBNAME}]' + delay: '0' + history: 90d + description: 'Number of disk blocks read in this database' + preprocessing: + - type: JSONPATH + parameters: + - '$[?(@.state == "active")].backend_count' + master_item: + key: 'pgmon_connection_states[{#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - tag: Database + value: '{#DBNAME}' + - uuid: 4c0b9ca43adb45b895e3ba2e200e501e + name: 'Max connection age: disabled on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_connection_states[disabled,age,{#DBNAME}]' + delay: '0' + history: 90d + value_type: FLOAT + description: 'Number of disk blocks read in this database' + preprocessing: + - type: JSONPATH + parameters: + - '$[?(@.state == "disabled")].max_state_time' + master_item: + key: 'pgmon_connection_states[{#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - tag: Database + value: '{#DBNAME}' + - uuid: 280dfc9a84e8425399164e6f3e91cf92 + name: 'Connection count: disabled on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_connection_states[disabled,count,{#DBNAME}]' + delay: '0' + history: 90d + description: 'Number of disk blocks read in this database' + preprocessing: + - type: JSONPATH + parameters: + - '$[?(@.state == "disabled")].backend_count' + master_item: + key: 'pgmon_connection_states[{#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - tag: Database + value: '{#DBNAME}' + - uuid: 63e62108657f47aaa29f7ec6499e45fc + name: 'Max connection age: fastpath function call on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_connection_states[fastpath_function,age,{#DBNAME}]' + delay: '0' + history: 90d + value_type: FLOAT + description: 'Number of disk blocks read in this database' + preprocessing: + - type: JSONPATH + parameters: + - '$[?(@.state == "fastpath function call")].max_state_time' + master_item: + key: 'pgmon_connection_states[{#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - tag: Database + value: '{#DBNAME}' + - uuid: 33193e62f1ad4da5b2e30677581e5305 + name: 'Connection count: fastpath function call on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_connection_states[fastpath_function,count,{#DBNAME}]' + delay: '0' + history: 90d + description: 'Number of disk blocks read in this database' + preprocessing: + - type: JSONPATH + parameters: + - '$[?(@.state == "fastpath function call")].backend_count' + master_item: + key: 'pgmon_connection_states[{#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - tag: Database + value: '{#DBNAME}' + - uuid: 92e2366a56424bc18a88606417eae6e4 + name: 'Max connection age: idle on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_connection_states[idle,age,{#DBNAME}]' + delay: '0' + history: 90d + value_type: FLOAT + description: 'Number of disk blocks read in this database' + preprocessing: + - type: JSONPATH + parameters: + - '$[?(@.state == "idle")].max_state_time' + master_item: + key: 'pgmon_connection_states[{#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - tag: Database + value: '{#DBNAME}' + - uuid: 505bbbb4c7b745d8bab8f3b33705b76b + name: 'Connection count: idle on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_connection_states[idle,count,{#DBNAME}]' + delay: '0' + history: 90d + description: 'Number of disk blocks read in this database' + preprocessing: + - type: JSONPATH + parameters: + - '$[?(@.state == "idle")].backend_count' + master_item: + key: 'pgmon_connection_states[{#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - tag: Database + value: '{#DBNAME}' + - uuid: 282494d5900c4c2e8abd298160c7cbb6 + name: 'Max connection age: idle in transaction (aborted) on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_connection_states[idle_aborted,age,{#DBNAME}]' + delay: '0' + history: 90d + value_type: FLOAT + description: 'Number of disk blocks read in this database' + preprocessing: + - type: JSONPATH + parameters: + - '$[?(@.state == "idle in transaction (aborted)")].max_state_time' + master_item: + key: 'pgmon_connection_states[{#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - tag: Database + value: '{#DBNAME}' + - uuid: 0da5075d79234602836fc7967a31f1cc + name: 'Connection count: idle in transaction (aborted) on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_connection_states[idle_aborted,count,{#DBNAME}]' + delay: '0' + history: 90d + description: 'Number of disk blocks read in this database' + preprocessing: + - type: JSONPATH + parameters: + - '$[?(@.state == "idle in transaction (aborted)")].backend_count' + master_item: + key: 'pgmon_connection_states[{#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - tag: Database + value: '{#DBNAME}' + - uuid: 47aa3f7f4ff1473aae425b4c89472ab4 + name: 'Max connection age: idle in transaction on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_connection_states[idle_transaction,age,{#DBNAME}]' + delay: '0' + history: 90d + value_type: FLOAT + description: 'Number of disk blocks read in this database' + preprocessing: + - type: JSONPATH + parameters: + - '$[?(@.state == "idle in transaction")].max_state_time' + master_item: + key: 'pgmon_connection_states[{#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - tag: Database + value: '{#DBNAME}' + - uuid: 95519bf0aefd49799601e1bbb488ec90 + name: 'Connection count: idle in transaction on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_connection_states[idle_transaction,count,{#DBNAME}]' + delay: '0' + history: 90d + description: 'Number of disk blocks read in this database' + preprocessing: + - type: JSONPATH + parameters: + - '$[?(@.state == "idle in transaction")].backend_count' + master_item: + key: 'pgmon_connection_states[{#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - tag: Database + value: '{#DBNAME}' + - uuid: b2ae38a5733d49ceb1a31e774c11785b + name: 'Max connection age: starting on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_connection_states[starting,age,{#DBNAME}]' + delay: '0' + history: 90d + value_type: FLOAT + description: 'Number of disk blocks read in this database' + preprocessing: + - type: JSONPATH + parameters: + - '$[?(@.state == "starting")].max_state_time' + master_item: + key: 'pgmon_connection_states[{#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - tag: Database + value: '{#DBNAME}' + - uuid: c1890f2d7ce84a7ebaaadf266d3ffc51 + name: 'Connection count: starting on {#DBNAME}' + type: DEPENDENT + key: 'pgmon_connection_states[starting,count,{#DBNAME}]' + delay: '0' + history: 90d + description: 'Number of disk blocks read in this database' + preprocessing: + - type: JSONPATH + parameters: + - '$[?(@.state == "starting")].backend_count' + master_item: + key: 'pgmon_connection_states[{#DBNAME}]' + tags: + - tag: Application + value: PostgreSQL + - tag: Database + value: '{#DBNAME}' + - uuid: 131653f883f448a7b861b16bc4366dfd + name: 'Database Connection States for {#DBNAME}' + type: HTTP_AGENT + key: 'pgmon_connection_states[{#DBNAME}]' + history: '0' + value_type: TEXT + trends: '0' + url: 'http://localhost:{$AGENT_PORT}/activity' + query_fields: + - name: dbname + value: '{#DBNAME}' + tags: + - tag: Application + value: PostgreSQL + - tag: Database + value: '{#DBNAME}' + - tag: Type + value: Raw - uuid: a30babe4a6f4440bba2a3ee46eff7ce2 name: 'Time spent executing statements on {#DBNAME}' type: DEPENDENT