0

I have just tried check_mysqld that I found on monitoringexchange.org, but it turned out that it outputs in a format that either NRPE 2.12 or Nagios 3.2.1 doesn't understand.

Can anyone recommend a check plugin for Nagios 3 that works with NRPE?

Sandra
  • 10,303
  • 38
  • 112
  • 165

3 Answers3

2

What would you like to check?

I am using the check_mysql that comes with the plugins package on my Centos nagios box to remotely monitor MySQL. There is no need for NRPE with this setup.

Littlejon
  • 243
  • 1
  • 3
  • 9
  • Very interesting. I have compiled Nagios, so I dare not to install the RPM's. I am using Centos 5. If possible would I like to check threads_running, threads_connected, and threads_cached. But I don't know what "normal practice" is to monitor on mysql. What are you monitoring? I like using NRPE because it makes life easier for me, as all the other plugins are configured to use NRPE =) – Sandra Jul 21 '10 at 03:14
  • If you compiled nagios, compile the nagios plugins as well :-) http://www.nagios.org/download/plugins/ – natxo asenjo Jul 21 '10 at 09:40
  • I have =) My Nagios setup works for all the default plugins like check_load, check_disk, check_http and so on. I just need a plugin for checking mysql that works with NRPE... – Sandra Jul 21 '10 at 11:07
  • so is check_mysql not among the plugins that got compiled? I do not know where the rest are, but just cd to that folder and see if it's there. I just install the packages (rpm, deb) from the distribution repositories and so far, so good. – natxo asenjo Jul 23 '10 at 08:30
1

Well, I tried the check_mysqld plugin from William Leibzon and it works great. You can indeed control much more variables than the standard nagios plugin. I just dropped the plugin in /usr/local/nagios/libexec and ran it from the cli and it works. I added it to the nagios (opsview, in fact, but the engine is nagios) checks and now I have nice graphics. So maybe there is something you did not set up properly with it.

A few things: run the plugin as user nagios from the shell. If the database is a remote server, verify that the user and server you are using the plugin from may query the mysql server and the database you are pulling data from (standard is database: mysql).

My check is like this:

nagios@host:$ cd /usr/local/nagios/libexec
$./check_mysqld.pl -H hostname -u user -a slow_queries -w 44 -c 55 -f
MYSQL 5.0.51a-24+lenny4 OK - slow_queries=0 | slow_queries=0

the -u is the mysql user at the database server. This database user has no password to query the mysql database.

quanta
  • 51,413
  • 19
  • 159
  • 217
natxo asenjo
  • 5,739
  • 2
  • 26
  • 27
  • I now gave it another try since you wrote it worked for you. I figured it didn't support NRPE or Nagios 3.x. The problem was that I had to change the library path for utils.pm. When done, it worked right away! =) Btw. Are 44 and 55 the values you use for slow_queries? I am looking for good values to use. – Sandra Jul 26 '10 at 19:21
  • sorry for the delay, holidays ;-). You should ask your DBA as to what slow_queries values are correct for your environment. Check the mysql docs: http://dev.mysql.com/doc/refman/5.0/en/server-status-variables.html#statvar_Slow_queries – natxo asenjo Aug 11 '10 at 18:35
1

There is a very good need for NRPE in situations where MSQL is not to be open to queries from hosts other than localhost, or when the mysqld process cannot be bumped to allow a configuration change.

~

Adding commands to check via NRPE is really simple. For Mysql Add the following line to your nrpe.cfg file:

command[check_mysql]=sudo /usr/lib/nagios/plugins/check_mysql -u'user' -p'pass'

Here is your Command definition for Nagios: $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_mysql

Add this line to your /etc/sudoers: nagios ALL=(ALL) NOPASSWD:/usr/lib/nagios/plugins/check_mysql

Make sure you aren't allowing command line parameters to be passed to the command: dont_blame_nrpe=0

~

To create any other NRPE command replace 'check_mysql' with the name of the command you wish to create, and the path to the actual command after sudo. Same for the sudoers file.

  • HTH ~ Dan.
Daniel Baker
  • 309
  • 2
  • 3
  • Note that this command leaves your password in the process list, which means a user which can see your privileges can see your mysql password, by, for example, using the `top` command. – droope Oct 08 '13 at 03:06