diff --git a/sample-config/pgmon-metrics.yml b/sample-config/pgmon-metrics.yml index 00f7e41..3c8e465 100644 --- a/sample-config/pgmon-metrics.yml +++ b/sample-config/pgmon-metrics.yml @@ -91,20 +91,20 @@ metrics: query: 160000: > SELECT backend_type, - COALESCE(SUM(reads), 0) AS reads, - COALESCE(SUM(read_time), 0) AS read_time, - COALESCE(SUM(writes), 0) AS writes, - COALESCE(SUM(write_time), 0) AS write_time, - COALESCE(SUM(writebacks), 0) AS writebacks, - COALESCE(SUM(writeback_time), 0) AS writeback_time, - COALESCE(SUM(extends), 0) AS extends, - COALESCE(SUM(extend_time), 0) AS extend_time, - COALESCE(SUM(op_bytes), 0) AS op_bytes, - COALESCE(SUM(hits), 0) AS hits, - COALESCE(SUM(evictions), 0) AS evictions, - COALESCE(SUM(reuses), 0) AS reuses, - COALESCE(SUM(fsyncs), 0) AS fsyncs, - COALESCE(SUM(fsync_time), 0) AS fsync_time + COALESCE(SUM(reads * op_bytes), 0)::bigint AS reads, + COALESCE(SUM(read_time), 0)::bigint AS read_time, + COALESCE(SUM(writes * op_bytes), 0)::bigint AS writes, + COALESCE(SUM(write_time), 0)::bigint AS write_time, + COALESCE(SUM(writebacks * op_bytes), 0)::bigint AS writebacks, + COALESCE(SUM(writeback_time), 0)::bigint AS writeback_time, + COALESCE(SUM(extends * op_bytes), 0)::bigint AS extends, + COALESCE(SUM(extend_time), 0)::bigint AS extend_time, + COALESCE(SUM(op_bytes), 0)::bigint AS op_bytes, + COALESCE(SUM(hits), 0)::bigint AS hits, + COALESCE(SUM(evictions), 0)::bigint AS evictions, + COALESCE(SUM(reuses), 0)::bigint AS reuses, + COALESCE(SUM(fsyncs), 0)::bigint AS fsyncs, + COALESCE(SUM(fsync_time), 0)::bigint AS fsync_time FROM pg_stat_io GROUP BY backend_type diff --git a/zabbix_templates/pgmon_templates.yaml b/zabbix_templates/pgmon_templates.yaml index 19a8ee9..997e1fa 100644 --- a/zabbix_templates/pgmon_templates.yaml +++ b/zabbix_templates/pgmon_templates.yaml @@ -924,6 +924,7 @@ zabbix_export: type: DEPENDENT key: 'pgmon_io_backend[extends,{#BACKEND_TYPE}]' delay: '0' + units: B preprocessing: - type: JSONPATH parameters: @@ -978,6 +979,7 @@ zabbix_export: type: DEPENDENT key: 'pgmon_io_backend[reads,{#BACKEND_TYPE}]' delay: '0' + units: B preprocessing: - type: JSONPATH parameters: @@ -1014,6 +1016,7 @@ zabbix_export: type: DEPENDENT key: 'pgmon_io_backend[writebacks,{#BACKEND_TYPE}]' delay: '0' + units: B preprocessing: - type: JSONPATH parameters: @@ -1032,6 +1035,7 @@ zabbix_export: type: DEPENDENT key: 'pgmon_io_backend[writes,{#BACKEND_TYPE}]' delay: '0' + units: B preprocessing: - type: JSONPATH parameters: @@ -1082,6 +1086,7 @@ zabbix_export: type: CALCULATED key: 'pgmon_io_backend_delta[extends,1h,{#BACKEND_TYPE}]' delay: 10m + units: B/h params: 'last(//pgmon_io_backend[extends,{#BACKEND_TYPE}]) - last(//pgmon_io_backend[extends,{#BACKEND_TYPE}], #1:now-1h)' tags: - tag: Application @@ -1096,6 +1101,7 @@ zabbix_export: key: 'pgmon_io_backend_delta[extends,{#BACKEND_TYPE}]' delay: '0' value_type: FLOAT + units: Bps preprocessing: - type: CHANGE_PER_SECOND parameters: @@ -1178,6 +1184,7 @@ zabbix_export: type: CALCULATED key: 'pgmon_io_backend_delta[reads,1h,{#BACKEND_TYPE}]' delay: 10m + units: B/h params: 'last(//pgmon_io_backend[reads,{#BACKEND_TYPE}]) - last(//pgmon_io_backend[reads,{#BACKEND_TYPE}], #1:now-1h)' tags: - tag: Application @@ -1192,6 +1199,7 @@ zabbix_export: key: 'pgmon_io_backend_delta[reads,{#BACKEND_TYPE}]' delay: '0' value_type: FLOAT + units: Bps preprocessing: - type: CHANGE_PER_SECOND parameters: @@ -1242,6 +1250,7 @@ zabbix_export: type: CALCULATED key: 'pgmon_io_backend_delta[writebacks,1h,{#BACKEND_TYPE}]' delay: 10m + units: B/h params: 'last(//pgmon_io_backend[writebacks,{#BACKEND_TYPE}]) - last(//pgmon_io_backend[writebacks,{#BACKEND_TYPE}], #1:now-1h)' tags: - tag: Application @@ -1256,6 +1265,7 @@ zabbix_export: key: 'pgmon_io_backend_delta[writebacks,{#BACKEND_TYPE}]' delay: '0' value_type: FLOAT + units: Bps preprocessing: - type: CHANGE_PER_SECOND parameters: @@ -1274,6 +1284,7 @@ zabbix_export: type: CALCULATED key: 'pgmon_io_backend_delta[writes,1h,{#BACKEND_TYPE}]' delay: 10m + units: B/h params: 'last(//pgmon_io_backend[writes,{#BACKEND_TYPE}]) - last(//pgmon_io_backend[writes,{#BACKEND_TYPE}], #1:now-1h)' tags: - tag: Application @@ -1288,6 +1299,7 @@ zabbix_export: key: 'pgmon_io_backend_delta[writes,{#BACKEND_TYPE}]' delay: '0' value_type: FLOAT + units: Bps preprocessing: - type: CHANGE_PER_SECOND parameters: @@ -1302,10 +1314,11 @@ zabbix_export: - tag: Component value: IO graph_prototypes: - - uuid: a1d95bcb43624c4abdfcb4aeb7d7d2b0 + - uuid: faf1e3f41dd84adba42c414f6efac152 name: 'Backend I/O for {#BACKEND_TYPE}' graph_items: - color: 199C0D + yaxisside: RIGHT calc_fnc: ALL item: host: 'PostgreSQL by pgmon' @@ -1318,12 +1331,14 @@ zabbix_export: key: 'pgmon_io_backend[extends,{#BACKEND_TYPE}]' - sortorder: '2' color: 2774A4 + yaxisside: RIGHT calc_fnc: ALL item: host: 'PostgreSQL by pgmon' key: 'pgmon_io_backend[fsyncs,{#BACKEND_TYPE}]' - sortorder: '3' color: F7941D + yaxisside: RIGHT calc_fnc: ALL item: host: 'PostgreSQL by pgmon' @@ -1336,6 +1351,7 @@ zabbix_export: key: 'pgmon_io_backend[reads,{#BACKEND_TYPE}]' - sortorder: '5' color: 6C59DC + yaxisside: RIGHT calc_fnc: ALL item: host: 'PostgreSQL by pgmon' @@ -1356,6 +1372,7 @@ zabbix_export: name: 'Backend I/O for {#BACKEND_TYPE} - 1h delta' graph_items: - color: 199C0D + yaxisside: RIGHT calc_fnc: ALL item: host: 'PostgreSQL by pgmon' @@ -1368,12 +1385,14 @@ zabbix_export: key: 'pgmon_io_backend_delta[extends,1h,{#BACKEND_TYPE}]' - sortorder: '2' color: 2774A4 + yaxisside: RIGHT calc_fnc: ALL item: host: 'PostgreSQL by pgmon' key: 'pgmon_io_backend_delta[fsyncs,1h,{#BACKEND_TYPE}]' - sortorder: '3' color: F7941D + yaxisside: RIGHT calc_fnc: ALL item: host: 'PostgreSQL by pgmon' @@ -1386,6 +1405,7 @@ zabbix_export: key: 'pgmon_io_backend_delta[reads,1h,{#BACKEND_TYPE}]' - sortorder: '5' color: 6C59DC + yaxisside: RIGHT calc_fnc: ALL item: host: 'PostgreSQL by pgmon' @@ -1406,6 +1426,7 @@ zabbix_export: name: 'Backend I/O Rates for {#BACKEND_TYPE}' graph_items: - color: 199C0D + yaxisside: RIGHT calc_fnc: ALL item: host: 'PostgreSQL by pgmon' @@ -1418,12 +1439,14 @@ zabbix_export: key: 'pgmon_io_backend_delta[extends,{#BACKEND_TYPE}]' - sortorder: '2' color: 2774A4 + yaxisside: RIGHT calc_fnc: ALL item: host: 'PostgreSQL by pgmon' key: 'pgmon_io_backend_delta[fsyncs,{#BACKEND_TYPE}]' - sortorder: '3' color: F7941D + yaxisside: RIGHT calc_fnc: ALL item: host: 'PostgreSQL by pgmon' @@ -1436,6 +1459,7 @@ zabbix_export: key: 'pgmon_io_backend_delta[reads,{#BACKEND_TYPE}]' - sortorder: '5' color: 6C59DC + yaxisside: RIGHT calc_fnc: ALL item: host: 'PostgreSQL by pgmon'