Monday, January 04, 2016

Nagios - MySQL Warning: Using a password on the command line interface can be insecure



After upgrade MySQL version from 5.5 to 5.6, our Nagios monitoring system starts showing "Warning: Using a password on the command line interface can be insecure" in Nagios check return results. Because Nagios only displays the first line of result, and this warning message is not an error, from our Nagios monitoring system you can only see this warning message instead of check result, which is really annoying.

There are couple of ways to fix this, the easy way is to add "| tail -n 1" into your Nagios check command, so that it shows the last line of the return result. This is also a lazy way :)

The recommended way of fixing this is to add a "mysql.cnf" file into your /etc/nagios directory. The content of this file is:
[client]
user=monitor
password="PASSWD"


Then, remove the "-p PASSWD" part from your Nagios command definition. Restart nrpe process and you are good to go!

If this does not work for you, always check the source code of the nagios plugin file!

1 comment:

Mark Shinkar said...

You can suppress this warning in percona nagios plugins (any of them): by redirecting errors to /dev/null
pmp-check-mysql-status:
# ########################################################################
# Redirect STDERR to STDOUT; Nagios doesn't handle STDERR.
# ########################################################################

exec 2>/dev/null
# ########################################################################