Hello, If your are interrested, here is the script I've done …

Friday, 29th March 2024

Comment on How to check MASTER / SLAVE MySQL nodes status – Check MySQL Replication Status by Thibs.

Hello,
If your are interrested, here is the script I've done a few years ago to monitor the replication into my monitoring system
 
#!/usr/bin/perl -w
use strict;
use DBI;
# Script to test MySQL replication by TRD 08/01/2008

if (scalar(@ARGV)==3) {
        #Variables
        my $dbServer="DBI:mysql:database=syslog;host=$ARGV[0]";
        my $dbUser=$ARGV[1];
        my $dbPwd=$ARGV[2];

        #Connect to DB
        my $db=DBI->connect($dbServer,$dbUser,$dbPwd) || exit 2;

        my $rs=$db->prepare('show slave status');
        $rs->execute();
        my $dr=$rs->fetchrow_hashref();
        my $Slave_IO_Running=$dr->{'Slave_IO_Running'};
        my $Slave_SQL_Running=$dr->{'Slave_SQL_Running'};
        $rs->finish();
        $db->disconnect();
        if (($Slave_IO_Running eq 'Yes') && ($Slave_SQL_Running eq 'Yes')) {
                exit 0;
        }
        else {
                exit 2;
        }
}
else {
        print "Missing parametern";
        exit 1;
}
 

Thibs Also Commented

How to check MASTER / SLAVE MySQL nodes status – Check MySQL Replication Status
Thanks for all ! Great and holy Easter to you !
For the script, I can adapt it o allow database name beeing passed as parameter.
Note that according to my experience, it's useless to check replication for all replicated database .. one is enough to check the whole replication status


How to check MASTER / SLAVE MySQL nodes status – Check MySQL Replication Status
Thanks for all ! Great andholy Easter to you !


Recent Comments by Thibs

Fix qmail-scanner-queue.pl: X-Qmail-Scanner-2.08st:[] cannot create /var/spool/qscan/tmp – Permission denied – Finally a working solution and what causes the error
And if you want I’ve recently updated my guide so you could upgrade it to Debian 8.0 Jessie 😉


Install simscan on Qmail for better Mail server performance and get around unexisting suid perl in newer Linux Debian / Ubuntu servers
Hello,

FYI ‘ve just update my guide http://qmailrocks.thibs.com/ to run on Jessie

Regards

Thibs


Quitting my job as IT Manager and moving to Further Horizons in Hewlett Packard
Drop me a mail if you want to have my contact (she is located in Israël but responsible for datacenter recruitment (at least for) Germany and Belgium)


Quitting my job as IT Manager and moving to Further Horizons in Hewlett Packard
Good luck in your job … and I hope you 'll build a new family soon with Svetlana ! BTW, if you change your mind and is ready to work abroad (Germany or Belgium), I can give your contact to a Google recruiter. They are looking for people like you. 


Debian Linux: Installing and monitoring servers with Icanga (Nagios fork soft)
Thanks for this great tutorial. Did you already try http://packages.debian.org/wheezy/collectd (never try myself but have heard good things about it)


Share this on:

Comments are closed.