Possible bug? Unable to add more than one host label to a rule or predefined condition

Hi,

I don’t know if this is a bug, but I’m trying to add more than one host label to rules or predefined conditions, but it only seems to be saving one.

Setting multiple:

Only one being saved:

When I go back in to edit the rule, sure enough, only the first one has been saved.

Is this a known issue?

Cheers,

Rich

Hi @pn-rallen,
which version do you use?
In 1.6.0p11 I had a similiar Bug in the Rule “Assignment of services to contact groups” , there it also was not possible to use more then one label. This should be be fixed in p12 and later.
Maybe your issue is also fixed in the current release?

regards
Christian

Hi, it’s 1.6.0p13 CEE.

I can only say that i see the same behavior.

1 Like

Hi,

what you are seeing is actually intended behavior. A host cannot have two labels with the same key but different values, see https://checkmk.com/cms_labels.html. Since the host labels are combined via an AND-Operation when checking whether a given rule applies to a host (also see the link above), the rule you are trying to define would never match, since you use the same key (pn_sysinfo/operatingsystem) twice, but with different values.

What happens internally is that checkmk uses as dictionary (Python) to handle the labels. It uses the label keys as dictionary keys and overwrites one label with the other (since the keys are equal).

Best
Jörg

2 Likes

I understand. The only thing I would add then, is that it would be useful if the UI gave some indication that that was the case :slight_smile:

Thanks Jörg!

1 Like

We agree, we now have a ticket in our development queue for this, so this issue will be addressed at some point.
Best
Jörg

2 Likes