metricsinfluxdbkapacitor

kapacitor metrics database missing in influxdb


I have kapacitor 1.3.1 and influxdb 1.2.4 running on my machine. Though i have enabled kapacitor to send its stats, i dont see _kapacitor database in influxdb. What am i missing here? kapacitor.config:

hostname = "localhost"
[stats]
  # Emit internal statistics about Kapacitor.
  # To consume these stats create a stream task
  # that selects data from the configured database
  # and retention policy.
  #
  # Example:
  #  stream|from().database('_kapacitor').retentionPolicy('autogen')...
  #
  enabled = true
  stats-interval = "10s"
  database = "_kapacitor"
  retention-policy= "autogen"

[[influxdb]]
  # Connect to an InfluxDB cluster
  # Kapacitor can subscribe, query and write to this cluster.
  # Using InfluxDB is not required and can be disabled.
  enabled = true
  default = true
  name = "localhost"
  urls = ["http://localhost:8086"]
  username = ""
  password = ""
  timeout = 0

Solution

  • Q: What am i missing here?

    A: You got the first step right by enabling the stats functionality in Kapacitor. The next thing you need to do here is to bounce the Kapacitor engine this is so that stats are getting written into its internal database periodically.

    Now the catch is that you'll need to also define a TICK script to pull the stats out from Kapacitor's internal database, then you can choose what you want to do to it, manipulate the data and write it back to an InfluxDB or raise alerts.

    Example:

    var data = stream| from().database('_kapacitor').retentionPolicy('autogen')
    data
      |log()
       .prefix('Kapacitor stat =>')
    

    After you got your tick script going. You'll have to do the usual, like installing it into Kapacitor then enable it.

    kapacitor define test -type stream -tick test.tick -dbrp _kapacitor.autogen
    

    There is a catch here. You need to specify the retention policy that you have specified in the config or otherwise it won't know where to look for the data. In this case it is _kapacitor.autogen.

    test   stream    disabled  false     ["_kapacitor"."autogen"]
    

    Next you enable the stream task.

    kapacitor enable test
    

    Output:

    [test:log2] 2017/07/26 00:49:21 I! Kapacitor stat => {"Name":"ingress","Database":"_kapacitor","RetentionPolicy":"autogen","Group":"","Dimensions":{"ByName":false,"TagNames":null},"Tags":{"cluster_id":"c80d02c0-8c51-4071-8904-1583164e90ec","database":"_internal","host":"kapacitor_stoh","measurement":"tsm1_cache","retention_policy":"monitor","server_id":"82a2d589-db45-4cc5-81b0-674cb80737ac","task_master":"main"},"Fields":{"points_received":4753},"Time":"2017-07-26T00:49:21.75615995Z"}