Inhaltsverzeichnis

Konfigurationsbeispiele

Hier einige Beispiele.

Hosts

object Host NodeName {
  import "generic-host"
  address = "127.0.0.1"
  address6 = "::1"
  vars.os = "Linux"
  vars.http_vhosts["http"] = {
    http_uri = "/"
  }
  //vars.http_vhosts["Icinga Web 2"] = {
  //  http_uri = "/icingaweb2"
  //}

  vars.disks["disk"] = {
    /* No parameters. */
  }
  vars.disks["disk /"] = {
    disk_partitions = "/"
  }

  vars.notification["mail"] = {
    /* The UserGroup `icingaadmins` is defined in `users.conf`. */
    groups = [ "icingaadmins" ]
  }

  vars.mysql_username="<USERNAME>"
  vars.mysql_password="yPASSWORD>"

}

Services

apply Service "dovecot-imaps" {
  import "generic-service"
  check_command = "tcp"
  vars.tcp_port="993"
  assign where host.name == NodeName
}

apply Service "amavisd-new" {
  import "generic-service"
  check_command = "tcp"
  vars.tcp_port="10026"
  assign where host.name == NodeName
}

apply Service "amavis-milter" {
  import "generic-service"
  check_command = "tcp"
  vars.tcp_port="60001"
  assign where host.name == NodeName
}

apply Service "postfix" {
  import "generic-service"
  check_command = "tcp"
  vars.tcp_port="25"
  assign where host.name == NodeName
}

apply Service "policyd-weight" {
  import "generic-service"
  check_command = "tcp"
  vars.tcp_port="12525"
  assign where host.name == NodeName
}

apply Service "nginx-https" {
  import "generic-service"
  check_command = "http"
  vars.http_ssl="true"
  assign where host.name == NodeName
}

apply Service "mysql-server" {
  import "generic-service"
  check_command = "mysql"
  assign where host.name == NodeName
}

Users

object User "<USERNAME>" {
  import "generic-user"
  display_name = "<DISPLAYNAME>"
  groups = [ "<GROUPNAME>" ]

  email = "<MAILADRESS>"
}

object UserGroup "icingaadmins" {
  display_name = "Icinga 2 Admin Group"
}

Templates

template Host "generic-host" {
  max_check_attempts = 3
  check_interval = 1m
  retry_interval = 30s

  check_command = "hostalive"

  vars.notification_from="<MAILADRESS>"
}

template Service "generic-service" {
  max_check_attempts = 5
  check_interval = 1m
  retry_interval = 30s

  vars.notification_from="<MAILADRESS>"

}

template User "generic-user" {

}

template Notification "mail-host-notification" {
  command = "mail-host-notification"

  states = [ Up, Down ]
  types = [ Problem, Acknowledgement, Recovery, Custom,
            FlappingStart, FlappingEnd,
            DowntimeStart, DowntimeEnd, DowntimeRemoved ]

  vars += {
    // notification_icingaweb2url = "https://www.example.com/icingaweb2"
    // notification_from = "Icinga 2 Host Monitoring <icinga@example.com>"
    notification_logtosyslog = false
  }

  period = "24x7"
}

template Notification "mail-service-notification" {
  command = "mail-service-notification"

  states = [ OK, Warning, Critical, Unknown ]
  types = [ Problem, Acknowledgement, Recovery, Custom,
            FlappingStart, FlappingEnd,
            DowntimeStart, DowntimeEnd, DowntimeRemoved ]

  vars += {
    // notification_icingaweb2url = "https://www.example.com/icingaweb2"
    // notification_from = "Icinga 2 Service Monitoring <icinga@example.com>"
    notification_logtosyslog = false
  }

  period = "24x7"
}