How to Add Remote Linux Host on Icinga2 Server to monitor

The setup wizard will do the following:

  • Generate a new self-signed certificate and copy it into /etc/icinga2/pki
  • Store the master’s certificate as trusted certificate for requesting a new signed certificate (manual step when using node setup).
  • Request a new signed certificate from the master and store updated certificate and master CA in /etc/icinga2/pki
  • Generate a local zone and endpoint configuration for this client and the provided master information (based on FQDN)
  • Disabling the notification feature for this client
  • Enabling the api feature, and setting optional bind_host and bind_port
  • Setting the NodeName constant in constants.conf

Verify the modified configuration

# Verify NodeName & ZoneName is correct #
# grep '2daygeek' /etc/icinga2/constants.conf
const NodeName = "2daygeek"
const ZoneName = "2daygeek"

# Your Zone.conf files should be like this #
# cat /etc/icinga2/zones.conf
/*
 * Generated by Icinga 2 node setup commands
 * on 2016-01-27 17:23:42 +0530
 */

object Endpoint "vps50253.vps.ovh.ca" {
	host = "192.99.246.33"
	port = "5665"
}

object Zone "master" {
	endpoints = [ "vps50253.vps.ovh.ca" ]
}

object Endpoint "2daygeek" {
}

object Zone "2daygeek" {
	//this is the local node = "2daygeek"
	endpoints = [ "2daygeek" ]
	parent = "master"
}

The setup wizard does not automatically restart Icinga2, So Restart the Icinga2 and check the status everything is fine.

# For SysVinit Systems #
# service icinga2 restart
# service icinga2 status

# For Systemd Systems #
# systemctl restart icinga2.service
# systemctl status icinga2.service

Icinga2 Master : Discover Client Services on the Master

Icinga 2 clients will sync their locally defined objects to the defined master node. That way you can list, add, filter and remove nodes based on their node, zone, host or service name.

# icinga2 node list
Node '2daygeek' (last seen: Wed Jan 27 07:46:12 2016)
    * Host '2daygeek'
        * Service 'apt'
        * Service 'http'
        * Service 'swap'
        * Service 'ssh'
        * Service 'disk /'
        * Service 'users'
        * Service 'load'
        * Service 'disk'
        * Service 'ping6'
        * Service 'icinga'
        * Service 'ping4'
        * Service 'procs'

Generate Configuration for Client Services on the Master
There is a dedicated Icinga 2 CLI command for updating the client services on the master, generating all required configuration.

# icinga2 node update-config
information/cli: Updating node configuration for 
Node '2daygeek' (last seen: Wed Jan 27 07:46:12 2016)
    * Host '2daygeek'
        * Service 'apt'
        * Service 'http'
        * Service 'swap'
        * Service 'ssh'
        * Service 'disk /'
        * Service 'users'
        * Service 'load'
        * Service 'disk'
        * Service 'ping6'
        * Service 'icinga'
        * Service 'ping4'
        * Service 'procs'
information/cli: Adding host '2daygeek' to the repository.
information/cli: Dumping changelog items to file '/var/lib/icinga2/repository/changes/1453898789.045948-Host-022e60379cb843702161ca4697f0adc1a9521419c65536f3be7c13dfa587092f.change'
information/cli: Dumping changelog items to file '/var/lib/icinga2/repository/changes/1453898789.0465331-Service-5009a047a11fbd680bb40d2f23cd3fcd626ac2d672c38e16f53bd622c3961534.change'
.
.
information/cli: Writing config object 'ping4' to file '/etc/icinga2/repository.d/hosts/2daygeek/ping4.conf'
information/cli: Writing config object 'procs' to file '/etc/icinga2/repository.d/hosts/2daygeek/procs.conf'
information/cli: Writing config object '2daygeek' to file '/etc/icinga2/repository.d/endpoints/2daygeek.conf'
information/cli: Writing config object '2daygeek' to file '/etc/icinga2/repository.d/zones/2daygeek.conf'
Make sure to reload Icinga 2 for these changes to take effect.

By default, the following additional configuration is generated:

  • add Endpoint and Zone objects for the newly added node
  • add cluster-zone health check for the master host for reachability and dependencies
  • use the default templates satellite-host and satellite-service defined in /etc/icinga2/conf.d/satellite.conf
  • apply a dependency for all other hosts on the remote satellite prevening failure checks/notifications

After updating the configuration repository, make sure to reload Icinga 2.

# For SysVinit systems #
# service icinga2 reload

# For Systemd systems #
# systemctl reload icinga2.service

Navigate to your Icingaweb2 and see, the newly added Remote Linux Host.
add-remote-linux-host-into-icinga2-server-1
Enjoy….)

You may also like...