如何使用RMQ和InfluxDB

时间:2018-04-17 14:57:54

标签: rabbitmq influxdb sensu

我正在尝试开始使用监控服务器解决方案。我得到了Sensu客户端,RabbitMQ和Uchiwa配置,但后来我尝试使用Graphite但是有很多部分要配置我尝试了InfluxDB。我很难将Sensu配置为InfluxDB。 以下配置中是否缺少部分?

Client [Sensu] > RabbitMQ <> Sensu Server <> InfluxDB <> Grafana

有什么建议吗?

cat influx.json
{
    "influxdb": {
    "hosts"         : ["192.168.1.1"],
    "host"          : "192.168.1.1",
    "port"          : "8086",
    "database"      : "sensumetrics",
    "time_precision": "s",
    "use_ssl"       : false,
    "verify_ssl"    : false,
    "initial_delay" : 0.01,
    "max_delay"     : 30,
    "open_timeout"  : 5,
    "read_timeout"  : 300,
    "retry"         : null,
    "prefix"        : "",
    "denormalize"   : true,
    "status"        : true
}
}


cat handler.json
{
"handlers": {
"influxdb": {
   "type": "pipe",
    "command": "/opt/sensu/embedded/bin/metrics-influxdb.rb"    
}}}

checks1,

 {
  "checks": {
    "check_memory_linux": {
  "handlers": ["influxdb","default"],
  "command": "/opt/sensu/embedded/bin/check-memory-percent.rb -w 90 -c 95",
  "interval": 60,
  "occurrences": 5,
     "subscribers": [ "TEST" ]
  }}}

checks2,

{
"checks": {
"check_cpu_linux-elkctrl-pipe": {
  "type": "metric",
  "command": "/opt/sensu/embedded/bin/check-cpu.rb -w 80 -c 90",
  "subscribers": ["TEST"],
  "interval": 10,
  "handlers": ["debug","influxdb"]
}}}

2 个答案:

答案 0 :(得分:0)

To use InfluxDB to persist your data, you must have:

  • InfluxDB plugin installed (also, installation and usage instructions here)
  • Definitions for the plugin (an influxdb.json containin at least the host, port, user, password and database to be used by Sensu)
    • The definition, as other config files, must be in /etc/sensu/conf.d/
  • Handler configuration set properly (also in conf.d)
  • Mutator for InfluxDB (extensions)

Your checks must send results to the handler, so their definition must contain:

"handlers": [
        "influxdb"
      ]

Or whatever name you gave your handler.

答案 1 :(得分:0)

例如,如果您在上面提供的Influxdb配置是您配置的完整范围,那么似乎缺少Influxdb配置所需的用户名/密码属性。如果他们出现,但没有在帖子中提供,没什么大不了的。但是,我建议您为Sensu日志执行以下操作:

grep -i influxdb /var/logs/sensu/sensu-server.log

查看检查结果是否已发送到您的Influxdb实例。如果是的话,你应该收到一个错误,可能会更多地指出正在发生的事情。

您还可以检查您的涌入日志,看看他们是否从您的Sensu服务器获取帖子:

journalctl -u influxdb.service -f

但是,如果配置中缺少用户名/密码,那就是我开始的第一个地方。