大网数据广告活动
服务器运维问答

Icinga2: Send E-Mail on Host/Service Down

· 52CE 我爱测

I installed and configured Icinga2 with icingaweb2. I added a test-host with a test-service: Let's call it "example.com". This is the test-host: /etc/icinga2/conf.d/hosts/example-com: object Host "example-com" { //Importiert die …

问题原文

原帖链接 · MyFault · CC BY-SA 3.0

I installed and configured Icinga2 with icingaweb2.

I added a test-host with a test-service: Let's call it "example.com".

This is the test-host:

/etc/icinga2/conf.d/hosts/example-com:

object Host "example-com" {
        //Importiert die generische Host-Vorlage aus der template.conf
        import "generic-host"
        //IPv4 Adresse
        address = "2xx.2xx.2xx.2xx"

        //Angabe des Betriebssystemtyps
        vars.os = "Linux OS"
        vars.sla = "24x7"
}

Okay, then we have the service-configuration:

/etc/icinga2/conf.d/hosts/example-com/http.conf

object Service "http" {
    import "generic-service"
    host_name = "example-com"
    check_command = "http"
    vars.sla = "24x7"
}

Of course I added a new user group to /etc/icinga2/conf.d/users.conf

/**
 * The example user 'icingaadmin' and the example
 * group 'icingaadmins'.
 */

object User "icingaadmin" {
  import "generic-user"

  display_name = "Icinga 2 Admin"
  groups = [ "icingaadmins", "linux-admins" ]

  email = "[email omitted]"
}

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

object UserGroup "linux-admins" {
  display_name = "Linux-Administrators"
}

Now I think I have to add the contact_groups to the host. But if I do that the config-check fails :-(

Thanks for your help :-)

社区高分解答

原帖链接 · dnsmichi · CC BY-SA 3.0

You did not define any notification objects, referenced to host/service objects and linked to users and notification commands.

The sample configuration in conf.d/notifications.conf already provide an insight, although you should consider writing your own notification apply rules for hosts and services based on your notification type - be it mail, sms, etc. See using apply notification.

Verify notification objects bring added by invoking:

icinga2 object list --type Notification 

after config validation.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2015-06-15)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。