Hello CheckMK community!
We have a server with five instances of mysql running on it, each on their own ip address. I have spent a few days trying to figure this out, but I’ve yet to land on the correct configuration/solution. First off I’ve read through the following post, and subsequent post referenced in it, which are close to what we’re trying to do, but I can’t seem to get the configs quite right:
Here’s my setup of the database server I’m trying to monitor:
One server, with one primary interface, and five sub-interfaces off of that same primary interface. For example (interface - ip - hostname):
eth0 - 10.1.1.2 - server1.example.com <–this is the ip of the primary interface on the server.
eth0:1 - 10.1.1.3 - inst1.server1.example.com <–first mysql instance, first sub-interface.
eth0:2 - 10.1.1.4 - inst2.server1.example.com <–second mysql instance, second sub-interface.
etc…
We created a user on the database and granted permissions. I’ve copied the mk_mysql script from the CheckMK server over to the database server in the proper directory, and then later created the mysql.cfg file in /etc/check_mk/ directory (after following this guide: Monitoring MySQL). Oh, and the Check MK Agent has also been installed on the database server.
/etc/check_mk/mysql.cfg
file looks like this:
[client]
user=monitoruser
password=**********
ssl-mode=REQUIRED
I’ve also got the following inside of the /etc/check_mk/mysql.local.cfg
file:
# This file is created because some versions of mysqladmin
# issue a warning if there are missing includes.
socket=/tmp/inst1.server1.example.com.mysql.sock
aliases=inst1.server1.example.com
With the above configuration in place, I can create a new host server1.example.com
to monitor, and CheckMK will find all of the base services of the server, and then in addition find the inst1.server1.example.com database information.
The problem arises when I attempt to try and monitor the other database instances (inst2 through inst5). Adding a second socket=/tmp/inst2.server1.example.com.mysql.sock
to the mysql.local.cfg file doesn’t work, nor does it work if I add that to the mysql.cfg file.
If I try and add a new host to monitor like inst2.server1.example.com
, it doesn’t work because the agent is installed and registered to the hostname server1.example.com
; therefore, nothing ever gets returned to CheckMK for those hosts.
Whether that is the correct way to configure those files, I’m not sure. As I understand it, I can run the command sudo /usr/bin/check_mk_agent
and it will verify whether or not the database checks will work. When I add the second socket=...
line into the mysql.cfg file or the mysql.local.cfg file, the error I get is:
<<<mysql_ping>>>
[[/tmp/inst2.server1.example.com.mysql.sock]]
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'monitoruser'@'localhost' (using password: YES)'
I’m working in a non-production environment; therefore, I have the ability to make any change to try and get these checks working for the other database instances.
I’d be more than willing to provide any further information if needed. Thank you (in advance) for your time/consideration on this topic.