Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to figure out how to monitor MySQL clusters with Nagios.

I have found the following information at http://blog.unixmaniacs.com/2008/12/mysql-cluster-ndbd-monitoring-with.html, however I have got nowhere.

How exactly do I install plugins?

share|improve this question
    
You don't mention it in your question but are you using NDBD clustering or are you just using a HA cluster configuration? –  Jeremy Bouse Oct 9 '09 at 10:15
    
blog.unixmaniacs.com no longer exists. Is the content of the referenced article somewhere else? –  Peter Mortensen May 8 '11 at 5:54
add comment

3 Answers

Alright, Nagios 101

Your Nagios installation is most likely in /usr/local/nagios/

Underneath that, you've got a lot of directories, but the one that the plugins go into is libexec. If you 'cd' into there, do an 'ls' and check it out. Those are all the plugins that you can use right now. Most, if you run them by themselves, will give you example usage.

Incidentally, if you know how to program, you can write your own scripts to check whatever you want. The language of the script doesn't matter, as long as the machine can run it. I write mine in bash, lots of people use perl, and the ones that come by default are (mostly?) written in C.

Anyway, once you've got the plugin into the directory, you've got to tell Nagios about it. Go to '/usr/local/nagios/etc/'. If you've got a recent installation (ie 3.0 or above) you should have an 'objects' directory. Inside there, by default, you'll have a "commands.cfg". Edit that, and check out the existing entries. They're all of the format

define command{
    command_name    command_name
    command_line    command_line

}

Put your new plugin in at the bottom.

define command{ 
    command_name      my_mysql_check
    command_line      $USER1$/whatever
}

The "$USER1$" is a Nagios macro that points to the /usr/local/nagios/libexec directory. You can edit the "resources.cfg" to see what else is available, and even add macros.

Anyway, now that we've got the command in there, we've got to set up a service to take advantage of it.

Save the commands.cfg and edit "services.cfg". Notice that everything is in the format:

define service{
     host_name server
     service_description whatever
     etc 
     etc
}

These set up the actual service description and the "host_name" assigns it to a server. Look at the documentation here when creating your service. The stuff in red is necessary, the others are used to refine how your service check behaves.

I hope this helped in some way. If not, please reply and let me know. You should also know that the default layout for Nagios configs is simple but unproductive. I wrote some documentation on how I lay mine out, and it's saved me a lot of time trying to find exactly the definition I was looking for. Depending on your installation, it may be overkill.

http://www.standalone-sysadmin.com/blog/2009/07/nagios-config/

Good luck!

share|improve this answer
add comment

At a basic level, you'll need to:

  1. Install the plugin on your Nagios box (if it's a local check) or on your remote host if you're using NRPE or something similar. Make sure that it's executable by whichever account is going to be running it ("nagios" by default on the server).
  2. Write a check command that uses the plugin, either on your Nagios host or the remote one if using NRPE.
  3. Add a service that will call the check command to your Nagios config for that host.

Points 2 and 3 are covered in the document you linked to.

share|improve this answer
add comment

That's not a real answer to your question. But I would suggest to use this plugin:

http://labs.consol.de/lang/de/nagios/check%5Fmysql%5Fhealth/

which is great. It virtually monitores everything (including ndb-cluster) with perfinfo if possible and even comes with an extension framework.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.