Monitoring

為什麼 Icinga2 remote apt check 顯示來自 master 的結果?

  • February 8, 2019

我有一個 icinga2 安裝,使用本機代理監視一些 debian 主機。

所有檢查工作正常,除了apt. 顯示的結果取自 icinga2 主機,我不明白為什麼。

這是我的apt服務配置:

apply Service "apt" {
 import "generic-service"

 check_command = "apt"

 assign where (host.name == NodeName || host.vars.linux_ver == "debian")
//  assign where host.name == NodeName
}

有什麼提示嗎?

問題很老,但是:您需要以某種方式定義遠端客戶端(command_endpoint),否則它只會檢查主伺服器。我假設您的代理配置正在執行,因此您已經配置了zones.conf. 我建議為遠端客戶端添加第二個服務:

apply Service "apt2" {
 import "generic-service"
 check_interval = 10m   // * how often to check
 check_command = "apt"  // * call the plugin
 command_endpoint = host.vars.remote_client // * execute the plugin on the remote machine

 //vars.apt_only_critical = "1" //uncomment if you want.

 assign where host.vars.remote_client && host.vars.linux_apt == "1" // * only check where remote client is set and vars.linux_apt is set to "1" 
}

主機配置:

object Host "<HostName>" {
 import "generic-host" // * default stuff
 address = "<HostAddress>" // * default stuff
 vars.linux_apt = "1" // * Set this host to be checked by the new service
 vars.remote_client = "<HostNameAsConfiguredInZones.conf>" // * Needed for the remote service checks. Check `zones.conf` on what to insert here for your host.
}

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