I have a question about monitoring of MySQL replication and in particular about alerting using Grafana/Prometheus.
We have 2 MySQL(MariaDB to be exact) instances for which replication is configured: One Master and one Slave. They can change roles and Master an become Slave and vice versa from time to time (I use MariaDB Maxscale proxy which makes this switch very easy)
I want to monitor replication status and delay between master and slave. I've installed mysqld_exporter for that and I see data in Grafana now. But I would like also to send alerts in case when replication is not working or when slave is not caching up with master for some reason.
The question: how to configure alerting for the scenario above for the case when MAster and Replica can switch roles.
Perhaps there are some articles on this topic (I haven't found though)
If the setup is static - I think I can configure alerts, but how to handle the dynamic setup? Thanks a lot!
P.S. For now I have found following resources, but none of them tells on how to handle alerting for dynamic setup