check_mysql causing MySQL access denied messages

This forum is intended for the discussion of Nagios plugin development. Feature requests, patches, bug fixes, and all types of development-related discussions are welcome!

NOTE: The nagiosplug-devel mailing list has been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

check_mysql causing MySQL access denied messages

Postby jfowler » Wed Mar 01, 2017 2:17 pm

I am a MySQL DBA and have noticed access denied messages in the MySQL error log on servers where we are using the check_mysql Nagios plug-in. The check is scheduled to happen every 5 minutes and that is the frequency I'm seeing these authentication failure messages in the MySQL error log.

The command that's getting issued every 5 minutes is as follows:
$USER1$/check_mysql -H $HOSTADDRESS$ -n

The user associated with the message is not root, but rather the user account associated with our Linux admin who set up the Nagios service check. I'd like to prevent these messages from filling up the error log and creating a lot of "white noise". I understand the "-n" switch in the command above is to ignore authentication failure and just check MySQL connectivity. But the authentication failures are causing repeating access denied messages to get written to the MySQL error log.

What is the best practice for using the check_mysql plug-in? Do we have to create a user account for the Nagios account performing the check? Is there any other way to check MySQL connectivity without a MySQL account?

Posts: 1
Joined: Wed Mar 01, 2017 11:43 am

Re: check_mysql causing MySQL access denied messages

Postby mcapra » Wed Mar 01, 2017 6:05 pm

The -n argument was sort of built for this use case. Otherwise, you can check to see if port 3306 is listening using a different plugin. If I were checking a local database:

Code: Select all
[root@xi-stable libexec]# ./check_mysql
Access denied for user 'root'@'localhost' (using password: NO)
[root@xi-stable libexec]# ./check_mysql -n
MySQL OK - Version: 5.5.52-MariaDB (protocol 10)

Though this doesn't account for every configuration directive a mysql server could possess. That command by itself looks like it shouldn't be producing those messages, though. Which version of check_mysql is being used on the Nagios Core machine? Like so:

Code: Select all
[root@xi-stable libexec]# ./check_mysql -V
check_mysql v2.0.3 (nagios-plugins 2.0.3)
Former Nagios employee
User avatar
Posts: 2893
Joined: Thu May 05, 2016 3:54 pm

Return to Nagios Plugin Development

Who is online

Users browsing this forum: No registered users and 2 guests