sequentialread / tickscript-studio

a hacky web based IDE for writing kapacitor tickscripts
21 stars 8 forks source link

My TICKScript test returns no usable info #4

Open Defozo opened 5 years ago

Defozo commented 5 years ago

This is my TICKScript:

var db = 'kong'

var rp = 'autogen'

var measurement = 'kong_requests'

var groupBy = []

var whereFilter = lambda: TRUE

var name = 'test-kong'

var idVar = name

var message = ' {{.ID}}'

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

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

var trigger = data
    |alert()
        .crit(lambda: "value" > crit)
        .stateChangesOnly()
        .message(message)
        .id(idVar)
        .idTag(idTag)
        .levelTag(levelTag)
        .messageField(messageField)
        .durationField(durationField)
        .log('/tmp/alerts.log')
        .mode(0644)

trigger
    |eval(lambda: float("value"))
        .as('value')
        .keep()

trigger
    |httpOut('output')

After running a test, the only output I got is:

[task_master:main] 2019/10/09 15:20:37 I! Started task: 19346d47-063f-4e1c-9cff-faa2c0dd30ce
[httpd] 172.18.0.3 - - [09/Oct/2019:15:20:37 +0000] "POST /kapacitor/v1/tasks HTTP/1.1" 200 1028 "-" "Go-http-client/1.1" 58cabd8f-eaa8-11e9-8164-000000000000 21499
[httpd] 172.18.0.3 - - [09/Oct/2019:15:20:38 +0000] "POST /write?db=kong&rp= HTTP/1.1" 204 0 "-" "Go-http-client/1.1" 593817d8-eaa8-11e9-8165-000000000000 3256

Nothing else.

I would expect some information if the alert was triggered or not?

ForestJohnson commented 3 years ago

Oops, I missed this notification, sorry. I know its a bit late in the game now :( If you had posted the example data that you used when you hit this issue, I might still be able to debug it.