Open PMM Server
page, as shown in FIG point into Alerting -> Notification channels
Nails input information, and Save Test
The test results, no problem
How to use the alarm granafa do it? Casually points to open a monitored item, I'm here for galera cluster size
example.
Click Alert
as shown in Figure
Emphasis Conditions
, here is an expression I set
avg() query(C,5m,now) 3 - 3
AVG () Meaning: the average period of the panel
probably means that the average over five minutes to be in the 3-3 range. Otherwise an alarm.
This is the warning notes
The effect is as:
Common error
When prompted to add Alert template variables are not supported in alert queries
official reply:
https://github.com/grafana/grafana/issues/9334
Template variables are not supported in alerting.
Template variables should be used for discovery and drill down. Not controlling alert rules
Approach:
copy this Dashboard of json, the inside of the variables are replaced by constants.
Examples are as follows:
the original
"expr": "max_over_time(mysql_global_status_wsrep_cluster_size{instance=~\"$host\"}[$interval]) or\nmax_over_time(mysql_global_status_wsrep_cluster_size{instance=~\"$host\"}[5m])",
Changed
"expr": "max_over_time(mysql_global_status_wsrep_cluster_size{instance=~\"pxc1\"}[1m])
or\nmax_over_time(mysql_global_status_wsrep_cluster_size{instance=~\"pxc1\"}[5m])",
And then re-added to the alarm.