Eric Hermansson
Eric Hermansson

Reputation: 43

How to add hosts to Icinga2?

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

Upvotes: 1

Views: 8723

Answers (2)

Ganesh Jat
Ganesh Jat

Reputation: 17

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

Upvotes: 0

user3788685
user3788685

Reputation: 3093

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.

Upvotes: 2

Related Questions