# Configure PMM to monitor Mysql slave

**URL:** <https://forums.percona.com/t/configure-pmm-to-monitor-mysql-slave/12865>\
**Category:** PMM 2.x\
**Created:** [November 4, 2021, 1:08pm UTC](https://forums.percona.com/t/configure-pmm-to-monitor-mysql-slave/12865 "2021-11-04T13:08:00Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mikem](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@Mikem](https://forums.percona.com/u/Mikem)\
**Post date:** [November 4, 2021, 1:08pm UTC](https://forums.percona.com/t/configure-pmm-to-monitor-mysql-slave/12865/1 "2021-11-04T13:08:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Vadim\_Yalovets](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/vadim_yalovets/32/43_2.png) [@Vadim\_Yalovets](https://forums.percona.com/u/Vadim_Yalovets)\
**Post date:** [November 4, 2021, 8:15pm UTC](https://forums.percona.com/t/configure-pmm-to-monitor-mysql-slave/12865/2 "2021-11-04T20:15:56Z")

</div>

Hi Mikem,

You may use _ **mysql\_slave\_status\_seconds\_behind\_master** _ metric.  
Please check MySQL Replication Summary dashboard.

 ![Screenshot 2021-11-04 at 22.15.11](https://us1.discourse-cdn.com/flex019/uploads/percona1/original/2X/e/e86b8c5443210a5351e936be7d92515808a99d3a.png)

---

<div class="post-metadata">

**Author:** ![Mikem](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@Mikem](https://forums.percona.com/u/Mikem)\
**Post date:** [November 5, 2021, 1:46pm UTC](https://forums.percona.com/t/configure-pmm-to-monitor-mysql-slave/12865/3 "2021-11-05T13:46:16Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Vadim\_Yalovets](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/vadim_yalovets/32/43_2.png) [@Vadim\_Yalovets](https://forums.percona.com/u/Vadim_Yalovets)\
**Post date:** [November 5, 2021, 5:32pm UTC](https://forums.percona.com/t/configure-pmm-to-monitor-mysql-slave/12865/4 "2021-11-05T17:32:34Z")

</div>

> [@Mikem](#):
>
> How can I test for that in the alert?

Please use the next formula in your alert rule.

_mysql\_slave\_status\_slave\_sql\_running \< 1_

---

<div class="post-metadata">

**Author:** ![sshine](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@sshine](https://forums.percona.com/u/sshine)\
**Post date:** [January 13, 2022, 3:57am UTC](https://forums.percona.com/t/configure-pmm-to-monitor-mysql-slave/12865/5 "2022-01-13T03:57:27Z")

</div>

could you please give example? how to configure _mysql\_slave\_status\_slave\_sql\_running \< 1_ in dashboard.

---

<div class="post-metadata">

**Author:** ![Naresh9999](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/naresh9999/32/5568_2.png) [@Naresh9999](https://forums.percona.com/u/Naresh9999)\
**Post date:** [January 13, 2022, 7:10am UTC](https://forums.percona.com/t/configure-pmm-to-monitor-mysql-slave/12865/6 "2022-01-13T07:10:54Z")

</div>

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](https://dev.mysql.com/doc/refman/5.6/en/replication-delayed.html)

---

<div class="post-metadata">

**Author:** ![sshine](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@sshine](https://forums.percona.com/u/sshine)\
**Post date:** [January 13, 2022, 7:19am UTC](https://forums.percona.com/t/configure-pmm-to-monitor-mysql-slave/12865/8 "2022-01-13T07:19:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Naresh9999](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/naresh9999/32/5568_2.png) [@Naresh9999](https://forums.percona.com/u/Naresh9999)\
**Post date:** [January 13, 2022, 7:28am UTC](https://forums.percona.com/t/configure-pmm-to-monitor-mysql-slave/12865/9 "2022-01-13T07:28:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sshine](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@sshine](https://forums.percona.com/u/sshine)\
**Post date:** [January 14, 2022, 3:04am UTC](https://forums.percona.com/t/configure-pmm-to-monitor-mysql-slave/12865/10 "2022-01-14T03:04:02Z")

</div>

@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](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？

---

<div class="post-metadata">

**Author:** ![Naresh9999](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/naresh9999/32/5568_2.png) [@Naresh9999](https://forums.percona.com/u/Naresh9999)\
**Post date:** [January 14, 2022, 7:35am UTC](https://forums.percona.com/t/configure-pmm-to-monitor-mysql-slave/12865/11 "2022-01-14T07:35:18Z")

</div>

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”](http://192.168.1.100:3000/graph/xxxxx%E2%80%9D)

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