Napsty / check_mysql_slavestatus

Monitoring plugin to check the Status of a MySQL/MariaDB replication slave
15 stars 15 forks source link

Add mysql multi-source replication parameter #12

Closed AlexisReyes closed 4 years ago

AlexisReyes commented 4 years ago

Hi,

I intended to use its plugin to verify the replication of mysql with multi-source replication and I discovered that this does not seem to work correctly at least with mysql. After a little research, I discovered that the correct syntax for mysql is quite different from the mariadb implementation:

mariadb: show slave 'connection' status mysql: show slave status for channel 'channel'

So I added a new parameter to indicate when is a mysql (-C) multi-source replication.

A variable verification was also added for the -s and -C parameters, since they are mutually exclusive, as well as a verification when there are more than one slave status response and there is no connection or channel parameter used to avoid the error message: bash: [: too many arguments.

I am already using this implementation on my servers and it seems to work correctly.

Please, check the code and if it is useful, you can merge to improve this excellent complement, I will be waiting for any comments.

regards

Napsty commented 4 years ago

Hi @AlexisReyes

Sorry for the late answer. Somehow didn't get a notification about this PR...

Code lgtm. Thanks!

AlexisReyes commented 4 years ago

Sounds great, thanks a lot.

Napsty commented 4 years ago

@AlexisReyes new version released today, including an article about the two different multi-source replications in MariaDB and MySQL: https://www.claudiokuenzler.com/blog/1010/check_mysql_slavestatus-monitoring-explaining-mysql-channel-replication-differences