Disabling handlers

I wanted a way to disable notifications without creating silence, so I added a filter called emergency_notification_control.

{
  "type": "EventFilter",
  "api_version": "core/v2",
  "metadata": {
    "name": "emergency_notification_control"
  },
  "spec": {
    "action": "allow",
    "expressions": [
      "event.has_check"
    ]
  }
}

Run this in for each namespace in your cluster, and add it to the filter list for each handler you want to control. You can then block notifications by toggling the filter action to “deny” either using the dashboard or by running a sensuctl filter update emergency_notification_control. For me, since some of the Sensu clusters I manage have over a dozen namespaces, I wrote a little script to walk through each one and change the filter action.

2 Likes