I have a PostgreSQL database with 1…n slave DBs that get replicated from master DB.
Each slave DB creates a replication slot entry on the Master DB.
I want to visualise now in Grafana the replication lag of each slot that I can see on the master db in one Grafana chart.
The data I have inside a PostgreSQL table (pg_replication_slots plus some SQL on it ) is
slot_name (string) slot_active (bool) replication_lag int
I use Telegraph with PostgreSQL-Extensible input plugin to extract that data and write it to InfluxDB.
For each scan cycle I get now 1…n rows (depending on the number of slave DBs that exist)
slave1slot, true, 10 slave2slot, true, 20 slave3slot, false, 2000
As global tag I have defined the UUID of the database as $ID to tag the data.
Where I am stuck is how do I get this data inside once chart.
The chart should show on x-axis the time and on y-axis the replication lag (int).
For each slaveNslot there should be one line that displays the replication lag over time and the legend should show the slot name as a string
Ideally the slot name should be color coded red/green depending on the bool value of slot_active
Is it possible to create such a graph and if yes, please give me a short advice how it could be built.
I will then dig inside and try to create it …
(Basic knowledge is available on my end, all other charts I need I have build so far … just on this one I am stuck
Man thanks in advance