0

I'm trying to send mongo metrics to statsd using fluentd but I'm going through some problems.

This is my 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>

I saw the mongo logs and the metrics are being collected by td-agent but the problem is that, apparently, td-agent is not sending the metrics to statsd. Confirm it by running: sudo tcpdump -nn -i any udp and src host <your_ip>

Does anybody went trough this problem?

Another doubt I have is that how can I configure a "statsdkey" param inside the conf?

Felippe Raposo
  • 431
  • 4
  • 23

1 Answers1

0

I figured out the solution and it is quite simple. I had to install the fluentd reformer plugin and set up the configuration to send statsd specific keys(as show in the example below).

<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>
Felippe Raposo
  • 431
  • 4
  • 23