How can I send just one alert with kapacitor if something is down?
Asked Answered
P

1

8

I have the following stick script

stream
|from()
    .measurement('mymetric_value')
|deadman(1.0, 10s)
    .message('service is down!')
    .log('/tmp/alerts.log')
    .email('[email protected]')

It send an alert every 10 seconds that the service is down. How can I set it to send only one?

Prem answered 17/10, 2016 at 10:37 Comment(0)
S
20

There is a property method stateChangesOnly() on Alert nodes in a TICKscript that will only issue an alert if the state of the alert changes. Your script would look like this:

stream
|from()
    .measurement('mymetric_value')
|deadman(1.0, 10s)
    .message('service is down!')
    .log('/tmp/alerts.log')
    .email('[email protected]')
    .stateChangesOnly()

See the kapacitor documentation on stateChangeOnly() for more information.

Satisfy answered 17/10, 2016 at 18:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.