Hi experts,
I would like to seek for your advice how filters are applied to Sensu built in handler. Currently we are using Event stream to send out all events toTCP and now we want to configure the Email handler to handle critical events.
The expectation or the goal is for the email handler to deal w/ CRITICAL events only. Only when Check status is set to critical then it would send an email once. If the same event has not been solved within an hour then it should trigger the email to be sent out once every 30 mins. We have an SMTP connection already set up (Postfix) and working but we cannot get the desired output so I’ve been playing around on the configurations and have been running on different issues and questions:
-
If no filter is applied to the email handler, and then we define the “handlers”: [“email”] to a check which is running on an interval of 60 seconds, email is received once and that’s it. Is it not supposed to send an email every event by default?
-
Is it correct that even if I don’t define event_stream and email in *handlers { } *as set handlers (default.json), event_stream and email are expected to work as long as we have the correct event_stream and email configuration? and so I can delete my default.json configuration in the system. If that is the case, where should I apply the filter (Filter.json)?
-
And then if you could help us come up with the right filter and configurations so that only critical events are handled and it must send an email once but if not resolved after an hour, it should send out once every 30 mins.
Below are the configurations we have in our system so far.
Check.json (on the client server)
{
“checks”: {
“event-queues”: {
“type”: “metric”,
“command”: “/opt/sensu/embedded/bin/event-queues.rb”,
“interval”: 60,
“standalone”: true,
“handlers”: [“event_stream”,“email”]
}
}
}
``
Email.json (Sensu Server)
{
“email”: {
“smtp”: {
“address”: “localhost”,
“port”: 25
},
“to”: “peter@gmail.com”,
“from”: “hostmaster@sensu1”
}
}
``
Filter.json (Sensu Server)
{
“filters”: {
“example_filter”: {
“negate”: false,
“attributes”: {
“status”: 2
}
}
}
}
``
default.json (Sensu Server)
{
“handlers”: {
“default”: {
“type”: “set”,
“handlers”: [
“event_stream”
]
}
}
}
``
I really hope you could help us. Thank you so much in advance!
Regards.