Hi all, I'm trying to setup a distributed monitoring enviroment with 3
hosts: 1 master and 2 clients
I chose the "top down config sync" mode with connection initialization
from clients to server.
My master server is "goccia" and my clients are "DEBCRASH" and "WINDOTTOR2"
Actually the setup is running successfully on goccia and DEBCRASH,
unfortunately i got stuck with the setup on the windows client
"WINDOTTOR2".
 
The zones file of the master host "goccia" is as follow:
----
object Endpoint "goccia.posinega.local" {
}

object Zone "master" {
        endpoints = [ "goccia.posinega.local" ]
}

object Endpoint "DEBCRASH.posinega.local" {
}

object Zone "DEBCRASH.posinega.local" {
        endpoints = [ "DEBCRASH.posinega.local" ]
        parent = "master"
}


object Endpoint "WINDOTTOR2.posinega.local" {
}

object Zone "WINDOTTOR2.posinega.local" {
    endpoints = [ "WINDOTTOR2.posinega.local" ]
    parent = "master"
}

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

----
 the zones.conf @ WINDOTTOR2 is

/*
 * Generated by Icinga 2 node setup commands
 * on 2016-12-04 23:47:59 GTB Standard Time
 */

object Endpoint "goccia.posinega.local" {
    host = "goccia.posinega.local"
    port = "5665"
}

object Zone "master" {
    endpoints = [ "goccia.posinega.local" ]
}

object Endpoint "WINDOTTOR2.posinega.local" {
}

object Zone "WINDOTTOR2.posinega.local" {
    endpoints = [ "WINDOTTOR2.posinega.local" ]
    parent = "master"
}

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

Actually my zones.d directory on the master includes the following files:

root@goccia:/etc/icinga2# ls -l zones.d/*
-rw-r--r-- 1 root root  133 Aug 31 17:07 zones.d/README

zones.d/DEBCRASH.posinega.local:
total 4
-rw-r--r-- 1 root root 383 Nov  6 18:58 hosts.conf

zones.d/global-templates:
total 36
-rw-r--r-- 1 root root  193 Nov  7 00:05 apt.conf
-rw-r--r-- 1 root root 1300 Oct 30 12:57 commands.conf
-rw-r--r-- 1 root root  547 Nov  7 00:12 downtimes.conf
-rw-r--r-- 1 root root  638 Oct 30 12:57 groups.conf
-rw-r--r-- 1 root root  774 Nov  7 00:05 notifications.conf
-rw-r--r-- 1 root root  813 Nov  7 01:52 services.conf
-rw-r--r-- 1 root root 1654 Oct 30 12:57 templates.conf
-rw-r--r-- 1 root root  906 Oct 30 12:57 timeperiods.conf
-rw-r--r-- 1 root root  308 Oct 30 12:57 users.conf

zones.d/WINDOTTOR2.posinega.local:
total 0


In a previous deployment I had also the file
zones.d/WINDOTTOR2.posinega.local/hosts.conf:

object Host "WINDOTTOR2.posinega.local" {
  import "generic-host"
  address = "WINDOTTOR2.posinega.local"
  zone = "master"
  vars.os = "Windows"
}


Now it seems that WINDOTTOR2 is out of sync with regards to the master
goccia, I think it fails the validation because it finds old object in
file like
C:\ProgramData\icinga2\var\lib\icinga2\api\zones\WINDOTTOR2.posinega.local\_etc\hosts.conf
and in
C:\ProgramData\icinga2\var\lib\icinga2\api\packages\_api\WINDOTTOR2-1480887853-1\conf.d\downtimes
Unfortunately removing the files makes the daemon crash, instead keeping
the files makes the daemon on windottor2 fail the validation and prevent
it to complete the startup:

