如何将主机添加到Icinga2?

时间:2016-10-12 17:29:57

标签: ubuntu monitoring icinga icinga2

我在向Icinga2添加主机时遇到问题。我知道可以通过以下命令添加它:

if ($returnValue -eq 0 -or 5)

但我觉得您可以自己添加主机,选择要监控的服务并为主机提供特殊名称和属性。当我通过节点向导添加它们时,我似乎无法找到这些选项。

您是否知道如何在不使用节点向导的情况下添加主机?

祝你好运, 埃里克

2 个答案:

答案 0 :(得分:2)

您需要对Icinga2 docs进行一些背景阅读。它与旧版本和Nagios非常不同。

这是一个非常简单的例子,来自3.1 of the docs

部分
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"
}

这将创建一个名为my-server1的主机,其IP为10.0.0.1,用于检查ICMP和HTTP。有很多选项,需要很多设置,所以你需要熟悉Icinga2的一般配置安排和指令。如果您掌握一般但想了解有关设置配置文件的信息,请参阅section 4 of the docs

答案 1 :(得分:0)

首先配置主服务器(Icinga 2服务器)。

enter image description here

[root @ red〜]#systemctl重新启动icinga2

[root @ red〜]#icinga2 pki票--cn Bharat.centosms.com 84122cd5b3e5387d1c0f239afb9145845c0671ec

[root @ Bharat〜]#百胜安装https://packages.icinga.com/epel/icinga-rpm-release-7-latest.noarch.rpm

[root @ Bharat〜]#yum install icinga2 –y

[root @ Bharat〜]#systemctl启动icinga2 && systemctl启用icinga2

[root @ Bharat〜]#icinga2节点向导

[root @ Bharat〜]#systemctl重新启动icinga2

[root @ red〜]#vi /etc/icinga2/conf.d/hosts.conf enter image description here

##################################Bharat.centosms.com##########


object Zone "Bharat.centosms.com" {
  endpoints = [ "Bharat.centosms.com" ]
  parent = "red.centosms.com"
}
object Endpoint "Bharat.centosms.com" {
  host = "192.168.10.116"
}
object Host "Bharat.centosms.com" {
  import "generic-host"
  address = "192.168.10.116"
  vars.http_vhosts["http"] = {
    http_uri = "/"
  }
    vars.disks["disk"] = {
    }
  vars.disks["disk /"] = {
    disk_partitions = "/"
  }

  vars.notification["mail"] = {
    groups = [ "icingaadmins" ]
  }
  vars.client_endpoint = "Bharat.centosms.com"
}

##################################

[root @ red〜]#systemctl重新启动icinga2