I've recently upgraded from Sensu 0.24 to 1.2 and noticed that checks where triggered immediately to the referenced handlers.
On the old checks (with v0.24), checks had an "occurences" attribute to filter out noise. I only want checks to be handled by handlers on every n occurences, i.e. a http check must fail 5 times before the pagerduty handler will be triggered. This behaviour seems to have changed with the sensu upgrade.
As I understand, a handler is supposed to include a filter to sort out events based on attributes. So suppose this is my check:
{
"checks": {
"examplecom_http": {
"command": "check-http.rb --url https://example.com -s -k -q 'Keyword'",
"handlers": ["default","pagerduty"],
"subscribers": ["network"],
"interval": 60,
"occurrences": 5
}
}
}
In previous versions (or at least that was my understanding), this check would only be handled after 5 minutes (5 occurences for 60 second intervals) of failure. This doesn't work anymore, so now the handler should include a filter to handle occurences:
{
"handlers": {
"pagerduty": {
"type": "pipe",
"command": "/etc/sensu/plugins/pagerduty.rb",
"severities": ["critical"],
"filter": "occurences"
}
}
And the "occurences" filter would look like this:
{
"filters": {
"occurences": {
"attributes": {
"occurrences": "eval: value >= 5"
}
}
}
}
However, whatever comes after the eval
part, be it value >= 5
or value < 5
, the effect is the same and the pagerduty handler gets executed. I've tried using the negate
directive with true
and false
but it seems my understanding of how filtering and occurences work for checks is just not correct. Maybe checks don't count their occurences at all?
Can somebody help and explain this?