Master1 & Master 2 is not synchronizing

We successfully setup master1 & master2 with a separate db server for icingadb & icingawebdb. To test HA functionality we disabled icinga2 from master1 & then logged in to icingaweb of master2 as we have installed web on both masters. When tried to make a manual check now on any hosts or service we get the following error. This is when we made the command transport of master2 primary. We tried to do the web setup again for web on master2 & the api credentials passed. That’s when we realized whatever host.conf files we created on master1 are not replicating on master2.

Master1 zones.conf –

object Endpoint "A" {
}

object Endpoint "B" {
       host = "B IP"
       port = "5665"

}


object Zone "master" {
        endpoints = [ "A", "B" ]
}

object Zone "global-templates" {
        global = true
}

/*
object Zone "director-global" {
        global = true
}
*/

object Zone "global-config" {
    global = true
}

Master2 Zones.conf

object Endpoint "A" {
        host = "A IP"
        port = "5665"
}

object Zone "master" {
        endpoints = [ "A", "B" ]
}

object Endpoint "B" {
}


object Zone "global-templates" {
        global = true
}

object Zone "director-global" {
        global = true
}

Your help is greatly appreciated. Please do let me know if you need any further logs /info

so ok, now, i copied the api-user.conf on master 2 from /var/lib/icinga2/api … to /etc/cinga2/zone.d/master and the auth issue on master 2 to make a check is gone.But now we get an 404 error because of “no objecs found in Master 2”

ls -Rl /etc/icinga2/zones.d/master
/etc/icinga2/zones.d/master:
total 44
-rw-r--r-- 1 nagios nagios  331 Mar  1 11:35 api-users.conf
-rw-r--r-- 1 nagios nagios   35 Jan 18 09:08 app.conf
-rw-r--r-- 1 nagios nagios  188 Feb 19 10:06 apt.conf
-rw-r--r-- 1 nagios nagios  542 Jan 18 09:08 downtimes.conf
-rw-r--r-- 1 nagios nagios  638 Jan 18 09:08 groups.conf
drwxr-xr-x 2 root   root   4096 Mar  4 09:29 hosts
-rw-r--r-- 1 nagios nagios 1501 Jan 18 09:08 hosts.conf
-rw-r--r-- 1 nagios nagios 2432 Mar  1 09:47 services.conf
-rw-r--r-- 1 nagios nagios 2060 Jan 18 09:08 templates.conf.org
drwxr-xr-x 2 root   root   4096 Feb 28 13:28 test
-rw-r--r-- 1 nagios nagios  732 Jan 18 09:08 timeperiods.conf
 
/etc/icinga2/zones.d/master/hosts:
total 0
 
/etc/icinga2/zones.d/master/test:
total 12
-rw-r--r-- 1 nagios nagios 885 Feb 28 13:28 delei0001.conf
-rw-r--r-- 1 nagios nagios 401 Feb 19 09:45 delei3994.conf
-rw-r--r-- 1 nagios nagios 886 Feb 13 12:59 delei3995.conf

this is same for both masters -
cat /etc/icinga2/features-enabled/api.conf

/**
* The API listener is used for distributed monitoring setups.
*/
object ApiListener "api" {
  accept_config = true
  accept_commands = true
  ticket_salt = TicketSalt
}

The host.conf still dont appear on /var/lib/icinga2/api . Any help is much appreciated

Hello :slight_smile:
If there is no config in /var/lib/icinga2/api on the second master, make sure they are connected correctly.

Check the logs during a config reload.
Make sure that only one master holds config inside of /etc/icinga2/zones.d

Also the zones.conf files on both master should have the same content.

For future posts please use code formatting with

```
Config snippet or code goes here
```
1 Like

Mate, i just emptied /zones.d/master in master 2 & host.conf files started appearing here - /var/lib/icinga2/api .

1 Like