Home Directory Plugins Databases MySQL check_mysql_health

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com


Remember Me

Directory Tree


23 votes
Current Version
Last Release Date
Compatible With
  • Nagios 1.x
  • Nagios 2.x
  • Nagios 3.x
  • Nagios XI 2009R1
  • Nagios Fusion 2010R1
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
check_mysql_health is a plugin for Nagios that allows you to monitor a MySQL database. Among the list of metrics are time to login, index usage, bufferpool hit rate, query cache hit rate, slow queries, temp tables on disk, table cache hit rate, connected threads, and many more. Requirements are either a DBD::mysql Perl module or a MySQL client package.
This plugin can be used to check the following metrics:

connection-time (Time to connect to the server)
uptime (Time the server is running)
threads-connected (Number of currently open connections)
threadcache-hitrate (Hit rate of the thread-cache)
slave-lag (Seconds behind master)
slave-io-running (Slave io running: Yes)
slave-sql-running (Slave sql running: Yes)
qcache-hitrate (Query cache hitrate)
qcache-lowmem-prunes (Query cache entries pruned because of low memory)
keycache-hitrate (MyISAM key cache hitrate)
bufferpool-hitrate (InnoDB buffer pool hitrate)
bufferpool-wait-free (InnoDB buffer pool waits for clean page available)
log-waits (InnoDB log waits because of a too small log buffer)
tablecache-hitrate (Table cache hitrate)
table-lock-contention (Table lock contention)
index-usage (Usage of indices)
tmp-disk-tables (Percent of temp tables created on disk)
slow-queries (Slow queries)
long-running-procs (long running processes)
cluster-ndbd-running (ndnd nodes are up and running)
sql (any sql command returning a single number)
Reviews (7)
Everything works great until SSL is enabled. To get this working with SSL you have to use an additional cnf. Then, when using that cnf it no longer accepts the host/port params so they have to be called out in a cnfgroup (in the file). Its just kind of awkwardly designed it seems. In order to add a new db for monitoring you either have to create a new cnfgroup in the cnf file or create a new cnf. In order to integrate smoothly with our monitoring system Opsview, this needs to be able to accept all arguments at the commandline.

So we would need minimally params for ssl-ca and ssl-mode that would get passed into DBI. I think we are going to try to re-write the code for this. Also, would be nice if Consol put their code in revision control so the community can help improve/maintain it.

In case this may help anyone, this is what you need to do to execute against AWS RDS:
./check_mysql_health --mode connection-time --database myDBName --username 'username' --password 'userpassword' --warning 1 --critical 5 --environment NAGIOS__SERVICEMYSQL_MYCNF='/mnt/opsview/usr/local/nagios/etc/mysql_rds.cnf' --environment NAGIOS__SERVICEMYSQL_MYCNFGROUP='groupName'

download the RDS cert bundle and put that with your certs:

In the cnf file I have specified above, I have these contents:

ssl-ca = /etc/ldap/cacerts/rds-combined-ca-bundle.pem
ssl-mode = 'VERIFY_CA'

host = MyHostname.us-east-1.rds.amazonaws.com
port = 12345
The Nagios plugin may be really nice. I just don't have much experience with it right now. However, when I started trying it, it just came up with:

Can't locate object method "new" via package "DBD::MySQL::Server::Instance" (perhaps you forgot to load "DBD::MySQL::Server::Instance"?) at Nagios/DBD/MySQL/Server.pm line 85.

I was looking for such issues on the internet and didn't find any helpful topic. I wonder if I really am the only one on the world wide web having that issue.

However, I found out that a change of the line 85 in the mentioned file from:

$self->{instance} = DBD::MySQL::Server::Instance->new(%params);


$self->{instance} = DBD::MySQL::Server->new(%params);

was helpful. Just as remark.
byrandomx2000, October 3, 2015
Great plugin, love the functionality!

The MySQL CLI now emits an annoying warning message: "Warning: Using a password on the command line interface can be insecure."

Seems the best way to slience this warning is to use the switch:

Feature request - please add:
defaults-file /path/to/creds.cnf
byMaquis196, July 24, 2013
1 of 1 people found this review helpful
Great plugin, but I do have a fairly big problem I've just noticed, we use a .my.cnf file for all username and password (Which is common across the company for the nagios mysql user), however we need to specify hostname in the command for obvious reasons.

However, when you run the script with the mycnf option, it doesn't parse the hostname and goes to localhost instead.

So I ended up with 20machines all with the same mysql health values!

If you use --hostname --user and --pass as normal, the script works great hence the good rating, but if I can submit a bug report somewhere that would be ace.

Great product, but cpu busy is not coming back very useful and I had to disable it. here is a link that explains a better way to do it.

byaswen, January 24, 2012
2 of 2 people found this review helpful
I'd like to download this plugin, but there are no files listed and there's no download link as well.
Owner's reply

Clicking on "Website
labs.consol.de/nagios/check_mysql_health" a few lines above is very complicated, isn't it?

bybox2, August 10, 2010
3 of 3 people found this review helpful
This plugin is brilliant. Very easy to set up and gets all the lovely perfdata I need to have historic and highly valuable hard numbers to tune our MySQL servers and application code. No more naysayers with the complaining that 'changing for the sake of changing is not a solution'.

Also the checking of MySQL replication is very awesome.

This plugin defeats any reasons we had for using the MySQL Enterprise Manager software. Saving dollars and cents.