Alerta Kapacitor no message available

Hey,

im trying to send alerts with alerta, but i get the error message:
image

no message available, how do i add a message to the alert?

thanks for the help.

Have you added the .message() part to your script/topic?

Yes i did:

image

Ok doke, Could you share your full tick script please?

var db = 'telegraf'

var rp = 'autogen'

var measurement = 'rabbitmq_queue'

var groupBy = []

var whereFilter = lambda: ("queue" == '*****************') AND isPresent("messages_ready")

var name = '************************'

var idVar = name

var message = ' {{.Level}} - test'

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 = 1

var data = stream
    |from()
        .database(db)
        .retentionPolicy(rp)
        .measurement(measurement)
        .groupBy(groupBy)
        .where(whereFilter)
    |eval(lambda: "messages_ready")
        .as('value')

var trigger = data
    |alert()
        .crit(lambda: "value" != crit)
        .message(message)
        .id(idVar)
        .idTag(idTag)
        .levelTag(levelTag)
        .messageField(messageField)
        .durationField(durationField)
        .post('***************')
        .header('Content-Type', 'application/json')
        .telegram()
        .chatId('***************')
        .parseMode('Markdown')
        .alerta()
        .environment('Test')
        .origin('kapacitor')
        .services()
        .message(message)

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

Here

There’s a couple of other alert handlers there, do you get an alert and message to them as expected?

Yes i get the alerts to telegram.

i tried POST but it didnt work either (i have to remove it from the script)

righto, I’ve commented them out for now. I don’t have an alerta endpoint to test, but could you replace the bit between
var trigger = data

trigger

with this

    |alert()
        .crit(lambda: "value" != crit)
        .message(message)
        .id(idVar)
        .idTag(idTag)
        .levelTag(levelTag)
        .messageField(messageField)
        .durationField(durationField)
       // .post('***************')
       // .header('Content-Type', 'application/json')
       // .telegram()
       // .chatId('***************')
       // .parseMode('Markdown')
        .alerta()
            .environment('Test')
            .origin('kapacitor')
            .services()
            //.message(message)

As i say, I don’t have an alerta end point to test with. I do use a mixture of httpPost and post though and remember having some issues previously passing a message to them both.

TICK Script looks ok though so it should be working

Yes same here. i need to pass a Token-Type and a Token with the Post. but with .header() its not working.

The token and token prefix?

1 Like

Hey, Sorry for the late reply. Yes but not for alerta for the HTTPPost.

1 Like