Icinga2 check_mysql only checking master

Hello,

I’ve setup my master node and client/satellite nodes and each client node is running load, procs, http checks correctly - They all look at their own load and number of procs.

I’m now trying to add in a mysql check using the check_mysql plugin.

/etc/icinga2/zones.d/master/commands.conf

object CheckCommand "check_mysql" {
  import "plugin-check-command"
  command = [ PluginDir + "/check_mysql" ]
  vars.mysql_user = "xxxxxxx"
  vars.mysql_password = "xxxxxx"
  vars.mysql_database = "icinga"
  vars.mysql_host = "$host.address$"
}

/etc/icinga2/zones.d/master/services.conf

apply Service "mysql" {
  import "generic-service"
  check_command = "check_mysql"
  assign where host.address
  vars.mysql_username = "xxxxxxxxxxx"
  vars.mysql_password = "xxxxxxxxx"
  vars.mysql_host = host.address
}

This ‘appears’ to work in the icinga2 web interface, however it is actually showing the same result for each client, meaning to me that it is reporting the master node’s information.

Each client has the check_mysql plugin installed.

Cheers,
Plumel

The problem is that the checkcommand does not use the provided parameters:

if you look at the pre defined checkcommand from the icinga2 itl library:

if you just define it with the standard definition it would work without any hassle:

apply Service "mysql" {
  import "generic-service"
  check_command = "mysql"

  vars.mysql_username = "xxxxxxxxxxx"
  vars.mysql_password = "xxxxxxxxx"

  assign where host.address
}
1 Like

Hey thanks for pointing me in the right direction, all sorted now

please mark the solution :slight_smile: