| Subcribe via RSS

Nagios MySQL Plug-Ins

March 9th, 2009 Posted in MySQL, MySQL Administration, Nagios

There currently exist many plugins for MySQL to use with Nagios. Many of them, however, are not version-independent, leaving organizations that use multiple versions of MySQL to either install multiple plugins or not monitor specific versions of MySQL. As such, I’ve compiled what I consider to be the most useful checks into a single plugin: check_mysql

Usage:
     check_mysql check_name [options]

     Options:
       --args|a     Optional arguments.  Comma-separated.  Check-specific.
       --critical|c The level at which a critical alarm is raised.  Check-specific.
       --database   The database to use (defaults to mysql)
       --help|?     Display this message and exit
       --hostname|H     The target MySQL server host (defaults to localhost)
       --password|p The password of the MySQL user
       --port       The port MySQL is listening on (defaults to 3306)
       --user|u     The MySQL user used to connect
       --version|V  Display version information and exit
       --warning|w  The level at which a warning is raised.  Check-specific.

     defaults are:

     ATTRIBUTE                  VALUE
     -------------------------- ------------------
     args                       No default value
     critical                   Check-specific
     database                   mysql
     help                       FALSE
     host                       localhost
     password                   No default value
     port                       3306
     timeout                    10 seconds
     user                       No default value
     verbose                    1 (out of 3)
     version                    FALSE
     warning                    Check-specific

Current Checks Supported:

* connect – Check to see whether or not one can connect to MySQL (USAGE)
* repl_io – Check to see whether on not the IO Replication thread is running (REPLICATION CLIENT)
* repl_sql – Check to see whether or not the SQL Replication thread is running (REPLICATION CLIENT)
* repl_sbm – Check how many seconds behind the master the slave is (REPLICATION CLIENT)
* mysql_query – Run a given query, test if it executes properly (SELECT)
* connections – Test if the percentage of used connections is over a given threshold (PROCESS)

I am open to requests for additional checks etc.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Google Bookmarks
  • StumbleUpon
  • Technorati
Tags: ,

4 Responses to “Nagios MySQL Plug-Ins”

  1. Arjen Lentz Says:


  2. rlowe Says:

    @arjen Thanks for the link.

    I considered adding checks for things like Key Cache Hit Rate, but really think that those metrics are better considered over time rather than as one-time alerts.

    Following some of the links from your page, I found http://www.consol.de/opensource/nagios/check-mysql-health, which might be exactly what I was looking for :)


  3. GP Says:

    Thank you for putting this together. You may want to update the script with the following download links as the ones in the script dont work anymore.

    http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.0.tar.gz
    http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.13.tar.gz


  4. SV Says:

    Could you please tell me how to use this? Is this a part of nrpe check?
    Or is this a separate nagios check itself?


Leave a Reply