Confused about how to define http_vhosts


I just installed latest releases of icinga2, icingaweb2, icinga-director (August 23 2021). Coming from nagios background.

I’m using Director to set up everything, and I can’t see how to define or use variables.
Setting up ‘hostalive’ Host checks was easy enough.

And now I’m trying to set up Service ‘http’ checks.

It works if I define a command and explicity specify hostname, port, and url:
check_http -H hostname -p port -u /Hosting/AService?wsdl

I assume there is a way to specify variable names though.
If I open a service template, I can select a check command.
And if I create a service, I can import a service template, and specify a host.
And if I look at my specified host, and click ‘Inspect’, I see ‘address’ has the host address, and vars is null.

Is there some way to set vars on objects in Director?

In the docs, I see this:

object CheckCommand "http" {
  command = [ PluginDir + "/check_http" ]

  arguments = {
    "-H" = "$http_vhost$"
    "-I" = "$http_address$"
    "-u" = "$http_uri$"
    "-p" = "$http_port$"
    "-S" = {
      set_if = "$http_ssl$"
    "--sni" = {
      set_if = "$http_sni$"
    "-a" = {
      value = "$http_auth_pair$"
      description = "Username:password on sites with basic authentication"
    "--no-body" = {
      set_if = "$http_ignore_body$"
    "-r" = "$http_expect_body_regex$"
    "-w" = "$http_warn_time$"
    "-c" = "$http_critical_time$"
    "-e" = "$http_expect$"

  vars.http_address = "$address$"
  vars.http_ssl = false
  vars.http_sni = false

But in Director, where is http_vhost or http_port being set?

It would be cool if I could substitute some vars, (you know, like templates)
check_http -H $http_vhost$ -p $http_port$ -u $url$

But I don’t see anywhere in Service or Host setup where there is a chance to set variables.

You’ll want to define Fields (main Director screen > Define Data Fields). Then those fields can be added to Service Templates (Fields tab). You should then see them under Custom Properties. There are more details in the docs, but hopefully that points you in the right direction with what to look out for.


Thanks, that works great

1 Like