Configure PMM to monitor Mysql slave

I have PMM configured and successfully monitoring a Mysql cluster. I have a slave node I want to monitor for replication errors. The only status variable I see is slave_open_temp_tables. Is there another way to do this, basically I want to verify Seconds_Behind_Master and/or Slave_SQL_Running.

Hi Mikem,

You may use mysql_slave_status_seconds_behind_master metric.
Please check MySQL Replication Summary dashboard.

1 Like

Adivinho, I want to use the metric ‘Slave_SQL_Running’ but I am uncertain how to test for that. I only see numeric functions in the Condition field. This would be a Yes/No. How can I test for that in the alert?
Thanks!

1 Like

Please use the next formula in your alert rule.

mysql_slave_status_slave_sql_running < 1

1 Like

could you please give example? how to configure mysql_slave_status_slave_sql_running < 1 in dashboard.

Hi @sshine

You can set the replication delay in the slave server then you can check the graph, there it will show slave lag. So that you will get to know whether its working or not?

Even you can stop SQL thread or IO thread, it will show no status in the dashboard.

Ex: set lag 300 seconds
CHANGE MASTER TO MASTER_DELAY = 300 ;

Reference link…
https://dev.mysql.com/doc/refman/5.6/en/replication-delayed.html

1 Like

@Naresh9999 thank you,but i want to add an alert ,when sql thread or io thread stopped

2 Likes

Hi @sshine

Use the below options to get the alerts.

  1. When SQL thread is stopped
    mysql_slave_status_master_server_id > 0 and ON (instance) mysql_slave_status_slave_sql_running == 0

  2. When IO thread is stopped.
    mysql_slave_status_master_server_id > 0 and ON (instance) mysql_slave_status_slave_io_running == 0

Use the above conditions and check the alerts.

1 Like

@Naresh9999 thank you very much, i got it。 when my mysql SQL thread or IO thread is stopped,pmm2 alert will sendout a message with url
like “http://localhost:3000/graph/xxxxx” ,but i can not access it, because the site can’t be reached。pmm2 is in docker ,how to change the localhost to real ip?

2 Likes

Hi @sshine

You can replace localhost with your public IP of PMM server, but the 3000 port should be open to out side network.

For Example:
PMM Server IP: 192.168.1.100
URL: “http://192.168.1.100:3000/graph/xxxxx”

Even you can see the graphs in the PMM2 Alerting dashboard to check the live alerts.

1 Like