我正在尝试设置对多个客户端的分布式 icinga 监控。
我已经根据需要设置了区域,即:
1)在主节点上它看起来像这样
object Zone "edge-dev" {
parent="master"
endpoints=[
"edge-dev-docker",
"edge-dev-aws"
]
}
object Endpoint "edge-dev-docker" {}
object Endpoint "edge-dev-aws" {}
object Endpoint "icinga.master" {}
object Zone "master" {
endpoints = [ "icinga.master" ]
}
常量.conf:
...
const NodeName = "icinga.master"
const ZoneName = "icinga.master"
...
2) 在每个客户端节点上:
object Endpoint "icinga.master" {
host = "icinga.master"
port = "5665"
}
object Zone "master" {
endpoints = [ "icinga.master" ]
}
object Zone "global-templates" {
global = true
}
object Zone "director-global" {
global = true
}
object Endpoint NodeName {}
object Zone ZoneName {
endpoints = [ NodeName ]
parent = "master"
}
和常量.conf:
const NodeName = "edge-dev-docker"
const ZoneName = "edge-dev"
和
const NodeName = "edge-dev-aws"
const ZoneName = "edge-dev"
对于每个节点
现在,我正在尝试对每个客户端节点上的 squid 进程进行一些监控:
curl -k -s -u user:pass -H 'Accept: application/json' -X PUT 'https://$ICINGA_HOST:$ICINGA_PORT/v1/objects/checkcommands/check_process' -d '{ "templates": [ "plugin-check-command" ], "attrs": { "command": [ "/usr/lib/nagios/plugins/check_procs" ], "arguments": { "--ereg-argument-array": "$process_regex$", "-c": "$range$" }, "vars.process_regex": "", "vars.range": "1:1", "zone": "edge-dev" } }' | python -m json.tool
curl -k -s -u user:pass -H 'Accept: application/json' -X PUT 'https://$ICINGA_HOST:$ICINGA_PORT/v1/objects/hosts/edge-dev-ip-docker' -d '{ "templates": [ "generic-host" ], "attrs": { "address": "ip-docker", "check_command": "ssh", "vars.os" : "Linux", "zone": "edge-dev" } }' | python -m json.tool
curl -k -s -u user:pass -H 'Accept: application/json' -X PUT 'https://$ICINGA_HOST:$ICINGA_PORT/v1/objects/hosts/edge-dev-ip-aws' -d '{ "templates": [ "generic-host" ], "attrs": { "address": "ip-aws", "check_command": "ssh", "vars.os" : "Linux", "zone": "edge-dev" } }' | python -m json.tool
curl -k -s -u user:pass -H 'Accept: application/json' -X PUT 'https://$ICINGA_HOST:$ICINGA_PORT/v1/objects/services/edge-dev-ip-aws!edge-dev-ip-aws-squid' -d '{ "templates": [ "generic-service" ], "attrs": { "check_command": "check_process", "vars.process_regex": "'/usr/sbin/squid'", "vars.range": "1:2", "check_interval": 30,"retry_interval": 30, "max_check_attempts": 3, "zone": "edge-dev" } }' | python -m json.tool
curl -k -s -u user:pass -H 'Accept: application/json' -X PUT 'https://$ICINGA_HOST:$ICINGA_PORT/v1/objects/services/edge-dev-ip-docker!edge-dev-ip-docker-squid' -d '{ "templates": [ "generic-service" ], "attrs": { "check_command": "check_process", "vars.process_regex": "'/usr/sbin/squid'", "vars.range": "1:2", "check_interval": 30,"retry_interval": 30, "max_check_attempts": 3, "zone": "edge-dev" } }' | python -m json.tool
所有对象都很好地传播到客户端节点。问题是,现在每个客户端都执行这两种服务(即使不是“他的”服务,即“拥有”服务的主机也不是唯一运行它的主机)。
为了使问题更清楚 - 现在edge-dev-ip-aws
主机和edge-dev-ip-docker
主机都运行这两个服务edge-dev-ip-docker!edge-dev-ip-docker-squid
和edge-dev-ip-aws!edge-dev-ip-docker-aws
我怎样才能让每个人只运行它自己的服务?
任何帮助或提示将不胜感激:)