Hi.
I said it again in other threads but again here: I totally understand that the start is confusing.
As far as I understand, you are not using the icinga2-director.
The following assumes, that you are not using it.
I have to admit that I am not a big fan of including /etc/icinga2/conf.d/ directory anyways.
It seems to be more confusing than helpful.
I did a new Icinga2 installation with one master and one client.
Icinga2 master, called master : icinga.sandbox.lan
Client/Agent, called client : server-01.sandbox.lan
Notes to the following:
- NOT including /etc/icinga2/conf.d directory. Please disable inclusion in the /etc/icinga2/icinga.conf by commenting it out
- minimal setup
- I left out some comments in the config files which where inserted by Icinga2, for better readability
Here the /etc/icinga2/zones.conf from master and client:
#####################
# On the master
#####################
object Endpoint "icinga.sandbox.lan" {
}
object Zone "master" {
endpoints = [ "icinga.sandbox.lan" ]
}
object Endpoint "server-01.sandbox.lan" {
}
object Zone "server-01.sandbox.lan" {
endpoints = [ "server-01.sandbox.lan" ]
parent = "master"
}
object Zone "global-templates" {
global = true
}
# --------------------------------
#####################
# On the client:
#####################
object Endpoint "icinga.sandbox.lan" {
host = "192.168.178.61"
port = "5665"
}
object Zone "master" {
endpoints = [ "icinga.sandbox.lan" ]
}
object Endpoint "server-01.sandbox.lan" {
}
object Zone "server-01.sandbox.lan" {
endpoints = [ "server-01.sandbox.lan" ]
parent = "master"
}
object Zone "global-templates" {
global = true
}
Again: In advance, please disable including of the conf.d directory in /etc/icinga2/icinga2.conf
Please previously backup your existing /etc/icinga2 directory - which seems always a good idea before changing things.
Step 1: Host: master. Create master directory - if not present:
mkdir /etc/icinga2/zones.d/master
# drwxr-xr-x 2 root root
Step 2: Host: master. Create global-templates directory - if not present:
mkdir /etc/icinga2/zones.d/global-templates
# drwxr-xr-x 2 root root
Step 3: Host: master. Copy contents of /etc/icinga2/conf.d
cp /etc/icinga2/conf.d/* /etc/icinga2/zones.d/master/
Step 4: Host: master. Move commands to global-templates
mv /etc/icinga2/zones.d/master/commands.conf /etc/icinga2/zones.d/global-templates
Step 5: Host: client. Accept config from master
If not already happened in the “icinga node wizard” setup, edit the
/etc/icinga2/features-enabled/api.conf
to the following:
object ApiListener "api" {
accept_config = true
accept_commands = true
}
Step 6: Host: master: Edit the /etc/icinga2/zones.d/master/hosts.conf
# This can be just an example. Please change the IP or hostname to fit your requirements.
# The hostname of the client has to be the same as used with "icinga2 node wizard"
#
# File: /etc/icinga2/zones.d/master/hosts.conf
object Host NodeName {
address = "127.0.0.1"
address6 = "::1"
check_command = "hostalive"
vars.os = "Linux"
vars.http_vhosts["http"] = {
http_uri = "/"
}
vars.http_vhosts["Icinga Web 2"] = {
http_uri = "/icingaweb2"
}
vars.disks["disk /"] = {
disk_partitions = "/"
}
}
object Host "server-01.sandbox.lan" {
import "generic-host"
address = "192.168.178.65"
check_command = "hostalive"
vars.os = "Linux"
vars.disks["disk /"] = {
disk_partitions = "/"
}
}
Basic services should now be available.
The services you want to check have been pre-defined and - for basic usage - don’t need to get modified.
Maybe this is a starting-point.
Hope this helps.
Greetings.