Rules based on the hostname regexp

Hi,

checkmk: 2.1.0p9
host: ubuntu 18.04

we have all our hosts added by their FQDN, and would like to add rules based on the domain of a host.

For example I have four hosts in two different folders:

  • hostA.stage.example.com → folder named storage
  • hostB.stage.example.com → folder named compute
  • hostA.prod.example.com → folder named storage
  • hostB.prod.example.com → folder named compute

Now I want to silence all alerts for the staging hosts.

In the respective configuration screen I can only select explicit hosts, but can’t use a regex like *.stage.example.com.

I could use tags, but I can’t dynamically add tags to hosts based on a regexp. I can only have rules for explicit hosts.

I also would like to avoid, to create separate folders for stage, because I would need to double all the rules we have in the folders.

Anything I can do?

The GUI is a little bit patronizing here.

Instead of picking a host from the dropdown you can just start to type. If the first character is a tilde ~ then the rest is interpreted as regular expression. This is also noted in the inline help available through the help menu.

BTW: *.stage.example.com is not a regular expression. .*\.stage\.example\.com would be one.

1 Like

Hey @r.sander,
thank you for the help. It works.

Have a nice rest of the week.

1 Like

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.