How can i modify the icinga self check services?

Does someone got a hint for me how to change the service checks which came from scratch by the icinga install.

fe. i will change the check_http to 443, or change the warn & crit value for the check_disk check for icinga itself…

Look at the command in your directory:

./check_http --help

You’ll find the options like -p, --port=INTEGER

Give this options to your service:

apply Service "http-mdm" {
        import "generic-service"
        check_command = "http"

        vars.ip =       host.vars.ip
        vars.port =     "2020"
        vars.string =   "40"

        assign where host.address && host.name == "xxx"
}

For more understanding look at the docs:

https://icinga.com/docs/icinga2/latest/doc/10-icinga-template-library/#http

Hi,

CheckCommand arguments are specified as host/service custom variables, have a look over here.

In terms of the configuration examples provided in conf.d, you’ll need to have a look at the check_command attribute which refers to a CheckCommand object. All of them and their parameters are part of the ITL and are documented here.

So, if you want to change a certain threshold or parameter for the ping4 check, you’ll go by this:

apply Service "ping4" {
  import "generic-service"

  check_command = "ping4"

  //custom threshold
  vars.ping_wrta = 200 //threshold

  assign where host.address
}

The examples for disk and http use a more advanced configuration method with apply for rules. This allows to define the service check attributes directly in the host dictionary. You’ll likely never touch the service apply rule again and manage everything throughout the host objects.

This apply for rule from the example config …

apply Service for (http_vhost => config in host.vars.http_vhosts) {
  import "generic-service"

  check_command = "http"

  vars += config
}

can be modified/enhanced in the host object

object Host "..." {
...

  /* Define http vhost attributes for service apply rules in `services.conf`. */
  vars.http_vhosts["http"] = {
    http_uri = "/"
    http_ssl = true // https enabled
  }
  /* Uncomment if you've sucessfully installed Icinga Web 2. */
  vars.http_vhosts["Icinga Web 2"] = {
    http_uri = "/icingaweb2"
  }

Instead of modifying the existing configuration, I’d suggest to start simple with your own apply rules and objects, to learn more about the DSL and create your own strategy at first glance. More advanced techniques such as apply for are explained in the docs too.

Cheers,
Michael

1 Like