Check_ping command works on CLI but nothing shows up in the Web UI

Hello,

I have a very basic thing I want to do and I can’t seem to pin point what I am missing here.

The Goal:
I have three servers:

  1. Icinga master
  2. DNS server
  3. Hypervisor

I want to be able to check if DNS server is reachable from the Hypervisor at all times. For this I am simply going to ping it. The built-in check_ping should do the job.

My configuration:

object Host "hypervisor" {
  import "generic-host"
  address = "some_public_ip"

  vars.os = "Linux"
  vars.sla = "all-week-8to22"
  vars.geolocation = "1234567890"
  vars.client_endpoint = name

  vars.notification["mail"] = {
    groups = [ "icingaadmins" ]
  }

  vars.swap_wfree = "30%"
  vars.swap_cfree = "15%"

  vars.qemu_vms = {
    "vm1" = {},
    "vm2" = {},
    "vm3" = {},
  }
  vars.f2b = {
    "all-jails" = {}
  }
  vars.vnstat = {
    "enp0s31f6" = {
      vnstat_iwarning  = 1024000
      vnstat_owarning  = 1024000
      vnstat_icritical  = 2048000
      vnstat_ocritical  = 2048000
    }
    "tap0" = {
      vnstat_iwarning  = 1024000
      vnstat_owarning  = 1024000
      vnstat_icritical  = 2048000
      vnstat_ocritical  = 2048000
    }
  }
  vars.ping = {
    "dns-server" = {
      ping_address = "10.24.0.2"
      ping_name    = "dns-over-vpn"
      ping_wrta    = 150
      ping_wpl     = 5
      ping_crta    = 200
      ping_cpl     = 10
    }
  }
}

I added the vars.ping to achieve the above described goal. This is the only part I am interested in right now.
Does anyone sees any problem with the config? Because it is not working for me and nothing shows up in icinga2 web.

When I run the check on the hypervisor it works just fine

root@hypervisor /usr/lib/nagios/plugins # sudo -u nagios ./check_ping -H 10.24.0.2 -w 150,5% -c 250,10%
PING OK - Packet loss = 0%, RTA = 24.99 ms|rta=24.985001ms;150.000000;250.000000;0.000000 pl=0%;5;10;0
icinga2 --version (version: r2.10.3-1)

System information:
Platform: Debian GNU/Linux
Platform version: 10 (buster)
Kernel: Linux
Kernel version: 4.19.0-12-amd64
Architecture: x86_64

Thanks!

Please show us where you have defined the service check which the hypervisor is
supposed to run.

All I see so far is your host definition.

Antony.

Hi Antony,

Thank you for your reply.

Here’s the service definition:

apply Service "ping4" {
  import "generic-service"
  display_name = "Ping"

  check_command = "ping4"
  assign where host.address
  ignore where host.vars.no_ping
}

If you just need ping your DNS server then I’d add a dedicated check e.g.:

apply Service "dns-over-vpn" {
   import "generic-service"
   display_name = "Ping"
   check_command = "ping4"
   command_endpoint = "hypervisor"

   vars.ping_address = "10.24.0.2"
   vars.ping_wrta    = 150
   vars.ping_wpl     = 5
   vars.ping_crta    = 200
   vars.ping_cpl     = 10

   assign where host.name == "hypervisor"
}

If you need more checks you should configure the hypervisor machine as satellite.

This should work

apply Service "Ping4-" for (key => config in host.vars.ping){
check_command = "ping4"
vars.ping_address = config.ping_address
vars.ping_wrta = config.ping_wrta
vars.ping_wpl = config.ping_wpl
vars.ping_crta = config.ping_crta
vars.ping_cpl = config.ping_cpl
}

Mamyk,

Thank you for pointing out I need the config for this to work.
I did it slightly different (but the same) and it did the trick.

apply Service "Ping4-" for (ping4 => config in host.vars.ping){
  check_command = "ping4"

  vars += config

  assign where host.address
  ignore where host.vars.no_ping
}

Thanks again and have a good one!