Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use proper error message #5244

Merged
merged 1 commit into from
Oct 29, 2024
Merged

Conversation

tanguyvda
Copy link
Contributor

Community contributors

Description

use the proper mariadb message when checking mysql replication state

Type of change

  • Patch fixing an issue (non-breaking change)
  • New functionality (non-breaking change)
  • Functionality enhancement or optimization (non-breaking change)
  • Breaking change (patch or feature) that might cause side effects breaking part of the Software

How this pull request can be tested ?

  • have a sql replication running
  • on your master do some stupid shit such as
CHANGE MASTER TO MASTER_HOST='debian-ha-2', MASTER_USER='wrong_user', MASTER_PASSWORD='centreon', MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=328;
START SLAVE;

you'll now a failed slave replication thread running on your master server check it with your monitoring plugin and you'll get the following result

/usr/lib/centreon/plugins/centreon_mysql.pl --plugin=database::mysql::plugin --mode=replication --host=192.168.0.100 --port='3306' --username='centreon_repl' --password='centreon' --multiple --host='192.168.0.101' --port='3306' --username='centreon_repl' --password='centreon'  --unknown-connection-status='' --warning-connection-status='' --critical-connection-status='%{status} ne "ok"' --warning-thread-io-status='' --critical-thread-io-status='' --warning-slaves-running='' --critical-slaves-running='1:1' --warning-slave-latency='' --critical-slave-latency='' --unknown-replication-status='%{replication_status} =~ /configurationIssue/i' --warning-replication-status='%{replication_status} =~ /inProgress/i' --critical-replication-status='%{replication_status} =~ /connectIssueToMaster/i' --warning-thread-sql-status='' --critical-thread-sql-status='%{error_message} !~ //' --verbose
slaves.running.count'=2;;1:1;0;2 'mysql:host=192.168.0.101;port=3306#instance.slave.latency.seconds'=0s;;;;
checking database instance 'mysql:host=192.168.0.100;port=3306'
    connection status: ok
    thread sql running: yes
    thread io running: no [last error message: ]
    replication status: connectIssueToMaster
checking database instance 'mysql:host=192.168.0.101;port=3306'
    connection status: ok
    thread sql running: yes
    thread io running: yes
    slave has 0 seconds latency behind master, replication status: ok

with my patch you'll get a much better result

CRITICAL: number of slave instances running: 2 - database instance 'mysql:host=192.168.0.100;port=3306' replication status: connectIssueToMaster | 'instance.slaves.running.count'=2;;1:1;0;2 'mysql:host=192.168.0.101;port=3306#instance.slave.latency.seconds'=0s;;;;
checking database instance 'mysql:host=192.168.0.100;port=3306'
    connection status: ok
    thread sql running: yes
    thread io running: no [last error message: error connecting to master 'wrong_user@debian-ha-2:3306' - retry-time: 60  maximum-retries: 86400  message: Access denied for user 'wrong_user'@'debian-ha-1' (using password: YES)]
    replication status: connectIssueToMaster
checking database instance 'mysql:host=192.168.0.101;port=3306'
    connection status: ok
    thread sql running: yes
    thread io running: yes
    slave has 0 seconds latency behind master, replication status: ok

@tanguyvda tanguyvda requested a review from a team as a code owner October 17, 2024 09:54
@tanguyvda tanguyvda requested a review from Evan-Adam October 17, 2024 09:54
@omercier omercier merged commit 938557e into develop Oct 29, 2024
21 checks passed
@omercier omercier deleted the CTOR-1004_fix_mysql_replication_mode branch October 29, 2024 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants