How to add your first host using icinga2 director

Add your first host using icinga2 director after performing clean installation as I have described earlier this month - icinga2 plus icingaweb2 and director module installation procedure.

Log in to the monitoring system.

Add new Icinga service template.

Define dummy service template.

Add new Icinga host template

Define dummy host template.

Add dummy service to dummy host template.

Add new Icinga Host.

Define Icinga host.

Deploy configuration.

Generate request ticket on your Icinga2 master.

master$ sudo icinga2 pki ticket --cn 'monitoring.fishsilentcruise.space'
9b603dd9edf5bd62a569a6dad9bbea83b672c4fd

Install icinga2 on particular node.

monitoring$ sudo apt-get install icinga2

Setup this node.

monitoring$ sudo icinga2 node wizard
Welcome to the Icinga 2 Setup Wizard!

We'll guide you through all required configuration details.



Please specify if this is a satellite setup ('n' installs a master setup) [Y/n]: 
Starting the Node setup routine...
Please specify the common name (CN) [monitoring.fishsilentcruise.space]: 
Please specify the master endpoint(s) this node should connect to:
Master Common Name (CN from your master setup): master.fishsilentcruise.space
Do you want to establish a connection to the master from this node? [Y/n]: 
Please fill out the master connection information:
Master endpoint host (Your master's IP address or FQDN): master.fishsilentcruise.space
Master endpoint port [5665]: 
Add more master endpoints? [y/N]: 
Please specify the master connection for CSR auto-signing (defaults to master endpoint host):
Host [master.fishsilentcruise.space]: 
Port [5665]: 
information/base: Writing private key to '/etc/icinga2/pki/monitoring.key'.
information/base: Writing X509 certificate to '/etc/icinga2/pki/monitoring.crt'.
information/cli: Fetching public certificate from master (master.fishsilentcruise.space, 5665):

Certificate information:

 Subject:     CN = master.fishsilentcruise.space
 Issuer:      CN = Icinga CA
 Valid From:  Oct 27 23:26:56 2017 GMT
 Valid Until: Oct 23 23:26:56 2032 GMT
 Fingerprint: 3B 91 87 92 D8 33 EA FE CD 76 0D AB A9 F6 D4 81 27 6C D8 C3 

Is this information correct? [y/N]: y
information/cli: Received trusted master certificate.

Please specify the request ticket generated on your Icinga 2 master.
 (Hint: # icinga2 pki ticket --cn 'monitoring.fishsilentcruise.space'): 9b603dd9edf5bd62a569a6dad9bbea83b672c4fd
information/cli: Requesting certificate with ticket '9b603dd9edf5bd62a569a6dad9bbea83b672c4fd'.

information/cli: Created backup file '/etc/icinga2/pki/monitoring.crt.orig'.
information/cli: Writing signed certificate to file '/etc/icinga2/pki/monitoring.crt'.
information/cli: Writing CA certificate to file '/etc/icinga2/pki/ca.crt'.
Please specify the API bind host/port (optional):
Bind Host []: 
Bind Port []: 
Accept config from master? [y/N]: y
Accept commands from master? [y/N]: y
information/cli: Disabling the Notification feature.
Disabling feature notification. Make sure to restart Icinga 2 for these changes to take effect.
information/cli: Enabling the Apilistener feature.
Enabling feature api. Make sure to restart Icinga 2 for these changes to take effect.
information/cli: Created backup file '/etc/icinga2/features-available/api.conf.orig'.
information/cli: Generating local zones.conf.
information/cli: Dumping config items to file '/etc/icinga2/zones.conf'.
information/cli: Created backup file '/etc/icinga2/zones.conf.orig'.
information/cli: Updating constants.conf.
information/cli: Created backup file '/etc/icinga2/constants.conf.orig'.
information/cli: Updating constants file '/etc/icinga2/constants.conf'.
information/cli: Updating constants file '/etc/icinga2/constants.conf'.
Done.

Now restart your Icinga 2 daemon to finish the installation!

Add director-global zone.

monitoring$ cat << EOF | sudo tee -a /etc/icinga2/zones.conf
object Zone "director-global" {
  global = true
}
EOF

Clean up local configuration on this node.

monitoring$ sudo echo -n | sudo tee /etc/icinga2/conf.d/{apt.conf,commands.conf,groups.conf,hosts.conf,downtimes.conf,notifications.conf,satellite.conf,services.conf,templates.conf,timeperiods.conf,users.conf}

Restart icinga2 service on this node.

$ sudo service restart icinga2

Verify that everything works.

Additional notes

You can use the Director-assisted setup to configure a top down approach.

Feel free to experiment.

About Milosz Galazka

Milosz is a Linux Foundation Certified Engineer working for a successful Polish company as a system administrator and a long time supporter of Free Software Foundation and Debian operating system. He is also open for new opportunities and challenges.