Many of the freely available Nagios plugins for MySQL are poor quality, with no formal testing and without good documentation. A more serious problem, however, is that they are not created by experts in MySQL monitoring, so they tend to cause false alarms and noise, and don’t encourage good practices to monitor what matters.
These plugins offer the following improvements:
The plugins are designed to be executed locally or via NRPE. Most large installations should probably use NRPE for security and scalability.
In general, the plugins either examine the local UNIX system and execute commands, or they connect to MySQL via the mysql commandline executable and retrieve information. Some plugins combine these actions. Each plugin’s documentation explains its commandline options and arguments, as well as the commands executed and the privileges required.
The plugins are all written in standard Unix shell script. They should run on any Unix or Unix-like operating system, such as GNU/Linux, Solaris, or FreeBSD.
The plugins are designed to be used with MySQL 5.0 and newer versions, but they may work on 4.1 or older versions as well.
yum install percona-nagios-plugins
apt-get install percona-nagios-plugins
These plugins can be used locally or via NRPE. NRPE is the suggested configuration. Some plugins execute commands that require privileges, so you may need to specify a command prefix to execute them with sudo.
For security reasons, it is recommended to not pass MySQL access credentials in the arguments. You can create /etc/nagios/mysql.cnf and the plugins will use it like the default .my.cnf file. For example:
[root@centos6 ~]# cat /etc/nagios/mysql.cnf [client] user = root password = s3cret [root@centos6 ~]# chown root:nagios /etc/nagios/mysql.cnf [root@centos6 ~]# chmod 640 /etc/nagios/mysql.cnf
Also with MySQL 5.6 client you can use the login-path instead of the password or .my.cnf, /etc/nagios/mysql.cnf files. For this, you need to specify -L option, e.g. -L safelogin. The actual .mylogin.cnf file should be created with mysql_config_editor tool and in case of Nagios, placed into nagios user home directory.
Here you can find an excerpt of potential Nagios config click here.
And here is an excerpt of related NRPE config:
command[rdba_unix_memory]=/usr/lib64/nagios/plugins/pmp-check-unix-memory -d -w 96 -c 98 command[rdba_mysql_pidfile]=/usr/lib64/nagios/plugins/pmp-check-mysql-pidfile
If you have questions, comments, or need help with the plugins, there are several options to consider.
You can report bugs and submit patches to the Launchpad project.
If you need help with installation, troubleshooting, configuration, selecting services to monitor, deciding on appropriate thresholds, writing more plugins, extending or modifying existing plugins, or fixing bugs in plugins, you may wish to consider a MySQL Support Contract from Percona. These monitoring plugins are fully supported under all Percona contracts.