Open nicolasbrechet opened 3 years ago
Can you please include the handler & check configurations you used to produce this error?
Of course!
Handler(s):
api_version: core/v2
type: Handler
metadata:
name: email_P1
spec:
type: pipe
command: sensu-email-handler -f from@mail -s mailserver -i -P 25 -a 'none' -t 'to@mail' -S 'email subject' -T '/etc/sensu/template/email_template'
timeout: 10
filters:
- not_silenced
- is_incident
- fatigue_check
runtime_assets:
- sensu-email-handler
other handlers were named email_P2, email_P3, etc and stored in configuration files email_P1.yaml, email_P2.yaml, ...
Check CPU:
---
type: CheckConfig
api_version: core/v2
metadata:
name: check-cpu
annotations:
fatigue_check/occurrences: "5"
fatigue_check/interval: "43200" # re-sends the alert every 12h.
fatigue_check/allow_resolution: "true"
email_priority: P2
spec:
command: check-cpu.rb -w {{ .labels.cpu_warning | default 95}} -c {{ .labels.cpu_critical | default 99}}
interval: 60
publish: true
handlers:
- email_P2
runtime_assets:
- sensu-plugins-cpu-checks
- sensu-ruby-runtime
subscriptions:
- system
After renaming all handlers without underscores, and updating the check configuration with the proper handler names, we no longer had the issue...
Expected Behavior
When defining several handlers with similar names, I want to name them like "myHandler_one", "myHandler_two", "myHandler_three". Then I want to define a check "myCheck_one" with handler "myHandler_one", another check "myCheck_two" with handler "myHandler_two", and so on.
Events from "myCheck_one" should be handled by handler "myHandler_one" only. Events from "myCheck_two" should be handled by handler "myHandler_two" only. ...
Current Behavior
All checks have all handlers!
"myCheck_one" has handlers "myHandler_one", "myHandler_two", "myHandler_three". Same for "myCheck_two" and "myCheck_three".
Possible Solution
It looks like the "" (underscore) character in the handler's name is seen as a sort of wildcard, where all characters after the are not taken into account.
Steps to Reproduce (for bugs)
Context
We were trying to use several almost identical handlers depending on the priority, the suffix after the underscore was the priority. Example:
Your Environment