Send notifications based on subscriptions


I’m using sensu core 1.6 on Linux.
When trying to setup notifications, I was looking into if I cna send notifications based on subscribers?

If there is any alert for a particular client, I am looking at generating emails.

Currently, I have contacts setup on individual checks, and the number of checks are growing. Can I setup notifications on subscriptions?


Typically the way I do this is setup a handler instance for each group of people that I want to notify (for example different pagerduty handler definitions for different teams and urgencies) then in the check you specify the subscriptions and the handlers that apply to it. Is that roughly what you are looking for?


I wrote a handler that sends email via script to a user (script argument) where that user is defined as a variable in either the client or check config, preferentially using the client config. This way I only have one handler for email.


That works when you don’t need to specify secrets, you would not want to transmit a secret from a client to a server. For example the pagerduty api needs an api key so we allow a check or client to specify the team and the team then corresponds to a config on the server (one handler definition for each team) which is then pulled in to make the appropriate calls. For more details see:


@KendallChenoweth I think a custom handler will help our case. Can you share some steps to write our own handler please?


Setting up multiple handlers wont help, I think.

Lets say I have 2 sets of clients

  1. client1 [ subscription is cpu]
  2. client2 [subscriptions are cpu, splunk]

If I have a cpu check [applied to all vms] and a splunk check [applied only to splunk vm]
So I dont need multiple cpu checks for each subscription.

Now, cpu applies to both splunk and non-splunk vms.
But splunk applies only to splunk vms.

With a common handler tied to a check, the cpu alert will go to all recipients.

Else I will have to create a check for each handler.

sensu-pluings-mailer has a subscriptions feature, but its not working.
see here: Sensu Plugins Mailer not honoring subscriptions based mail_to list