This Sensu Go filter looks for dependencies defined in check and entity annotations and invokes the
sensu.CheckDependencies query expression to determine if any of the defined dependecies are in a non-OK state.
coreDependencies function implemented by this library is intended as proof-of-concept reproduction of the Sensu Core
In Sensu Core the dependencies were expressed as an array. For this implementation I've chosen to use comma separated values.
Given you have a check called
https-health which monitors your website's /health endpoint, you want to suppress alerts from the
https-cert check when
https-health is in a non-OK state:
command: check-https-cert.rb --url https://www.example.com
Provided that the
pagerduty handler has been configured as shown below in Usage examples, the
dependencies annotation with the value
https-health will prevent alerts from
https-cert from reaching pagerduty when
https-health is not OK.
Given you have an agent running in a remote site with unreliable network link. Sometimes the ethernet cable falls out of port 5 on the switch, other times the ISP link fails. And yet you soldier on. It's fine.
You want to suppress alerts from any check this agent runs when either
remote-site-link is in a non-OK state
b. the state of check
port5 on entity
remote-switch is in a non-OK state (
For an agent entity, you can set this in the agent.yml annotations:
Or whatever method as appropriate for the entity type or your Sensu version.
sensuctl asset add cwjohnston/sensu-dependencies-filter -r dependencies-filter
Define an event filter using the
coreDependencies function. This function requires the event object as its only argument.
Add the filter to any of your existing handlers. Here's a Pagerduty handler with the above event filter applied:
Inspired by Sensu Core dependencies filter extension.
Please describe the reason for reporting this asset. Our moderators will be notified and will disable the asset if it is found to be inappropriate.×