简体   繁体   English

Sensu和石墨。 配置通过AMQP的传输

[英]Sensu and Graphite. Configure transmission through AMQP

I want to use Sensu as monitoring system and Graphite as backend for graphics. 我想将Sensu用作监视系统,将Graphite用作图形的后端。

I wish to configure Sensu for receiving data from RabbitMQ via AMQP protocol that's why I configured Carbon in such way: 我希望配置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

Per my understanding Carbon with some frequency requests data from RabbitMQ (via AMQP) and save it via Whisper. 据我了解,Carbon会通过某些频率请求RabbitMQ的数据(通过AMQP)并通过Whisper保存。

On other side Sensu saves some metrics in RabbitMQ, I configured it in next way: 另一方面,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"
    }
  }
}

And of course I attached this handler in such way: 当然,我以这种方式附加了该处理程序:

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"]
    }
  }
}

Everything fine but Graphite can't draw metrics. 一切正常,但Graphite无法绘制指标。 This is log from Graphite side: 这是石墨方面的日志:

13/06/2016 18:57:16 :: New AMQP connection made

And this is from rabbitMQ on Sensu server side: 这是来自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'"

Why rabbitMQ thinks that "durable": set to "false", when Sensu should set it to true? 当Sensu应该将其设置为true时,为什么rabbitMQ认为“持久”:设置为“ false”?

Can anybody share own expirience with such logic? 任何人都可以通过这种逻辑分享自己的经验吗?

PS. PS。 Configuration with just tcp handler is working fine for me. 仅使用tcp处理程序进行配置对我来说工作正常。

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'"

The exchange metrics_my already exists and has the durable property set to false. 交换metrics_my已存在,并且其metrics_my属性设置为false。 Some other process is now trying to re-declare that same exchange with a different value for durable (true). 现在,其他一些过程正在尝试重新声明具有相同值的相同交换,以实现持久性(true)。

It looks like that when the processes start up they are trying to configure RabbitMQ using the configuration you have specified - making sure the required exchanges and queues exist. 看起来好像进程启动时,它们正在尝试使用您指定的配置来配置RabbitMQ-确保存在所需的交换和队列。

However, RabbitMQ does not allow changing some properties of exchanges and queues after they have been created, so one of the processes is starting up, trying to make sure the exchange exists but is failing because it is specifying a different value for the durable property than what it already is. 但是,RabbitMQ不允许在创建交换和队列后更改其某些属性,因此其中一个进程正在启动,试图确保交换存在但失败,因为它为持久属性指定的值不同于已经是什么了。

My guess is that carbon and sensu have been configured to have a different value of durable for the metrics_my exchange. 我的猜测是,针对metrics_my交换,碳和sensu已配置为具有不同的持久性值。

Based on the snippets of configuration you provided, I don't see an option for changing the durable property for carbon, but you can for sensu. 根据您提供的配置摘要,我看不到用于更改碳的耐用性的选项,但您可以选择sensu。

You need to make everyone agree on what durable should be, delete the exchange (if durable will be different) and restart everything. 您需要让每个人都对持久性应该达成一致,删除交换(如果持久性会有所不同),然后重新启动一切。

PS: The durable property specifies that the exchange should be persisted to disk and survive restarts of the RabbitMQ process. PS:持久属性指定交换应持久保存到磁盘上,并在RabbitMQ进程重启后继续存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM