Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 774
Balazs Varhegyi Avatar asked Oct 17 '16 10:10

Balazs Varhegyi


1 Answers

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.

like image 92
Michael Desa Avatar answered Sep 21 '22 09:09

Michael Desa