@WINDOTTOR2
c:\Program Files\ICINGA2\sbin>icinga2 daemon -C
information/cli: Icinga application loader (version: v2.5.4)
information/cli: Loading configuration file(s).
information/ConfigItem: Committing config item(s).
information/ApiListener: My API identity: WINDOTTOR2.posinega.local
critical/config: Error: Import references unknown template: 'generic-host'
Location: in
C:\ProgramData\icinga2\var\lib\icinga2\api\zones/WINDOTTOR2.posineg
a.local/_etc/hosts.conf: 2:3-2:23
C:\ProgramData\icinga2\var\lib\icinga2\api\zones/WINDOTTOR2.posinega.local/_etc/
hosts.conf(1): object Host "WINDOTTOR2.posinega.local" {
C:\ProgramData\icinga2\var\lib\icinga2\api\zones/WINDOTTOR2.posinega.local/_etc/
hosts.conf(2):   import "generic-host"

                 ^^^^^^^^^^^^^^^^^^^^^
C:\ProgramData\icinga2\var\lib\icinga2\api\zones/WINDOTTOR2.posinega.local/_etc/
hosts.conf(3):   address = "WINDOTTOR2.posinega.local"
C:\ProgramData\icinga2\var\lib\icinga2\api\zones/WINDOTTOR2.posinega.local/_etc/
hosts.conf(4):   zone = "master"

critical/config: 1 error

Note that "generic-host" object is saved on the file
zones.d/global-templates/templates.conf on the master server, so it
seems the global-templates zone is not acknowledged by the client
windottor2:
  

root@goccia:/etc/icinga2# grep generic-host -A 10
zones.d/global-templates/templates.conf
template Host "generic-host" {
  max_check_attempts = 3
  check_interval = 1m
  retry_interval = 30s

  check_command = "hostalive"
}

/**

Below the log on the master:

root@goccia:/etc/icinga2# cat /var/log/icinga2/icinga2.log | grep -v
IdoMysql | grep WINDOTTOR2
[2016-12-05 00:06:34 +0200] information/ApiListener: New client
connection for identity 'WINDOTTOR2.posinega.local' from
[192.168.101.3]:56411
[2016-12-05 00:06:34 +0200] information/ApiListener: Sending config
updates for endpoint 'WINDOTTOR2.posinega.local'.
[2016-12-05 00:06:34 +0200] information/ApiListener: Syncing zone
'WINDOTTOR2.posinega.local' to endpoint 'WINDOTTOR2.posinega.local'.
[2016-12-05 00:06:34 +0200] information/ApiListener: Syncing global zone
'global-templates' to endpoint 'WINDOTTOR2.posinega.local'.
[2016-12-05 00:06:34 +0200] information/ApiListener: Syncing runtime
objects to endpoint 'WINDOTTOR2.posinega.local'.
[2016-12-05 00:06:34 +0200] information/ApiListener: Finished sending
config updates for endpoint 'WINDOTTOR2.posinega.local'.
[2016-12-05 00:06:34 +0200] information/ApiListener: Sending replay log
for endpoint 'WINDOTTOR2.posinega.local'.
[2016-12-05 00:06:34 +0200] information/ApiListener: Finished sending
replay log for endpoint 'WINDOTTOR2.posinega.local'.
[2016-12-05 00:07:07 +0200] warning/JsonRpcConnection: API client
disconnected for identity 'WINDOTTOR2.posinega.local'
[2016-12-05 00:07:07 +0200] warning/ApiListener: Removing API client for
endpoint 'WINDOTTOR2.posinega.local'. 0 API clients left.

Trying to restart the daemon on the hosts windottor2 or goccia do not
force api connection, the last api connection reported is outdated:

root@goccia:~# tcpdump -n port 5665 and host WINDOTTOR2 -i any &
[1] 10184
root@goccia:~# tcpdump: verbose output suppressed, use -v or -vv for
full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size
262144 bytes

root@goccia:~#
root@goccia:~# systemctl restart icinga2.service
root@goccia:~# jobs
[1]+  Running                 tcpdump -n port 5665 and host WINDOTTOR2
-i any &
root@goccia:~# fg %1
tcpdump -n port 5665 and host WINDOTTOR2 -i any
^C
0 packets captured
0 packets received by filter
0 packets dropped by kernel


I attach the troubleshooting log on windottor2 where you can find the
software versions

Really strange but I don't have any problem with the same top down sync
setup with the other client DEBCRASH (a linux host).

Is there any way to force a flush of the outdated api file on the
client? Maybe using the cli?
Any help will be really appreciated
Sorry for my English

Regards

Luca Cazzaniga

 



Attachment: troubleshooting_2016-12-05_02-45-20.gz
Description: application/gzip

_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to