influxdb 中缺少 kapacitor 指标数据库
kapacitor metrics database missing in influxdb
我的机器上有 kapacitor 1.3.1 和 influxdb 1.2.4 运行。虽然我已经启用了 kapacitor 来发送它的统计数据,但我没有在 influxdb 中看到 _kapacitor 数据库。
我在这里错过了什么?
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
问:我在这里缺少什么?
A: 在 Kapacitor
中启用统计功能,您迈出了正确的第一步。您需要在这里做的下一件事是反弹 Kapacitor
引擎,这样统计数据就会定期写入其内部数据库。
现在要注意的是,您还需要定义一个 TICK 脚本以从 Kapacitor
的内部数据库中提取统计信息,然后您可以选择要对其执行的操作,操纵数据并将其写回 InfluxDB
或引发 alerts
.
示例:
var data = stream| from().database('_kapacitor').retentionPolicy('autogen')
data
|log()
.prefix('Kapacitor stat =>')
在你的 tick 脚本运行之后。你必须像往常一样做,比如将它安装到 Kapacitor
然后启用它。
kapacitor define test -type stream -tick test.tick -dbrp _kapacitor.autogen
这里有一个问题。您需要指定您在 config
中指定的保留策略,否则它将不知道在哪里查找数据。在本例中为 _kapacitor.autogen
.
test stream disabled false ["_kapacitor"."autogen"]
接下来启用流任务。
kapacitor enable test
输出:
[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"}
我的机器上有 kapacitor 1.3.1 和 influxdb 1.2.4 运行。虽然我已经启用了 kapacitor 来发送它的统计数据,但我没有在 influxdb 中看到 _kapacitor 数据库。 我在这里错过了什么? 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
问:我在这里缺少什么?
A: 在 Kapacitor
中启用统计功能,您迈出了正确的第一步。您需要在这里做的下一件事是反弹 Kapacitor
引擎,这样统计数据就会定期写入其内部数据库。
现在要注意的是,您还需要定义一个 TICK 脚本以从 Kapacitor
的内部数据库中提取统计信息,然后您可以选择要对其执行的操作,操纵数据并将其写回 InfluxDB
或引发 alerts
.
示例:
var data = stream| from().database('_kapacitor').retentionPolicy('autogen')
data
|log()
.prefix('Kapacitor stat =>')
在你的 tick 脚本运行之后。你必须像往常一样做,比如将它安装到 Kapacitor
然后启用它。
kapacitor define test -type stream -tick test.tick -dbrp _kapacitor.autogen
这里有一个问题。您需要指定您在 config
中指定的保留策略,否则它将不知道在哪里查找数据。在本例中为 _kapacitor.autogen
.
test stream disabled false ["_kapacitor"."autogen"]
接下来启用流任务。
kapacitor enable test
输出:
[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"}