Host is trying to connect port 80 and due to that is is showing down but it is up and running

Hi,

Host is trying to connect port 80 and due to that is is showing down but it is up and running.

hosts.conf file :

object Host "VPAN" {
import "generic-host"
address = "1.2.3.4"
check_command = "hostalive"
check_command = "ssh"
check_command = "http"
vars.http_vhosts["VLAN.com:443"] = {
http_uri = "/check/"
http_port = "443"
http_ssl = true
}

my service VLAN.com:443 is up and running but it is showing message as host is down and it is trying to connect port 80

connect to address 1.2.3.4 and port 80: Connection refused

HTTP CRITICAL - Unable to open TCP socket

can you help me to resolve issue

Hello and welcome,

pWhat you are trying cant work this way. First you set 3 check commands, but only the last will be used which is http. You dont have any variables set in your host which are used by the http check command, see the ITL for all variables you need to set.
The question is, you really want to have a http check to decide if host is up or not?

Regards,
Carsten

Hi, oki as per Suggestion i remove another 2 check_command and kept only 1 as http
restarted the icinga2 service.

object Host “VPAN” {
import “generic-host”
address = “1.2.3.4”
check_command = “http”
vars.http_vhosts[“VLAN.com:443”] = {
http_uri = “/check/”
http_port = “443”
http_ssl = true
}

but still showing DOWN, i have not configure port 80 anywhere but it is still trying to connect port 80

Hi,

still you have to configure the needed variables. Your dictionary will not be used by the host check, its used by apply rules for services. If you want http as host check your host object should look like

object Host "VPAN" {
  import "generic-host"

  address = "1.2.3.4"

  check_command = "http"

  vars.http_uri = "/check/"
  vars.http_port = 443
  vars.http_ssl = true

}

Regards,
Carsten

Hi,
my goal is as i want to monitor my Website URL VLAN .com so i have added below configuration

it is showing y my site is up and running but it shows host is down with error it is trying to connect port 80.

so my website is up and running but it is showing this message as VLAN host is down but
my my VLAN server is up and running
so when i check error

connect to address 1.2.3.4 and port 80: Connection refused
HTTP CRITICAL - Unable to open TCP socket

i have not configured port 80 anywhere so why it is taking port 80

Hi,

because its the default for the http check command. If you read the docs, you will see what parameters you need to set.

But what you want is a host + a http check for the website. Change the check_command to hostalive (make sure you can ping the host before) and setup a service for the website on your host.

object Host "VPAN" {
  import "generic-host"

  address = "1.2.3.4"

  check_command = "hostalive"

  vars.http_vhosts[“VLAN.com”] = {
    http_uri = “/check/”
    http_port = “443”
    http_ssl = true
  }
}

This is the example apply rule for http checks taken from /etc/icinga2/conf.d/services.conf

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

  check_command = "http"

  vars += config
}