How to add alerts for mysql server uptime/restart/shutdown


I am adding alerts for mysql instance using followed article . I am seeing alert tab for mysql connection/ thread cache and for all other alerts, but not for MySQL uptime. Is there any way to add alert for MySQL uptime?

Hi ivishnu7 , I haven’t done this specific type of graph, but Prometheus allows for a metric called ‘up’, which is tracking whether mysqld_exporter is up. Perhaps you could create a graph using:


also metric exists, it is possible to create graph with this metric and add alert on it.

Thanks Michael and Mykola for update.

Notes from Grafana: Currently only the graph panel supports alert rules but this will be added to the Single stat and Table panels as well in a future release.

So as of now, we can’t use Grafana for server uptime/restart/shutdown alerts unless they add alerts for Single stats.

I am familiar with Grafana alerts set up but not with Prometheus alerts. So I am just going through how to add alerts using Prometheus. It would be great if share any useful documents regarding prometheus alerts set up. Thanks!

prometheus alerting is not user-friendly, you can read more in official documentation

Alerts in Grafana simpler (if you have graph for needed metric):