1

I'm having problem adding a host to Icinga2. I know that it is possible to add it via the following command:

icinga2 node wizard

But I have a feeling that you could add the hosts yourself, choosing which services you would like to monitor and giving your host special names and attributes. I can't seem to find those options when I add them using via the node wizard.

Do you have a clue on how to add a host without using the node wizard?

Best regards, Eric

2 Answers2

2

You need to do some background reading of the Icinga2 docs. Its very different from the old version and of Nagios.

This is a very simple example taken from section 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"
}

This would create a host called my-server1 with the IP of 10.0.0.1 checking it for ICMP and HTTP. There are a lot of options and a lot of setup required so you need to get familiar with the general config arrangements and directives of Icinga2. If you have a general grasp but want to know about setting up the config files see section 4 of the docs.

user3788685
  • 2,943
  • 5
  • 26
  • 45
  • With this answer and a bit more research I managed to find the soluiton. Thank you! @user3788685 – Eric Hermansson Oct 13 '16 at 07:59
  • no problems :) its a bit of a learning curve if your coming from an older system, but there is lots of cool stuff you can do. If you run into more troubles just post a fresh question and im sure someone should be able to help you out. – user3788685 Oct 13 '16 at 16:28
0

First Configuring Master server (Icinga 2 Server).

enter image description here

[root@red ~]# systemctl restart icinga2

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

[root@Bharat ~]# yum install https://packages.icinga.com/epel/icinga-rpm-release-7-latest.noarch.rpm

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

[root@Bharat ~]# systemctl start icinga2 && systemctl enable icinga2

[root@Bharat ~]# icinga2 node wizard

[root@Bharat ~]# systemctl restart 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 restart icinga2

Ganesh Jat
  • 19
  • 4