AND-ing subscriptions for checks--is it possible?

I want to create checks, which should only be ran on agents, where a combination of subscriptions are present.

Let’s say I want to monitor the state of vmtools on any Linux system. This check should only be ran on agents where the subscriptions linux and virtual are present.

This way, the check wouldn’t be ran on agents with the subscriptions linux and physical. Or windows and virtual for that matter.

Is this possible?
Or is there a way to configure this, besides creating edge-case subscriptions like linux_virtual and linux_physical?

Thanks!

1 Like

Hey,

Off the top of my head, I don’t think the conditional subscription filtering is possible right now. It’s an interesting concept, but its not clear its necessary.

So yeah right now I would accomplish it the other way.
I would just extend the list of subscriptions the agents are configured to be a part of and write the check to fire against ‘linux_virtual’ or ‘linux_physical’

Let me back up and ask the related question, is there some reason that makes extending the list of subscriptions an agent participates in the wrong solution for you?

1 Like

As Jef mentioned, there’s no feature in Sensu for conditional subscription logic, but you can get quite granular with your subscriptions to achieve a similar result. We’ve started promoting a subscription naming convention in the monitoring checks template project that might be helpful as an example:

In this example, we’ve proposed that all of the linux system checks should publish to the system/linux subscription, as well as more specific subscriptions such as system/linux/cpu and system/linux/disk (etc). The key here is that checks can be published to multiple subscriptions.

When you adopt more robust subscription options in the check templates, this enables more flexibility on the agent side. You can choose how much linux system monitoring (or similar) you want to enable on a per-node basis by joining the system/linux subscription (to subscribe to all linux system monitoring checks), or to selectively join the individual subscriptions for cpu, memory, disk, etc.

I hope this helps!

2 Likes

Thanks a lot for your replies.

We are currently in the planning phase of our Sensu Go installation, and one of the things we stumbled upon, was the subscription naming.
The template from the “checks template project” seems like a go too.

Thanks a lot!