创建 Kapacitor 警报错误

Create Kapacitor alert error

我在创建 Kapacitor 警报时遇到以下错误。警报已创建但未触发。

ts=2018-08-21T15:01:05.329Z lvl=error msg="failed to create database" service=kapacitor task_master=main task=chronograf-v1-2004f027-091f-4af9-b5c8-a636ab28fcc8 node=influxdb_out8 err="retention policy conflicts with an existing policy" database=chronograf cluster=

在 influxdb 数据库上定义的保留策略定义如下。

show retention policies on chronograf name duration shardGroupDuration replicaN default ---- -------- ------------------ -------- ------- autogen 1440h0m0s 168h0m0s 1 true

使用了 Tickscript

var db = 'telemetrics'    
var rp = 'two_months'    
var measurement = 'system'    
var groupBy = []    
var whereFilter = lambda: ("host" == 'hostname.domain.xxxx')    
var period = 1m    
0s    
var name = 'Redis Deadman'    
var idVar = name + ':{{.Group}}'    
var message = 'DEADMAN Alert REDIS.'     
var idTag = 'alertID'    
var levelTag = 'level'    
var messageField = 'message'
var durationField = 'duration'    
var outputDB = 'chronograf'    
var outputRP = 'autogen'    
var outputMeasurement = 'alerts'    
var triggerType = 'deadman'    
var threshold = 0.0

var data = stream
    |from()
        .database(db)
        .retentionPolicy(rp)
        .measurement(measurement)
        .groupBy(groupBy)
        .where(whereFilter)

var trigger = data
    |deadman(threshold, period)
        .stateChangesOnly()
        .message(message)
        .id(idVar)
        .idTag(idTag)
        .levelTag(levelTag)
        .messageField(messageField)
        .durationField(durationField)
        .telegram()
        .chatId('-232933442')
        .log('/var/log/kapacitor/alerts.log')

trigger
    |eval(lambda: "emitted")
        .as('value')
        .keep('value', messageField, durationField)
    |eval(lambda: float("value"))
        .as('value')
        .keep()
    |influxDBOut()
        .create()
        .database(outputDB)
        .retentionPolicy(outputRP)
        .measurement(outputMeasurement)
        .tag('alertName', name)
        .tag('triggerType', triggerType)

trigger
    |httpOut('output')

有什么建议吗?

我猜冲突是因为您正在尝试创建相同的数据库。

"retention policy conflicts with an existing policy"您可能需要另一个 rp.