欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

kapacitor问题记录

程序员文章站 2022-05-31 11:26:55
...

在本地部署kapacitor时,按照官方文档一一部署,操作到:
kapacitor record stream -task cpu_alert -duration 60s
等待了一两分钟 没有返回rid值数据;
验证系统配置信息:telegraf influxdb 和最新装kapacitor
发现单个部署都没问题:
查询influxdb
{“results”:[{“statement_id”:0,“series”:
[{“name”:"_internal",“columns”:
[“retention_policy”,“name”,“mode”,“destinations”],
“values”:[[“monitor”,“kapacitor-b4abdd3c-2036-405d-a36f-66758d6846c9”,“ANY”,[“http://localhost:9092”]]]
},
{“name”:“telegraf”,“columns”:
[“retention_policy”,“name”,“mode”,“destinations”],
“values”:[[“autogen”,“kapacitor-b4abdd3c-2036-405d-a36f-66758d6846c9”,“ANY”,[“http://localhost:9092”]]]
},
{“name”:“lora”,“columns”:
[“retention_policy”,“name”,“mode”,“destinations”],
“values”:[[“autogen”,“kapacitor-b4abdd3c-2036-405d-a36f-66758d6846c9”,“ANY”,[“http://localhost:9092”]]]
}
]
}
]
}

一切正常。
然后重启各个服务器试试:
(kill -9 关不掉telegraf )
systemctl stop telegraf
systemctl stop influxdb
systemctl stop kapacitor
启动
systemctl start influxdb
systemctl start telegraf
systemctl start kapacitor

重新验证刚刚信息:
kapacitor define cpu_alert -tick cpu_alert.tick
kapacitor record stream -task cpu_alert -duration 60s

ps:cpu_alert.tick 官网上样例内容是:
dbrp “telegraf”.“autogen”

stream
// Select just the cpu measurement from our example database.
|from()
.measurement(‘cpu’)
|alert()
.crit(lambda: int(“usage_idle”) < 70)
// Whenever we get an alert write it to a file.
.log(’/tmp/alerts.log’)

 但influxdb中usage_idle < 70 没有,为了测试这地方修改成: .crit(lambda: int("usage_idle") <  100)