How does silencing work?

Silences are created on an ad-hoc basis via sensuctl. When silencing
entries are successfully created, they are assigned a name in the format
$SUBSCRIPTION:$CHECK, where $SUBSCRIPTION is the name of a Sensu entity
subscription and $CHECK is the name of a Sensu check. Silences can be
used to silence checks on specific entities by taking advantage of per-entity
subscriptions, for example: entity:$ENTITY_NAME. When the check name and/or
subscription described in a silencing entry match an event and a handler use the
not_silenced built-in filter, this handler will not be executed.

These silences are persisted in the Sensu data store. When the Sensu
server processes subsequent check results, matching silences are
retrieved from the store. If one or more matching entries exist, the event is
updated with a list of silenced entry names. The presence of silences
indicates that the event is silenced.

When creating a silencing entry, a combination of check and subscription can be
specified, but only one or the other is strictly required.

For example, when a silencing entry is created specifying only a check, its name
will contain an asterisk (or wildcard) in the $SUBSCRIPTION position. This
indicates that any event with a matching check name will be marked as silenced,
regardless of the originating entities’ subscriptions.

Conversely, a silencing entry which specifies only a subscription will have a
name with an asterisk in the $CHECK position. This indicates that any event
where the originating entities’ subscriptions match the subscription specified
in the entry will be marked as silenced, regardless of the check name.

Silencing specification

Silenced entry names

Silences must contain either a subscription or check name, and are
identified by the combination of $SUBSCRIPTION:$CHECK. If a check or
subscription is not provided, it will be substituted with a wildcard (asterisk):
$SUBSCRIPTION:* or *:$CHECK.

Top-level attributes

Required for silencing entry definitions in wrapped-json or yaml format for use with sensuctl create.

type

String

example

"type": "Silenced"

api_version

description

Top-level attribute specifying the Sensu API group and version. For silences in Sensu backend version 5.2, this attribute should always be core/v2.

required

Required for silencing entry definitions in wrapped-json or yaml format for use with sensuctl create.

type

String

example

"api_version": "core/v2"

metadata

description

Top-level collection of metadata about the silencing entry, including the name and namespace as well as custom labels and annotations. The metadata map is always at the top level of the silencing entry definition. This means that in wrapped-json and yaml formats, the metadata scope occurs outside the spec scope. See the metadata attributes reference for details.

required

Required for silencing entry definitions in wrapped-json or yaml format for use with sensuctl create.

The optional expire_on_resolve attribute used here indicates that when the
server processes a matching check from the specified entity with status OK, this
silencing entry will automatically be removed.

When used in combination with other attributes (like creator and reason), this
provides Sensu operators with a method of acknowledging that they have received
an alert, suppressing additional notifications, and automatically clearing the
silencing entry when the check status returns to normal.

Silence all checks on entities with a specific subscription

In this case, we’ll completely silence any entities subscribed to appserver.
Just as in the example of silencing all checks on a specific entity, we’ll
create a silencing entry specifying only the appserver subscription:

subscription:appserver

{"subscription":"appserver"}

Silence a specific check on entities with a specific subscription

Assume a check mysql_status which we wish to silence, running on Sensu
entities with the subscription appserver:

check:mysql_statussubscription:appserver

{"subscription":"appserver","check":"mysql_status"}

Silence a specific check on every entity

To silence the check mysql_status on every entity in our infrastructure,
regardless of subscriptions, we only need to provide the check name:

check:mysql_status

{"check":"mysql_status"}

Deleting silences

To delete a silencing entry, you will need to provide its name. Subscription only
silencing entry names will be similar to this:

name:appserver:*

{"name":"appserver:*"}

Check only silencing entry names will be similar to this:

name:'*:mysql_status'

{"name":"*:mysql_status"}

About Sensu

The Sensu monitoring event pipeline empowers businesses to automate their monitoring workflows and gain deep visibility into their multi-cloud infrastructure, from Kubernetes to bare metal. Companies like Sony, Box.com, and Activision rely on Sensu to help deliver value faster, at scale.