0

我正在尝试使用 fluentd 将 mongo 指标发送到 statsd,但我遇到了一些问题。

这是我的conf:

<source>
  type serverstatus #https://gist.github.com/chrischang12/943a69b02f3435281557
  uri mongodb://user:pass@localhost:27017/admin
  stats_interval 2s
</source>
<match serverstatus.**>
  type statsd
  host udp.mystatsdserver.com
  port 8125
</match>

我看到了 mongo 日志,并且 td-agent 正在收集指标,但问题是,显然,td-agent 没有将指标发送到 statsd。通过运行确认它: sudo tcpdump -nn -i any udp and src host <your_ip>

有人解决过这个问题吗?

我的另一个疑问是如何在 conf 中配置“statsdkey”参数?

4

1 回答 1

0

我想出了解决方案,这很简单。我必须安装fluentd Reformer 插件并设置配置以发送 statsd 特定密钥(如下例所示)。

<source>
  type serverstatus #https://gist.github.com/chrischang12/943a69b02f3435281557
  uri mongodb://user:pass@localhost:27017/admin
  stats_interval 2s
</source>

<match serverstatus.reformer>
  type copy
  <store>
    type statsd
    host udp.mystatsdserver.com
    port 8125
    flush_interval 4s
  </store>
</match>

<match serverstatus.**>
  type record_reformer
  tag serverstatus.reformer

  statsd_key mykey
  statsd_count ${my_field}
  statsd_type ${"count"}
</match>
于 2014-10-09T20:05:18.167 回答