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….)

11 Comments on “How to Add Remote Linux Host on Icinga2 Server to monitor”

  1. Thank you. this is great for a few nodes. I’m looking to do this programmatically to install icinga2 and provision thousands of nodes. Ithere a way to create an “answer file” so I can run the icinga2 node wizard and get every answer answered with the answer file on the client side, and on the server side either leverage the API for node registration or some other method to add clients.

  2. I saw the use of ‘icinga2 node list’ ….which was deprecated before the last Update of this article. Do you have any intentions of doing another update of the procedure to use the current method(s)? I was starting to follow this guide until I saw this. Using this article would potentially put “OLD” methods into a new configuration that would later not work.

  3. I’m getting a lot of fails in my Icinga2 master after I generated the config for the client. Every config item is showing an error saying that the UserGroup ‘icingaadmins’ doesn’t exist. This is correct, it does not exist on my master, I created my own users, groups, notification commands, etc. I don’t want the client to send out any notifications, it’s just a node to monitor, I still want the master only to send out notifications, etc.

    How do I get past this? Do I have to update all my users, groups, host groups, service groups, etc on the node? that’s a lot of work if I want to add multiple target servers for monitoring!

    Thanks for any advice you can provide!

    h

    1. @JD,
      It seem’s you have missed something while configuring, check the error log file to get more details about it. Also share the error message so that i can help you further.

      1. There is nothing logged in error.log on both client and server

        below is my configuration

        ON ICICNGA SERVER

        [root@icinga2 ~]# icinga2 node list
        Node ‘Atlas’ (last seen: Wed Aug 24 08:27:31 2016)
        * Host ‘Atlas’
        * Service ‘apt’
        * Service ‘disk’
        * Service ‘disk /’
        * Service ‘http’
        * Service ‘icinga’
        * Service ‘load’
        * Service ‘ping4’
        * Service ‘ping6’
        * Service ‘procs’
        * Service ‘ssh’
        * Service ‘swap’
        * Service ‘users’

        ===========================================

        /etc/icinga2/zones.conf

        *
        * Generated by Icinga 2 node setup commands
        * on 2016-08-23 13:15:49 +0200
        */

        object Endpoint “icinga2” {
        }

        object Zone ZoneName {
        endpoints = [ “icinga2” ]
        }

        object Endpoint “Atlas” {
        host = “192.168.0.58”
        }

        object Zone “Atlas” {
        endpoints = [ “Atlas” ]
        parent = “icinga2”
        }

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

        on ICICNGA CLIENT

        /etc/icinga2/zones.conf

        /*
        * Generated by Icinga 2 node setup commands
        * on 2016-08-23 16:58:33 +0530
        */

        object Endpoint “icinga2” {
        host = “192.168.0.190”
        port = “5665”
        }

        object Zone “master” {
        endpoints = [ “icinga2” ]
        }

        object Endpoint “Atlas” {
        }

        object Zone “Atlas” {
        endpoints = [ “Atlas” ]
        parent = “master”
        }

Leave a Reply

Your email address will not be published. Required fields are marked *