Check_http get error message Bad gateway on Icinga2 GUI

I have been using the http service for 1 year (example live.valami.hu). Today we added 2 subdomains (test.valami.hu and dfg.valami.hu) to the monitored server (nginx). Since then, the following error message appears on the icinga2 web: HTTP CRITICAL: HTTP/1.1 502 Bad Gateway. If I try check_http --ssl -H web_address in the console, I get HTTP OK: HTTP/1.1 200 OK. I realized that if I enter an ip address, I get the error message, so check_http --ssl -I 213.253.210.180.
The reason for this is that these two subdomains are not yet issuing a valid website because a developer application is sending the 502 code.
However, in Icinga2’s config, I do not enter ip, but the working web address, which is currently used by the operators, but according to them, Icinga2 can still monitor ip, or I don’t know what is going on in the background.
My config:

  • Server host config:
    object Zone “server name” {
    endpoints = [ “server name” ]
    parent = “master”
    }

object Endpoint “server name” {
host = “ip address”
}

object Host “server name” {
import “generic-host”
display_name = “NGINX1”
vars.os = “Linux”
groups = [ “linux-servers” ]
address = “ip address”
vars.http_vhosts[“http”] = {
http_uri = “/”
}
vars.client_endpoint = name
}

  • service config:
    apply Service “http” {
    check_command = “http”
    command_endpoint = host.vars.client_endpoint
    vars.http_address = “live.valami.hu”
    vars.http_ssl = “true”
    // vars += config
    assign where host.name == “server name”
    }

Whats wrong?

Version used (icinga2 --version): The Icinga 2 network monitoring daemon (version: r2.13.5-1)

  • Operating System and version: Debian 11.5
  • Enabled features (icinga2 feature list): api checker ido-mysql mainlog notification
  • Icinga Web 2 version and modules (System - About): 2.9.6 loaded module monitoring 2.9.6
  • Config validation (icinga2 daemon -C):
    root@icinga2:/usr/lib/nagios/plugins# icinga2 daemon -C
    [2022-10-21 12:10:54 +0200] information/cli: Icinga application loader (version: r2.13.5-1)
    [2022-10-21 12:10:54 +0200] information/cli: Loading configuration file(s).
    [2022-10-21 12:10:54 +0200] information/ConfigItem: Committing config item(s).
    [2022-10-21 12:10:54 +0200] information/ApiListener: My API identity: icinga2.telemedia.cc
    [2022-10-21 12:10:54 +0200] information/ConfigItem: Instantiated 1 IcingaApplication.
    [2022-10-21 12:10:54 +0200] information/ConfigItem: Instantiated 3 HostGroups.
    [2022-10-21 12:10:54 +0200] information/ConfigItem: Instantiated 15 Hosts.
    [2022-10-21 12:10:54 +0200] information/ConfigItem: Instantiated 1 FileLogger.
    [2022-10-21 12:10:54 +0200] information/ConfigItem: Instantiated 1 IdoMysqlConnection.
    [2022-10-21 12:10:54 +0200] information/ConfigItem: Instantiated 1 CheckerComponent.
    [2022-10-21 12:10:54 +0200] information/ConfigItem: Instantiated 104 Notifications.
    [2022-10-21 12:10:54 +0200] information/ConfigItem: Instantiated 18 Zones.
    [2022-10-21 12:10:54 +0200] information/ConfigItem: Instantiated 16 Endpoints.
    [2022-10-21 12:10:54 +0200] information/ConfigItem: Instantiated 1 ApiUser.
    [2022-10-21 12:10:54 +0200] information/ConfigItem: Instantiated 1 ApiListener.
    [2022-10-21 12:10:54 +0200] information/ConfigItem: Instantiated 1 NotificationComponent.
    [2022-10-21 12:10:54 +0200] information/ConfigItem: Instantiated 245 CheckCommands.
    [2022-10-21 12:10:54 +0200] information/ConfigItem: Instantiated 4 UserGroups.
    [2022-10-21 12:10:54 +0200] information/ConfigItem: Instantiated 10 ServiceGroups.
    [2022-10-21 12:10:54 +0200] information/ConfigItem: Instantiated 3 Users.
    [2022-10-21 12:10:54 +0200] information/ConfigItem: Instantiated 89 Services.
    [2022-10-21 12:10:54 +0200] information/ConfigItem: Instantiated 4 NotificationCommands.
    [2022-10-21 12:10:54 +0200] information/ScriptGlobal: Dumping variables to file ‘/var/cache/icinga2/icinga2.vars’
    [2022-10-21 12:10:54 +0200] information/cli: Finished validating the configuration file(s).

set the parameter http_vhost for each service to the corresponding domainname for example:

http_vhost = "live.valami.hu"
1 Like

Thx. Work like a charm!