添加报警
报警规则脚本
var db = 'telegraf'var rp = 'autogen'var measurement = 'cpu'var groupBy = []var whereFilter = lambda: ("cpu" == 'cpu-total')var name = 'noc-lutest'var idVar = namevar message = 'noc-lutest is {{.Level}}, value: {{ index .Fields "value" }},卢志尧: {{.Group}}'var idTag = 'alertID'var levelTag = 'level'var messageField = 'message'var durationField = 'duration'var outputDB = 'chronograf'var outputRP = 'autogen'var outputMeasurement = 'alerts'var triggerType = 'threshold'var crit = 8.5var data = https://www.it610.com/article/stream
|from()
.database(db)
.retentionPolicy(rp)
.measurement(measurement)
.groupBy(groupBy)
.where(whereFilter)
|eval(lambda:"usage_system")
.as('value')var trigger = data
|alert()
.crit(lambda: "value" > crit)
.message(message)
.id(idVar)
.idTag(idTag)
.levelTag(levelTag)
.messageField(messageField)
.durationField(durationField)
.stateChangesOnly()
.post('http://most-wanted.devops/api/most-wanted/receive?access_token=ZNZcczmSA2dUkuQcYomkhLb6GshT9a8e')trigger
|eval(lambda: float("value"))
.as('value')
.keep()
|influxDBOut()
.create()
.database(outputDB)
.retentionPolicy(outputRP)
.measurement(outputMeasurement)
.tag('alertName', name)
.tag('triggerType', triggerType)trigger
|httpOut('output')
推荐阅读
- 编写字典程序
- 怎么将桌面上的CAD图纸添加到软件中进行BMP格式转换()
- 2147483647与int型
- 怎样把一个字典的数据添加到另一个字典中()
- 培养习惯的倦怠期可以添加变化~74
- 如何在Kubernetes|如何在Kubernetes 里添加自定义的 API 对象(一)
- Ubuntu|Ubuntu 下添加开机启动脚本
- 7岁男孩教科书式报警(会说话的孩子有多厉害!)
- Android|Android Room 的坑
- (IOS)为UIView某个角添加圆角