influxdata / kapacitor

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

sideload cannot be used when using deadman for scheduled maintenance #2309

Open j3ffrw opened 4 years ago

j3ffrw commented 4 years ago

Hi, How do I use deadman in combination with sideload for doing scheduled maintenance? The problem is when using deadman after sideload, the added fields are no longer available for further processing as it uses stats() internally. So far the only way I've tried is to use the equivalent script describe in the docs and insert sideload in between derivative and alert().

Regards,

Jeff

kapacitor version Kapacitor OSS 1.5.4 (git: HEAD 1f648f85772efe222a3853fe1a0d9ef88854a8c1)

Given the ff:

stream
    |from()
    .database('telegraf')
    .measurement('cpu')
  |sideload()
    .source('file:///data/scheduled-maintenance')
    .order('hosts/{{.host}}.yml' , 'hostgroups/{{.hostgroup}}.yml')
    .field('maintenance', FALSE)
    .tag('testtag', 'testtag')
  |deadman(0.0,20s, lambda: !"maintenance" )

Result: err="reference \"maintenance\" is missing value"

Equivalent script:

    |derivative('emitted')
        .unit(10s)
        .nonNegative()
    |sideload()
        .source('file:///data/scheduled-maintenance')
        .order('hosts/{{.host}}.yml', 'hostgroups/{{.hostgroup}}.yml')
        .field('maintenance', FALSE)
        .tag('testtag', 'testtest')
    |alert()
        .crit(lambda: !"maintenance" AND "emitted" <= 0)
russorat commented 4 years ago

@j3ffrw thanks for opening this. I've passed it to the team to review.

hexinal commented 3 years ago

Was this ever fixed? Or does the equivalent without using the deadman node works?