Network

Icinga2 Monitoring Basic

Tedi__ 2022. 12. 21. 15:38

* 참고 및 출처 : https://icinga.com/docs/icinga-2/latest/doc/03-monitoring-basics/#templates

 

Monitoring Basics - Icinga 2

Monitoring Basics This part of the Icinga 2 documentation provides an overview of all the basic monitoring concepts you need to know to run Icinga 2. Keep in mind these examples are made with a Linux server. If you are using Windows, you will need to chang

icinga.com

Atrribute Value Types
icinga2는 속성별로 다른 타입을 사용합니다.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Host and Services

Icinga2는 여러가지 방법을 통하여 Host와 Service들의 가용성을 모니터링 할 수 있습니다.

`Host` 개체는 물리적인 서버, 장치(device)에서 실행 중인 `Service`를 그룹화하는 메커니즘을 제공합니다.

 

하나의 Host에 두 개의 서비스가 그룹화 되어 있는 예제입니다. ( hosts.conf )

object Host "my-server1" {
  address = "10.0.0.1"
  check_command = "hostalive"
}

object Service "ping4" {
  host_name = "my-server1"
  check_command = "ping4"
}

object Service "http" {
  host_name = "my-server1"
  check_command = "http"
}

`address`는 Host가 연결된 네트워크 주소를 의미하고 check_command 과 함께 사용됩니다.
check_command가 hostalive이므로 address에 등록된 주소가 alive 중인지 모니터링 합니다.

Host States

 

 

 

 

 

 

 

Sevice States

 

 

 

 

 

 

 

 

 

 

Host, Service는 위에 표와 같이 각각의 상태정보를 표시해줍니다.


Hard And Soft States

 

 

 

 

 

 

Host/Service의 문제를 감지하면 Icinga는 알림을 보내기 이전에 개체를 여러번 다시 확인 합니다. (max_check_attempts, retry_interval 설정 기준) 이를 통해 일시적인 오류에 대하여 불필요한 알림이 전송되지 않습니다.
이 시간 동안 개체는 SOFT 상태에 있습니다.

모든 재확인이 실행되고 개체가 여전히 비정상 상태인경우 호스트/서비스는 HARD상태로 전환되고 알림이 전송됩니다.

Host and Service Check
Icinga는 정기적인 주기를 통해 호스트와 서비스의 상태체크를 실행합니다.

- bulit-in check commands

object Host "router" {
  check_command = "hostalive"
  address = "10.0.0.1"
}

check_command에 Icinga에 빌트인 되어있는 커맨드들을 사용하여 다양한 방법으로 모니터링을 할 수 있습니다.

 

Host Check Alternatives

ICMP, HTTP로 헬스체크를 할 수 없는 경우 `dummy` CheckCommand 를 사용하여 헬스체크를 할 수 있는 대안이 있습니다.

object Host "dummy-host" {
  check_command = "dummy"
  vars.dummy_state = 0 //Up
  vars.dummy_text = "Everything OK."
}

Templates (template.conf)

템플릿을 사용하여 둘 이상의 객체(object)에 동일한 속성 집합을 적용 할 수 있습니다. 

template Service "generic-service" {
  max_check_attempts = 3
  check_interval = 5m
  retry_interval = 1m
  enable_perfdata = true
}

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

  check_command = "ping4"

  assign where host.address
}

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

  check_command = "ping6"

  assign where host.address6
}