配置Sensu以在Influxdb中发送指标

问题描述 投票:0回答:1

我正在尝试使用sensu将指标发送到UDP中的Influxdb。

我设置了我的Influxdb数据库:

# echo "cpu value=1" | nc -C -w 1 -u localhost 8089
# echo "select * from cpu" | influx -database sensu
name: cpu
time                value
1490898218118704438 1

我从存储库(https://github.com/sensu-plugins/sensu-plugins-influxdb)安装了插件:

# sensu-install -p influxdb
# cp /opt/sensu/embedded/bin/mutator-influxdb-line-protocol.rb /etc/sensu/extensions/

根据doc配置处理程序:

{
"handlers": {
  "influxdb": {
    "type": "udp",
    "socket": {
      "host": "localhost",
      "port": 8089
    },
    "mutator": "influxdb_line_protocol"
  }
  }

并配置了一个检查以使用此处理程序:

{
"checks": {
  "cpu-metrics": {
    "command": "/opt/sensu/embedded/bin/metrics-cpu-pcnt-usage.rb",
    "handlers": [
      "influxdb"
    ],
    "interval": 60,
    "subscribers": [
      "production"
    ],
    "type": "metric",
    "standalone": false
  }
}
}

现在,当我重新启动我的sensu-server时,我可以看到加载的扩展名:

{“timestamp”:“2017-03-30T19:53:05.083622 + 0000”,“level”:“warn”,“message”:“loaded extension”,“type”:“mutator”,“name”:“Influxdb_line_protocol “,”description“:”返回为InfluxDB的行协议格式化的检查输出“}

我可以看到客户端收集的指标:

{“timestamp”:“2017-03-30T20:08:49.940732 + 0000”,“level”:“info”,“message”:“收到检查请求”,“检查”:{“command”:“/ opt /意义上/嵌入/ bin中/指标-CPU-PCNT-usage.rb”, “处理程序”:[ “influxdb”], “类型”: “公制”, “独立”:假, “姓名”: “CPU-度量” ,“已发布”:1490904529}} {“timestamp”:“2017-03-30T20:08:51.150984 + 0000”,“level”:“info”,“message”:“发布检查结果”,“有效负载”:{ “客户端”: “诺特”, “检查”:{ “命令”: “/选择/意义上/嵌入/ bin中/指标-CPU-PCNT-usage.rb”, “处理程序”:[ “指标”],“类型“:” 公制”, “独立”:假, “姓名”: “CPU-度量”, “发出”:1490904529, “间隔”:60, “用户”:[ “生产”], “执行”:1490904529, “duration”:1.21,“output”:“nott.cpu.user 0.25 1490904531 \ nnott.cpu.nice 0.00 1490904531 \ nnott.cpu.system 0.00 1490904531 \ nnott.cpu.idle 99.25 1490904531 \ nnott.cpu.iowait 0.00 1490904531 \ nnott.cpu.irq 0.00 1490904531 \ nnott.cpu.softirq 0.00 1490904531 \ nnott.cpu.steal 0.50 1490904531 \ nnott.cpu.guest 0.00 1490904531 \ n“,”status“:0}}}

但是我的Influxdb数据库中还没有更多内容。

influx -database sensu
Connected to http://localhost:8086 version 1.2.1
InfluxDB shell version: 1.2.1
> show measurements;
name: measurements
name
----
cpu

任何见解?

更新:根据评论请求,这是我的Influxdb UDP配置:

[[udp]]
  enabled = true
  bind-address = "127.0.0.1:8089"
  database = "sensu"
  retention-policy = ""
  batch-size = 5000
  batch-pending = 10
  batch-timeout = "1s"
  read-buffer = 0

更新2:如果我添加调试处理程序,我可以在服务器日志中看到度量检查的结果:

{“timestamp”:“2017-04-15T13:05:46.0​​47354 + 0000”,“level”:“info”,“message”:“handler extension output”,“extension”:{“type”:“extension”, “名”: “调试”}, “事件”:{ “ID”: “1303c9d3-096c-4744-9fdc-9566c831270c”}, “输出”: “{\” 客户\ “:{\” 名称\“: \ “诺特\”,\ “地址\”:\ “127.0.0.1 \”,\ “环境\”:\ “制作\”,\ “订阅\”:\ “证书\”,\ “制作\” ,\ “客户端:诺特\”],\ “插座\”:{\ “绑定\”:\ “127.0.0.1 \”,\ “端口\”:3030},\ “版本\”:\“0.28。 2 \”,\ “时间戳\”:1492261543},\ “检查\”:{\ “命令\”:\ “/选择/意义上/嵌入/ bin中/指标-CPU-PCNT-usage.rb \”,\ “处理程序\”:[\ “度量\”],\ “间隔\”:60,\ “用户\”:[\ “生产\”],\ “类型\”:\ “公制\”,\“独立\ “:真实的,\” 名称\ “:\” CPU-指标\”,\ “出台\”:1492261544,\ “执行\”:1492261544,\ “期限\”:1.205,\ “输出\”:\ “nott.cpu.user 0.75 1492261546 \ nnott.cpu.nice 0.00 1492261546 \ nnott.cpu.system 0.00 1492261546 \ nnott.cpu.idle 99.00 1492261546 \ nnott.cpu.iowait 0.00 1492261546 \ nnott.cpu.irq 0.00 1492261546 \ nnott .cpu.softirq 0.00 1492261546 \ nnott.cpu.steal 0.25 1 492261546 \ nnott.cpu.guest 0.00 1492261546 \ n \“,\”status \“:0,\”history \“:[\”0 \“,\”0 \“,\”0 \“,\”0 \” \ “0 \” \ “0 \” \ “0 \” \ “0 \” \ “0 \” \ “0 \” \ “0 \” \ “0 \” ,\ “0 \” \ “0 \” \ “0 \” \ “0 \” \ “0 \” \ “0 \” \ “0 \” \ “0 \”,\ “0 \”],\ “total_state_change \”:0},\ “出现\”:1,\ “occurrences_watermark \”:1,\ “动作\”:\ “创建\”,\ “时间戳\”:1492261546 ,\ “ID \”:\ “1303c9d3-096c-4744-9fdc-9566c831270c \”,\ “last_ok \”:1492261546,\ “沉默\”:假,\ “silenced_by \”:[]} “” 状态“:0}

但我在环回上看到没有任何关于porr 8089的交换。

influxdb sensu
1个回答
0
投票

我有同样的问题。将precision = "s"行添加到influxdb.conf文件中的UDP块后解决了。

© www.soinside.com 2019 - 2024. All rights reserved.