Running checks only on Sensu master


#1

Hi,

Is there a way to run a check only on the Sensu master?

For example: check-rds.rb. I don’t want all nodes that subscribe to a particular string to run a check, just one node (which is why I thought running the check only on the Sensu master somehow might be best).

Alternatively I could set-up an ASG with min=1 max=1 that subscribes to “external-checks” and runs those external monitors (e.g. RDS, DynamoDB, etc). Bit of a waste running an instance just for that though…

  • Gonz

#2

There is not currently.

I'm experimenting with something like that with:


It uses the same type of redis-lock logic to mimic running on only one
sensu server at a time, and it uses a controversial "masquerade"
function (https://github.com/sensu/sensu/issues/541) to mimic the
source of the check to appear from a consistent, fake host.

Otherwise I'm not aware of a way to do this without picking a server
and defining standalone checks on it.

···

On Thu, Jan 1, 2015 at 4:19 PM, Gonzalo Servat <gservat@gmail.com> wrote:

Hi,

Is there a way to run a check only on the Sensu master?

For example: check-rds.rb. I don't want all nodes that subscribe to a
particular string to run a check, just one node (which is why I thought
running the check only on the Sensu master somehow might be best).

Alternatively I could set-up an ASG with min=1 max=1 that subscribes to
"external-checks" and runs those external monitors (e.g. RDS, DynamoDB,
etc). Bit of a waste running an instance just for that though...

- Gonz


#3

Just to follow up on more options that are available now.

You can add a particular subscription to the sensu-clients that run on
your sensu-masters that will execute a check "once" in a round-robin
fashion:
https://sensuapp.org/docs/latest/clients#round-robin-client-subscriptions

Combine that with the "source" attribute, make it look like "source:
my-sensu-cluster" and that will achieve what most people want:
https://sensuapp.org/docs/latest/checks#definition-attributes
Which is a check that run on only one of the sensu masters that looks
like it came from the cluster. (for things like check-rds or
check-google)

There is also this option which does a similar thing in a "standalone"
way without subscriptions:


it uses a redis lock to try to make it run on only 1 server at a time.

···

On Thu, Jan 1, 2015 at 5:40 PM, Kyle Anderson <kyle@xkyle.com> wrote:

There is not currently.

I'm experimenting with something like that with:
https://github.com/Yelp/puppet-monitoring_check/blob/master/files/check-cluster.rb
It uses the same type of redis-lock logic to mimic running on only one
sensu server at a time, and it uses a controversial "masquerade"
function (https://github.com/sensu/sensu/issues/541) to mimic the
source of the check to appear from a consistent, fake host.

Otherwise I'm not aware of a way to do this without picking a server
and defining standalone checks on it.

On Thu, Jan 1, 2015 at 4:19 PM, Gonzalo Servat <gservat@gmail.com> wrote:

Hi,

Is there a way to run a check only on the Sensu master?

For example: check-rds.rb. I don't want all nodes that subscribe to a
particular string to run a check, just one node (which is why I thought
running the check only on the Sensu master somehow might be best).

Alternatively I could set-up an ASG with min=1 max=1 that subscribes to
"external-checks" and runs those external monitors (e.g. RDS, DynamoDB,
etc). Bit of a waste running an instance just for that though...

- Gonz