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('myemail@company.com')

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

Balazs Varhegyi
  • 991
  • 1
  • 18
  • 37

1 Answers1

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('myemail@company.com')
    .stateChangesOnly()

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

Michael Desa
  • 4,607
  • 24
  • 19