check_mysql causing MySQL access denied messages

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
jfowler
Posts: 1
Joined: Wed Mar 01, 2017 11:43 am

check_mysql causing MySQL access denied messages

Post by jfowler »

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?

Thanks,
John
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: check_mysql causing MySQL access denied messages

Post by mcapra »

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
https://www.mcapra.com/
Locked