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 '' (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"


object Host "client1.example.com" {
import "generic-host"
address = ""
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 '' (111) It seems that it is still checking through TCP. What am I doing wrong?


Is Icinga2 runs on the same server of your MySQL service ? In this case you would have a problem in your command. Can you paste the detail of your command in your question.

In other case, to test a Unix socket for mysql which not listen on a TCP port, you must use NRPE or SSH to connect to your mysql server and check the service. The result will be send to your icinga2 server.

EDIT 1 :

If you want to test a service which has not a listener on the network on a remote server, you can use several things :

  1. check_by_ssh

With that, you will be able to execute remote commands on your remote server and the answer of this command will be send to your icinga2 server. This solution impose a ssh configuration between yous servers.

  1. NRPE

Otherwise, you can install NRPE on the remote server and execute commands with their results will be send to your icinga2 server.

NRPE can be run on windows or linux.

I think these two solutions are more simple than install icinga2 as a satellite on all your servers to be supervised.

| improve this answer | |
  • Sorry for the late answer. I'm totally new to monitoring systems and icinga2 is my first. OK, sounds logical. Can it be done if I install icinga2 on the client that I want to monitor and configure it as a satellite? – sysmodder Mar 8 '17 at 9:10
  • I edited my answer, I think install satellite is complicated for just test a service. – Sorcha Mar 8 '17 at 9:46
  • Thanks a lot for the quick answer and for your help! Actually, It's not a test setup. It's rather an actually setup with many clients but since I'm new to all this, I'm trying to add on client at a time and then configure all the services I need. I'll edit my answer to have a better understanding on how I configured MySQL check. – sysmodder Mar 8 '17 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.