我在主节点上安装了 icinga2 和 icingaweb2 我在另外 3 台服务器上安装了 icinga2 作为代理节点。我使用icinga2 node wizard
,将它们配置为代理并允许它们连接到主节点。我没有看到任何错误消息,看起来它们已成功连接。
还需要做什么才能使它们在主节点中可见吗?
icingaweb2 界面只显示主节点,其余的都没有显示。
我按照此处指定的方式配置了代理:https://icinga.com/docs/icinga2/latest/doc/06-distributed-monitoring/#agentsatellite-setup
我已打开从主服务器到代理服务器以及从代理服务器到主服务器的端口 5665。
在主服务器上签署证书后,我将在所有节点的主日志中收到以下内容
information/ApiListener: New client connection for identity 'NODE_NAME' from [145.239.141.102]:47518 (no Endpoint object found for identity)
我以为我不需要在父节点中手动添加配置..但由于我收到此错误,因此我为每个代理节点添加了以下内容:
object Zone "<HOST-NAME>" {
endpoints = ["<HOST-NAME>"]
parent = "master"
}
object Endpoint "<HOST-NAME>" {
host = "<HOST-NAME>"
}
所以我为所有 3 台带有代理的服务器添加了这个,现在我没有看到任何错误,但它们仍然没有出现在 icingaweb2 界面中。
这是我在 master 上重新启动 icinga2 时的 icinga2 日志:
[2020-04-22 08:12:39 +0000] information/FileLogger: 'main-log' started.
[2020-04-22 08:12:39 +0000] information/ApiListener: 'api' started.
[2020-04-22 08:12:39 +0000] information/ApiListener: Started new listener on '[0.0.0.0]:5665'
[2020-04-22 08:12:39 +0000] information/ApiListener: Reconnecting to endpoint 'AGENT-HOST-03' via host 'AGENT-HOST-03' and port '5665'
[2020-04-22 08:12:39 +0000] information/ApiListener: Reconnecting to endpoint 'AGENT-HOST-02' via host 'AGENT-HOST-02' and port '5665'
[2020-04-22 08:12:39 +0000] information/DbConnection: 'ido-pgsql' started.
[2020-04-22 08:12:39 +0000] information/ApiListener: Reconnecting to endpoint 'AGENT-HOST-01' via host 'AGENT-HOST-01' and port '5665'
[2020-04-22 08:12:39 +0000] information/NotificationComponent: 'notification' started.
[2020-04-22 08:12:39 +0000] information/CheckerComponent: 'checker' started.
[2020-04-22 08:12:39 +0000] information/ConfigItem: Activated all objects.
[2020-04-22 08:12:39 +0000] information/IdoPgsqlConnection: 'ido-pgsql' resumed.
[2020-04-22 08:12:39 +0000] information/DbConnection: Resuming IDO connection: ido-pgsql
[2020-04-22 08:12:39 +0000] information/IdoPgsqlConnection: PGSQL IDO instance id: 1 (schema version: '1.14.3')
[2020-04-22 08:12:39 +0000] information/ApiListener: New client connection for identity 'AGENT-HOST-02' to [51.178.76.91]:5665
[2020-04-22 08:12:39 +0000] information/ApiListener: New client connection for identity 'AGENT-HOST-01' to [51.178.91.176]:5665
[2020-04-22 08:12:39 +0000] information/ApiListener: Sending config updates for endpoint 'AGENT-HOST-02' in zone 'AGENT-HOST-02'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Sending config updates for endpoint 'AGENT-HOST-01' in zone 'AGENT-HOST-01'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Finished sending config file updates for endpoint 'AGENT-HOST-02' in zone 'AGENT-HOST-02'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Finished sending config file updates for endpoint 'AGENT-HOST-01' in zone 'AGENT-HOST-01'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Syncing runtime objects to endpoint 'AGENT-HOST-01'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Syncing runtime objects to endpoint 'AGENT-HOST-02'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Finished syncing runtime objects to endpoint 'AGENT-HOST-01'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Finished sending runtime config updates for endpoint 'AGENT-HOST-01' in zone 'AGENT-HOST-01'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Sending replay log for endpoint 'AGENT-HOST-01' in zone 'AGENT-HOST-01'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Finished syncing runtime objects to endpoint 'AGENT-HOST-02'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Finished sending runtime config updates for endpoint 'AGENT-HOST-02' in zone 'AGENT-HOST-02'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Sending replay log for endpoint 'AGENT-HOST-02' in zone 'AGENT-HOST-02'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Finished sending replay log for endpoint 'AGENT-HOST-01' in zone 'AGENT-HOST-01'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Finished syncing endpoint 'AGENT-HOST-01' in zone 'AGENT-HOST-01'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Finished reconnecting to endpoint 'AGENT-HOST-01' via host 'AGENT-HOST-01' and port '5665'
[2020-04-22 08:12:39 +0000] information/ApiListener: Finished sending replay log for endpoint 'AGENT-HOST-02' in zone 'AGENT-HOST-02'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Finished syncing endpoint 'AGENT-HOST-02' in zone 'AGENT-HOST-02'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Finished reconnecting to endpoint 'AGENT-HOST-02' via host 'AGENT-HOST-02' and port '5665'
[2020-04-22 08:12:39 +0000] information/ApiListener: New client connection for identity 'AGENT-HOST-03' to [145.239.141.102]:5665
[2020-04-22 08:12:39 +0000] information/ApiListener: Sending config updates for endpoint 'AGENT-HOST-03' in zone 'AGENT-HOST-03'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Finished sending config file updates for endpoint 'AGENT-HOST-03' in zone 'AGENT-HOST-03'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Syncing runtime objects to endpoint 'AGENT-HOST-03'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Finished syncing runtime objects to endpoint 'AGENT-HOST-03'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Finished sending runtime config updates for endpoint 'AGENT-HOST-03' in zone 'AGENT-HOST-03'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Sending replay log for endpoint 'AGENT-HOST-03' in zone 'AGENT-HOST-03'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Finished sending replay log for endpoint 'AGENT-HOST-03' in zone 'AGENT-HOST-03'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Finished syncing endpoint 'AGENT-HOST-03' in zone 'AGENT-HOST-03'.
[2020-04-22 08:12:39 +0000] information/ApiListener: Finished reconnecting to endpoint 'AGENT-HOST-03' via host 'AGENT-HOST-03' and port '5665'
[2020-04-22 08:12:39 +0000] information/IdoPgsqlConnection: Finished reconnecting to 'ido-pgsql' database 'icinga2' in 0.0555351 second(s).
[2020-04-22 08:12:39 +0000] information/JsonRpcConnection: Received certificate request for CN 'AGENT-HOST-01' signed by our CA.
[2020-04-22 08:12:39 +0000] information/JsonRpcConnection: The certificate for CN 'AGENT-HOST-01' is valid and uptodate. Skipping automated renewal.
[2020-04-22 08:12:39 +0000] information/JsonRpcConnection: Received certificate request for CN 'AGENT-HOST-02' signed by our CA.
[2020-04-22 08:12:39 +0000] information/JsonRpcConnection: The certificate for CN 'AGENT-HOST-02' is valid and uptodate. Skipping automated renewal.
[2020-04-22 08:12:39 +0000] information/JsonRpcConnection: Received certificate request for CN 'AGENT-HOST-03' signed by our CA.
[2020-04-22 08:12:39 +0000] information/JsonRpcConnection: The certificate for CN 'AGENT-HOST-03' is valid and uptodate. Skipping automated renewal.
[2020-04-22 08:12:49 +0000] information/WorkQueue: #5 (ApiListener, RelayQueue) items: 0, rate: 0.233333/s (14/min 14/5min 14/15min);
[2020-04-22 08:12:49 +0000] information/WorkQueue: #6 (ApiListener, SyncQueue) items: 0, rate: 0/s (0/min 0/5min 0/15min);
[2020-04-22 08:12:49 +0000] information/WorkQueue: #7 (IdoPgsqlConnection, ido-pgsql) items: 0, rate: 0.25/s (15/min 15/5min 15/15min);
任何有关此问题的信息都将不胜感激。
答案1
问题终于解决了。
这就是我为了找到解决方案所做的事情:
我家里有两台 gentoo 服务器。我在一台上安装了 icinga 作为主服务器,在另一台上安装了 icinga 作为节点,我不需要再在主节点上添加任何配置就可以检测到从属节点,而且它会自动检测。
我注意到在 gentoo 上我安装了 icinga 2.11.3,而在 ubuntu 上安装的是 2.10。
今天我更新了软件包,更新到了 2.11.x,但问题并没有解决。
因此我转到我的 gentoo master icinga2 服务器并检查其配置,我注意到这就是我需要在主节点配置中添加的内容以检测每个主机:
object Host "<ENDPOINT_NAME>" {
address = "<HOST_IP_OR_DNS>"
check_command = "hostalive"
vars.os = "Linux"
}
object Endpoint "<ENDPOINT_NAME>" {
}
object Zone "<ENDPOINT_NAME>" {
endpoints = ["<ENDPOINT_NAME>"]
parent = "master"
}
因此在新版本和配置中我不需要在主服务器上手动签署并接受证书。
我不知道为什么在 gentoo 上我不需要手动添加此配置。如果我进一步研究配置,我可能已经弄明白了,但现在我不介意在每个主机的主节点上手动添加它。
就是这样...主机已被正确检测到。
感谢大家!