我有一个 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
}
有什么提示吗?
答案1
问题很老套,但是:您需要以某种方式定义远程客户端 (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.
}