Dealing with command duplicates

icinga2

#1

Hi,
is there a way to define a CheckCommand only if it is not already defined?

Thank you!


(Markus Frosch) #2

Not a really safe way to do so, no.

Best practice is to prefix commands with a custom prefix to ensure local changes stay intact: local/http or company/http.

You can also import "http" in your local command, to override only certain arguments:

object CheckCommand "my/http" {
  import "http"

  arguments += {
    "-x" = "$http_x$"
  }
}