Skip to main content

Nagios plugin for checking mysql synchronization state

I want to share this simple nagios plugin for monitoring mysql slaves replications states:

check_mysql_sync

This plugin can be downloaded here. To install copy this script to nagios plugins directory (/usr/lib/nagios/plugins/). View script help for full options list:

# /usr/lib/nagios/plugins/check_mysql_sync.pl -h

Check mysql sync between master and slave for Nagios version 0.1
Usage: /usr/lib/nagios/plugins/check_mysql_sync.pl [-v] -H <host> -p <port> -l <username> -x <password> -w <warn level> -c <crit level>  [-V]
-v, --verbose
   print extra debugging information 
-h, --help
   print this help message
-H, --hostname=HOST
   name or IP address of host to check
-l, --login
    username for mysql database (Default nagios)
-x, --passwd=PASSWD
   password
-p, --port=PORT
   MYSQL port (Default 3361)
-w, --warn=INTEGER
   warning level for seconds behind sync
-c, --crit=INTEGER 
   critical level for seconds behind sync
-V, --version
   prints version number

Run this command in your mysql master for grant to nagios user the required privileges:

 GRANT PROCESS, REPLICATION CLIENT on *.*  TO 'nagios'@'192.168.1.25' IDENTIFIED BY 'yourpass';