Monitoring

讓代理節點顯示在 icingaweb2 的主節點上

  • May 3, 2020

我在主節點上安裝了 icinga2 和 icingaweb2 我在另外 3 個伺服器上安裝了 icinga2 作為代理節點。我使用icinga2 node wizard,將它們配置為代理並允許它們連接到主節點。我沒有看到任何錯誤消息,看起來它們已成功連接。

為了讓它們在主節點中可見,還需要做些什麼嗎?

icingaweb2 界面只顯示了主節點,其餘的都沒有顯示。

我按照此處的說明配置了代理:https ://icinga.com/docs/icinga2/latest/doc/06-distributed-monitoring/#agentsatellite-setup

我打開了從主機到代理以及從代理到主機的埠 5665。

在 master 中籤署證書後,我將在所有節點的 master 日誌中收到以下內容

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);

任何有關此問題的資訊將不勝感激。

問題終於解決了。

這就是我提出解決方案的方法:

我家有兩台gentoo伺服器。我在一個上安裝了icinga作為master,另一個作為node,我不需要在master節點中添加任何配置來檢測slave節點,它是自動檢測的。

我注意到在gentoo上我安裝了icinga 2.11.3,而在ubuntu上它是2.10。

今天我更新了軟體包,它更新到 2.11.x 但它沒有解決問題。

所以我去了我的 gentoo 主 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"
}

所以在新版本和配置中我不需要手動簽署和接受master上的證書。

我不知道為什麼在 gentoo 上我不需要手動添加這個配置.. 如果我要調查更多配置我可能會想出來但我現在不介意在每個主機的主節點上手動添加這個.

就是這樣……主機被正確檢測到。

謝謝大家!

引用自:https://serverfault.com/questions/1013503