AND/OR logic for tags in service rules

Hi,

When creating a rule for a service, one of the ways you can apply them to a group of hosts is via host labels, but when adding multiple labels it seems to only support AND-logic, at least I can’t seem to find how to change it.

In my case, I’d like to have something like one rule (“Monitor cert expiry”) which would add a service if a host has tags https:default OR https:certonly.

Instead, it seems I now have to duplicate the rule which means I end up with something like this (just for illustration, not actual yaml):

tag: https:default
    rule1: "check port 443"
    rule2: "check cert expiry"
tag: https:certonly
    rule3: "check cert expiry #2"

I realize that one way to do this would be to simply split the checks among multiple tags, like maybe one https_certonly:true and one https_443only:true and then have some hosts with two tags and some with one, but I feel like the ability to use OR logic would help here, because then I could simply say that cert monitoring should apply for both tags separately, not only in cases where a system has both (in this example they never would).

Perhaps using “subtags” like this that only include a subset of checks in a “parent” tag is bad practice? Any suggestions are welcome, I’m coming from a Nagios background so using rules and tags isn’t something I’m used to.

Hi @baleygr,

AND/OR/NOT Filters for Labels will be coming in 2.3 https://ideas.checkmk.com/suggestions/339982/support-andornot-for-labels-in-rules

at the moment, you can only do this with tags, if you create an aux tag (see Host tags) that you assign to both the “https_default” and the “https_certonly” tag.

Gerd

2 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.