I would like to monitor my MySQL server using icinga2 as the title shows above. My MySQL server uses a unix socket. I tried the following:
object Service "MYSQL" {
import "generic-service"
check_command = "mysql"
vars.mysql_query_hostname = "/var/run/mysqld/mysqld.sock"
vars.mysql_ignore_auth = true
vars.mysql_port = 6800
host_name = "mysql.server"
}
and I restart the icinga2 service. When I check from icinga2 web, I have the following error for the MySQL service: Plugin Output Can't connect to MySQL server on '192.168.2.4' (111)
It seems that icinga2 can't check the MySQL service using the unix socket. Is there something wrong with the config I'm using?
EDIT 1: So, I've installed icinga2 on the client and configured it as a satellite. I've been reading that icinga2 agent is the elegant way to monitor services on a remote service. Since this setup will stay, I'm willing to spend time and efforts to configure everything properly.
On the server, /etc/icinga2/conf.d/services.conf
apply Service "MySQL" {
import "generic-service"
check_command = "mysql"
command_endpoint = host.vars.client_endpoint
assign where host.vars.client_endpoint == "client1.example.com"
}
/etc/icinga2/conf.d/hosts.conf
object Host "client1.example.com" {
import "generic-host"
address = "192.168.2.4"
vars.client_endpoint = "client1.example.com"
vars.mysql_hostname = "/var/run/mysqld/mysqld.sock"
}
On the client, I've installed the required plugin "check_mysql" and icinga2 is running. When I check through the icinga2 web interface, I still get the following plugin output: Plugin Output Can't connect to MySQL server on '192.168.2.4' (111) It seems that it is still checking through TCP. What am I doing wrong?