Client specific handler invocation

#1

Hi,
Is it possible to invoke a client specific handler? So far I am aware that we can add handlers with the checks run and those checks are associated with the client with subscriptions.

{

“checks”: {

"check-memory-percent": {

  "type": "metric",

  "command": "check-memory-percent.rb -w 80 -c 90",

  "subscribers": [

    "ALL"

  ],

  "interval": 100

}

}

}

e.g. above check is for ALL subscribers(both prod and qa). But what if my prod node wants to send and email and sms but qa wants to send only email.

Can I add handler choice from client.json? I tried but it doesnt work.

#2

There is no general client setting that overrides all other checks. If
you want a client to behave differently then how a subscription check
is configured, then I can think of a couple options:

1. Have a different subscription check for QA servers that has a
different handler configuration. (check-memory-email: subscribers =>
qa)
2. Use filters (https://sensuapp.org/docs/latest/getting-started-with-filters)
in conjunction with some client attributes and filter out the sms
handler on qa servers
3. Deploy check configuration overrides to the QA servers, and that
configuration will get merged on top of the incoming check request.
4. Convert to standalone checks, which gives the ability to deploy
checks with more flexibility

Don't forget about the client keepalive check too. Keepalive alerts
can be configured like any other standalone check, the config goes in
a "keepalive" section:
https://sensuapp.org/docs/latest/clients#keepalive-attributes Same
options apply except for 3 I guess.

···

On Mon, May 16, 2016 at 6:53 PM, trupti mali <truptikmali@gmail.com> wrote:

Hi,
Is it possible to invoke a client specific handler? So far I am aware that
we can add handlers with the checks run and those checks are associated
with the client with subscriptions.

{

  "checks": {

    "check-memory-percent": {

      "type": "metric",

      "command": "check-memory-percent.rb -w 80 -c 90",

      "subscribers": [

        "ALL"

      ],

      "interval": 100

    }

}

}

e.g. above check is for ALL subscribers(both prod and qa). But what if my
prod node wants to send and email and sms but qa wants to send only email.

Can I add handler choice from client.json? I tried but it doesnt work.

#3

Well filters work for me. Thanks for the prompt response Kyle. :slight_smile: