You can try This way to Add New Matrics
Step : 1 Prepare your data souce with Actual/Dummy Data using Postgres
that lookkile this
Vacuum Activity
autovacuum_count INTEGER,
manual_vacuum_count INTEGER,
Index Usage
total_seq_scans BIGINT,
total_index_scans BIGINT,
Connection Pooling
active_connections INTEGER,
idle_connections INTEGER
);
Step : 2 Add panel for Vaccum Activity and apply below write query
SELECT
now() as time,
schemaname || '.' || relname as table,
last_vacuum,
last_autovacuum
FROM
pg_stat_user_tables
ORDER BY
last_autovacuum DESC
Use Table panel
Optional: Add a threshold or annotation if last_autovacuum is older than N hours/days
Step : 3 Add Panel for Index Usage
SELECT
now() as time,
relname as table,
idx_scan,
seq_scan,
CASE
WHEN (seq_scan + idx_scan) = 0 THEN 0
ELSE ROUND(100.0 * idx_scan / (seq_scan + idx_scan), 2)
END AS index_usage_percent
FROM
pg_stat_user_tables
ORDER BY
index_usage_percent ASC
Use Bar Chart or Table
Highlight tables with low index usage (<20%)
Step : 4 Add Panel for Connection Pooling
Monitor total, active, idle, and waiting connections
SELECT
now() as time,
state,
count(*) as connections
FROM
pg_stat_activity
GROUP BY
state
Use Pie chart or Bar graph
Set alerts for:
state = 'active' crossing a threshold (e.g., 80% of max_connections)
Too many idle connections (may indicate leakage)
Step : 5 Set Alert Thresholds (Optional but Recommended)
SELECT
now() - last_autovacuum AS vacuum_lag
FROM
pg_stat_user_tables
WHERE
last_autovacuum IS NOT NULL
ORDER BY
vacuum_lag DESC
LIMIT 1
Set an alert if lag exceeds a threshold (e.g., 12 hours)
SELECT
COUNT(*)::float / setting::float * 100 as connection_usage_percent
FROM
pg_stat_activity,
pg_settings
WHERE
name = 'max_connections'
Alert if usage > 80%
FINAL OUTPUT Look like