我想用 Sensu 作为监控系统,用 Graphite 作为图形的后端。
我希望将 Sensu 配置为通过 AMQP 协议从 RabbitMQ 接收数据,这就是我以这种方式配置 Carbon 的原因:
# vim /etc/carbon/carbon.conf
# Enable AMQP if you want to receve metrics using an amqp broker
ENABLE_AMQP = True
# Verbose means a line will be logged for every metric received
# useful for testing
AMQP_VERBOSE = True
AMQP_HOST = 10.0.3.16
AMQP_PORT = 5672
AMQP_VHOST = /sensu
AMQP_USER = sensu
AMQP_PASSWORD = kubuntu710
AMQP_EXCHANGE = metrics_my
AMQP_METRIC_NAME_IN_BODY = True
根据我的理解,Carbon 使用来自 RabbitMQ(通过 AMQP)的一些频率请求数据并通过 Whisper 保存。
另一方面,Sensu 在 RabbitMQ 中保存了一些指标,我通过以下方式对其进行了配置:
root@sensu_server:/etc/sensu/conf.d# vim graphite_handler_amqp.json
{
"handlers": {
"graphite_amqp": {
"type": "transport",
"pipe": {
"type": "topic",
"name": "metrics_my",
"durable": "true"
},
"mutator": "only_check_output"
}
}
}
当然,我以这种方式附加了这个处理程序:
root@sensu_server:/etc/sensu/conf.d# cat metrics_cpu.json
{
"checks": {
"metrics_cpu": {
"type": "metric",
"command": "/opt/sensu/embedded/bin/metrics-cpu-pcnt-usage.rb",
"interval": 10,
"subscribers": ["MONGO"],
"handlers": ["graphite_amqp"]
}
}
}
一切都很好,但 Graphite 无法绘制指标。这是来自石墨端的日志:
13/06/2016 18:57:16 :: New AMQP connection made
这是来自 Sensu 服务器端的 rabbitMQ:
=INFO REPORT==== 13-Jun-2016::15:57:16 ===
accepting AMQP connection <0.25298.0> (10.0.3.95:43722 -> 10.0.3.16:5672)
=ERROR REPORT==== 13-Jun-2016::15:57:16 ===
Channel error on connection <0.25298.0> (10.0.3.95:43722 -> 10.0.3.16:5672, vhost: '/sensu', user: 'sensu'), channel 1:
operation exchange.declare caused a channel exception precondition_failed: "inequivalent arg 'durable' for exchange 'metrics_my' in vhost '/sensu': received 'true' but current is 'false'"
为什么 rabbitMQ 认为“durable”:设置为“false”,而 Sensu 应该将其设置为 true?
任何人都可以用这种逻辑分享自己的经验吗?
PS。仅使用 tcp 处理程序的配置对我来说工作正常。