Wednesday, June 16, 2010

MySQL Replication Monitoring using Nagios

Dear All,

This article will be focussed on how to setup MySQL replication monitoring using Nagios. I assume that you already have Nagios and MySQL replication setup and running on any of the Linux machine.

I have developed a script which can be used with Nagios and allows you to monitor replication status.

Here are the steps you need to follow:

1. Define remote host in your nagios host configuration file or create a new conifugration file with extension .cfg

   define host{
          use                        generic-host         
          host_name            backupdb            # You can set any name here
          alias                      backupdb            # and here
          address                 xxx.xxx.xxx.xxx   # IP address of your remote slave server
  }

2. Define command to be used in commands.cfg.

  define command{
        command_name check_slavestatus
        command_line /path/to/shell/script.sh -H $HOSTADDRESS$ -P $ARG1$ -u $ARG2$ -p $ARG3$
 }

3. Define service in your nagios host file.

  define service{
        use                               generic-service
        host_name                   backupdb
        service_description     MySQL Live Server Replication Status
        check_command   check_slavestatus!3306!user!password
}

Restart Nagios after you will done with the above configuration.

This is how your Nagios will display the MySQL replication monitoring information.


Please contact me for the shell script to configure the Nagios as described above.

Cheers!!!

No comments:

Post a Comment