APMIA PostgreSQL Extension checkpoint custom metrics
Implementation of APMIA Infrastructure Agent PostgreSQL Extension custom metrics for checkpoint. This is for better monitoring of checkpoint.
Please take the following steps for the implementation of APMIA Infrastructure Agent PostgreSQL Extension custom metrics for better checkpoint monitoring.
custom metrics for checkpoint:
For average `checkpoint_write_time` (custom query):
SELECT
ROUND(checkpoint_write_time::numeric / (checkpoints_timed + checkpoints_req), 2) AS avg_write_time_ms
FROM pg_stat_bgwriter;
Take the following steps:
1- stop APMIA agent
2- make a backup copy of <apmia-home>/extensions/PostgreSQL-dd040260xt330-<version>/config/schema.json
3- Add the following statements.
{
"query": "SELECT ROUND(checkpoint_write_time::numeric / (checkpoints_timed + checkpoints_req), 2) AS avg_write_time_ms FROM pg_stat_bgwriter",
"metrics": [
{
"metricPath": [
{
"name": "Checkpoints:Average Checkpoint Write Time (ms)"
}
],
"metricType": "LongFluctuatingCounter",
"metricValue": "$.resultSet[0].avg_write_time_ms"
}
]
},
You can add the above block close to the following query block in the schema.json file.
"query": "SELECT * from pg_stat_bgwriter",
4- start APMIA agent
5- custom metric "Average Checkpoint Write Time" should be reporting value under following path.
SuperDomain|<host/node>|Infrastructure|Agent|Postgres Databases|<host/IP>|postgres|Checkpoints:Average Checkpoint Write Time (ms)