title: Configure Sensu to send metrics in Influxdb
body: <p>I'm trying to send metrics to influxdb in UDP with sensu. </p>
  
  <p>I set my influxdb database : </p>
  
  <pre><code># echo "cpu value=1" | nc -C -w 1 -u localhost 8089
  # echo "select * from cpu" | influx -database sensu
  name: cpu
  time                value
  1490898218118704438 1
  </code></pre>
  
  <p>I installed the plugin from the repository (<a href="https://github.com/sensu-plugins/sensu-plugins-influxdb" rel="nofollow noreferrer">https://github.com/sensu-plugins/sensu-plugins-influxdb</a>) : </p>
  
  <pre><code># sensu-install -p influxdb
  # cp /opt/sensu/embedded/bin/mutator-influxdb-line-protocol.rb /etc/sensu/extensions/
  </code></pre>
  
  <p>Configured the handler according to the doc : </p>
  
  <pre><code>{
  "handlers": {
    "influxdb": {
      "type": "udp",
      "socket": {
        "host": "localhost",
        "port": 8089
      },
      "mutator": "influxdb_line_protocol"
    }
    }
  </code></pre>
  
  <p>And configured a check to use this handler : </p>
  
  <pre><code>{
  "checks": {
    "cpu-metrics": {
      "command": "/opt/sensu/embedded/bin/metrics-cpu-pcnt-usage.rb",
      "handlers": [
        "influxdb"
      ],
      "interval": 60,
      "subscribers": [
        "production"
      ],
      "type": "metric",
      "standalone": false
    }
  }
  }
  </code></pre>
  
  <p>Now when I restart my <code>sensu-server</code> I can see the extension loaded : </p>
  
  <blockquote>
    <p>{"timestamp":"2017-03-30T19:53:05.083622+0000","level":"warn","message":"loaded extension","type":"mutator","name":"influxdb_line_protocol","description":"returns check output formatted for InfluxDB's line protocol"}</p>
  </blockquote>
  
  <p>And I can see the metrics collected on the client side : </p>
  
  <blockquote>
    <p>{"timestamp":"2017-03-30T20:08:49.940732+0000","level":"info","message":"received check request","check":{"command":"/opt/sensu/embedded/bin/metrics-cpu-pcnt-usage.rb","handlers":["influxdb"],"type":"metric","standalone":false,"name":"cpu-metrics","issued":1490904529}}
    {"timestamp":"2017-03-30T20:08:51.150984+0000","level":"info","message":"publishing check result","payload":{"client":"nott","check":{"command":"/opt/sensu/embedded/bin/metrics-cpu-pcnt-usage.rb","handlers":["metrics"],"type":"metric","standalone":false,"name":"cpu-metrics","issued":1490904529,"interval":60,"subscribers":["production"],"executed":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}}}</p>
  </blockquote>
  
  <p>But I still have nothing more in my influxdb database. </p>
  
  <pre><code>influx -database sensu
  Connected to http://localhost:8086 version 1.2.1
  InfluxDB shell version: 1.2.1
  &gt; show measurements;
  name: measurements
  name
  ----
  cpu
  </code></pre>
  
  <p>Any insights ? </p>
  
  <p><strong>UPDATE:</strong> As requested in comment here is my influxdb UDP config : </p>
  
  <pre><code>[[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
  </code></pre>
  
  <p><strong>UPDATE 2:</strong> If I add the debug handler I can see the result of the metric check in the server logs: </p>
  
  <blockquote>
    <p>{"timestamp":"2017-04-15T13:05:46.047354+0000","level":"info","message":"handler extension output","extension":{"type":"extension","name":"debug"},"event":{"id":"1303c9d3-096c-4744-9fdc-9566c831270c"},"output":"{\"client\":{\"name\":\"nott\",\"address\":\"127.0.0.1\",\"environment\":\"production\",\"subscriptions\":[\"certs\",\"production\",\"client:nott\"],\"socket\":{\"bind\":\"127.0.0.1\",\"port\":3030},\"version\":\"0.28.2\",\"timestamp\":1492261543},\"check\":{\"command\":\"/opt/sensu/embedded/bin/metrics-cpu-pcnt-usage.rb\",\"handlers\":[\"metrics\"],\"interval\":60,\"subscribers\":[\"production\"],\"type\":\"metric\",\"standalone\":true,\"name\":\"cpu-metrics\",\"issued\":1492261544,\"executed\":1492261544,\"duration\":1.205,\"output\":\"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 1492261546\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},\"occurrences\":1,\"occurrences_watermark\":1,\"action\":\"create\",\"timestamp\":1492261546,\"id\":\"1303c9d3-096c-4744-9fdc-9566c831270c\",\"last_ok\":1492261546,\"silenced\":false,\"silenced_by\":[]}","status":0}</p>
  </blockquote>
  
  <p>But I see nothing no exchanges on the porr 8089 on the loopback. </p>