How can I send only one warning using kapacitor if something is not working?

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 sends a warning every 10 seconds that the service is down. How can I configure it to send only one?

+4
source share
1 answer

There is a property method stateChangesOnly()on alert nodes in TICKscript that will only issue a warning when a warning state changes. Your script will 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()

For more information, see the documentation in stateChangeOnly () .

+7
source

Source: https://habr.com/ru/post/1657977/


All Articles