influxdata / kapacitor

Open source framework for processing, monitoring, and alerting on time series data
MIT License
2.31k stars 492 forks source link

Possible bug with windows and httpout #1439

Open ChristianTrolleMikkelsen opened 7 years ago

ChristianTrolleMikkelsen commented 7 years ago

Hi

When i setup a rule which uses windowed data by tick script OR via chronograf my httpOu do not fire. Here is an example:

` var db = 'telegraf' var rp = 'autogen' var measurement = 'win_cpu' var groupBy = ['brand', 'host'] var whereFilter = lambda: TRUE var period = 30m0s var every = 10m var name = 'Windows - Report high cpu usage' var idVar = name + ':{{.Group}}' var message = '{{ index .Tags "brand" }} - {{ index .Tags "host" }} has been using more than 95% of its cpu for more than 30 minutes.' 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 = 95

var data = stream |from() .database(db) .retentionPolicy(rp) .measurement(measurement) .groupBy(groupBy) .where(whereFilter) |window() .period(period) .every(every) .align() |max('Percent_Processor_Time') .as('value')

var trigger = data |alert() .crit(lambda: "value" > crit) .stateChangesOnly() .message(message) .id(idVar) .idTag(idTag) .levelTag(levelTag) .messageField(messageField) .durationField(durationField) .post('http://XXXXXX')

trigger |influxDBOut() .create() .database(outputDB) .retentionPolicy(outputRP) .measurement(outputMeasurement) .tag('alertName', name) .tag('triggerType', triggerType)

trigger |httpOut('output')

`

httpOut is never fired. This happens everytime i set up a window, if i drop the window i get my alerts via httpOut as expected. I tried this locally and using https://requestb.in/ to ensure it was not just my parsing/endpoint causing the issue.

Im relative new to TICK so this might be an error on my behalf but right now it looks like a bug.

Hope you can help as windows make alarming much more realiable :).

SamuelToh commented 7 years ago

I suspect your problem is due to trigger been an empty dataset. Suggests using the LogNode to dump the content of trigger.

Example:

trigger
  |log()
  |httpOut('output')