Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for String fields compare kapacitor rules in Chronograf UI #865

Closed
chetu opened this issue Feb 10, 2017 · 3 comments
Closed

Support for String fields compare kapacitor rules in Chronograf UI #865

chetu opened this issue Feb 10, 2017 · 3 comments
Assignees
Milestone

Comments

@chetu
Copy link

chetu commented Feb 10, 2017

Haproxy input plugin field "status" have UP, DOWN , OPEN.

In tick its works:

var period = 10s
var every = 10s
var data = stream
    |from()
        .database('influxdb')
        .retentionPolicy('autogen')
        .measurement('haproxy')
        .groupBy('pxname')
    |window()
        .period(period)
        .every(every)
    |last('status')
        .as('value')

var alert = data
    |alert()
        .message('Haproxy monitor : {{.ID}} : {{ index .Tags "server" }} : {{ index .Tags "pxname" }} is {{ .Level }} ')
        .crit(lambda: "value" == 'DOWN' )
        .stateChangesOnly()
        .id('{{ .Name }}')
        .details(''' Email template ''')

In above tick script its working, however chronograf UI not working or not have option to it.

string_support

@goller
Copy link
Contributor

goller commented Feb 10, 2017

Hi @chetu, thanks for writing in this bug! I've been able to reproduce in a unit test. I'm working on a fix right now and it'll ship with today's release.

@goller
Copy link
Contributor

goller commented Feb 10, 2017

Hi @chetu, I've fixed this in PR #867.

Here is the output tickscript now with your parameters:

var db = 'influxdb'

var rp = 'autogen'

var measurement = 'haproxy'

var groupBy = ['pxname']

var whereFilter = lambda: TRUE

var period = 10s

var every = 10s

var name = 'haproxy'

var idVar = name + ':{{.Group}}'

var message = 'Haproxy monitor : {{.ID}} : {{ index .Tags "server" }} : {{ index .Tags "pxname" }} is {{ .Level }} '

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 details = 'Email template'

var crit = 'DOWN'

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

var trigger = data
    |alert()
        .crit(lambda: "value" == crit)
        .stateChangesOnly()
        .message(message)
        .id(idVar)
        .idTag(idTag)
        .levelTag(levelTag)
        .messageField(messageField)
        .durationField(durationField)
        .details(details)
        .email()

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

trigger
    |httpOut('output')

... which is now in our test cases!

@goller
Copy link
Contributor

goller commented Feb 10, 2017

Ok, it's merged in and will ship with our release today!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants