I am new to Check_mk, and I’m trying to auto-assign hosts to either folders or tags based on hostname (preferably, although I could potentially work with other criteria). I cannot find any ruleset or configuration that would allow automatic assignment based on a rule, and the documentation only seems to give instructions about how to manually assign hosts.
Also, please consider this a feature request . . . I think being able to auto-categorize hosts in some fashion within the product would be tremendously useful.
If you can categorize your hosts based on their names because you have a consistent naming scheme you already can use regular expressions in rule conditions. No need for host tags.
Any other categorization would need to use additional information (maybe out of a CMDB). This is always a very custom approach and will need to be coded. This is what the API is for.
For example, I would like to create a host group consisting of my dev/test servers. The most obvious way to do that is to use the system criticality tag. Unfortunately, the system criticality tag is assigned to “productive (sic) systems” by default, and the only way I can see to change the tag is by hand or via the API. How would I group or categorize hosts based on hostname using a regular expression?
If you want to create a “real” host group, there is the WATO module “Host & Service Groups”.
You create a new group there and also will find a button “Rules” with the ruleset “Assignment of hosts to host groups”. There you can create rules with conditions that match on regular expressions.
If you want to tag your hosts based on the hostname: This is automatically only possible with the API.
You could create WATO folders that set the host tag and inherit it to the hosts in the folder. But you still need to sort your hosts into folders manually or again via API.
I made it to the point of finding the ruleset you mention, but I don’t see a way to do use a regular expression to do anything. Should I check the box marked “Explicit hosts” and then use a regex in that field?
What I am asking for does not appear to be possible in 1.6, according to both the documentation and the user interface. Not to belabor the point, but I, as a user, would find it useful to be able to group hosts or assign tags via regex rather than doing so via the API or manually.
If this is possible with host names, I would find it very helpful if you could explain how. From everything I observe, it is not possible to apply rules to host names via regex.
Choose the rule you want to create, for example “Assignment of hosts to host groups”, enable explicit hosts, add the “~” and then add the regular expression you want to match your hosts with.
This is documented in the inline help and in the documentation @rsander posted :
Alternatively you can use regular expressions if you enter a tilde (~) as the first character. That regular expression must match the *beginning* of the host names in question.
Additionally you can attach host labels the same way and base your ruleset on those labels.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact @fayepal if you think this should be re-opened.