How to modify a command? (hostalive)

Hello,

how is it possible to modify the command hostalive?
I could not find it anywhere on my system.

I want to pass another variable to the hostlive check than “address”.

https://icinga.com/docs/icinga-2/latest/doc/10-icinga-template-library/#hostalive

hostalive ¶
Check command object for the check_ping plugin with host check default values. This variant uses the host’s address attribute if available and falls back to using the address6 attribute if the address attribute is not set.

hostalive is just check_ping and with check ping you can set the address

1 Like

I tried to pass the custom variable of my host to the “address” variable, but it does not seem to work. Any guess why?

template Host "generic-ilo-host" {
  max_check_attempts = 10
  check_interval = 1m
  retry_interval = 30s

  check_command = "hostalive"
  address = vars.iloAddress
}
check_ping: Invalid hostname/address -
Usage: check_ping -H -w ,​% -c ,​% [-p packets] [-t timeout] [-4|-6]

I have found the solution here: How to use host variables as field values in service templates?

It must be

address = "$host.vars.iloAddress$"

Thank you for your support! :slight_smile: