0

创建 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 数据库上定义的保留策略定义如下。

显示 chronograf 名称持续时间 shardGroupDuration replicaN 默认的保留策略 ---- -------- ------ -------- -- ----- 自动生成 1440h0m0s 168h0m0s 1 真

使用的记号笔

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')

有什么建议么?

4

1 回答 1

1

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

“保留政策与现有政策冲突”您可能需要另一个 rp。

于 2018-09-26T15:48:06.653 回答