这是一个分享于 的项目,其中的信息可能已经有所发展或是发生改变。
Kapacitor 是一个开源框架,用来处理、监控和警告时间序列数据。Kapacitor 使用 [TICKscript](https://docs.influxdata.com/kapacitor/v0.2/tick/) 脚本来定义任务,示例代码:
<pre class="brush:java;toolbar: true; auto-links: false;">stream
.from().measurement('cpu_usage_idle')
.groupBy('host')
.window()
.period(1m)
.every(1m)
.mapReduce(influxql.mean('value'))
.eval(lambda: 100.0 - "mean")
.as('used')
.alert()
.message('{{ .Level}}: {{ .Name }}/{{ index .Tags "host" }} has high cpu usage: {{ index .Fields "used" }}')
.warn(lambda: "used" > 70.0)
.crit(lambda: "used" > 85.0)
// Send alert to hander of choice.
// Slack
.slack()
.channel('#alerts')
// VictorOps
.victorOps()
.routingKey('team_rocket')
// PagerDuty
.pagerDuty()</pre>
执行方法:
<pre class="brush:shell;toolbar: true; auto-links: false;"># Define the task (assumes cpu data is in db 'telegraf')kapacitor define \
-name cpu_alert \
-type stream \
-dbrp telegraf.default \
-tick ./cpu_alert.tick# Start the taskkapacitor enable cpu_alert</pre>
5914 次点击
添加一条新回复
(您需要 后才能回复 没有账号 ?)
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码` - 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传