Update hosts dynamically
Overview
It is possible to modify certain parts of a host's configuration dynamically. This feature is especially useful if certain host configurations need to change frequently based on different conditions. For example, you may want to switch between various notification configurations for multiple hosts when a host is part of a specific group.
To configure such dynamic updates, you must create rulesets that filter hosts by conditions based on host properties and access groups.
Currently, the following host fields can be updated:
- Timezone
- Host Severity
- Geo Coordinates
- Host Macros
- Notifications:
- Enable/Disable
- Options (down, unreachable, recovering, etc.)
- Notified Contacts
- Notified Contact Groups
To view all existing rulesets or add a new one, navigate to Configuration -> Hosts -> Host Configuration Rules
.
On the list page, you will see:
- 1 a list of all current rulesets
- 2 options to filter the list: - filter by rule name - filter by macro names (macros to set on the host) - filter by contactgroups (to set on the host) - filter by contacts (to set on the host) - filter by status (enabled/disabled) - filter by access groups (for admin)
- 3 options to paginate the list
- 4 a button to add a new ruleset
- 5 a button to simulate all rulesets and to analyze which hosts will be updated
- 6 a button to apply all rulesets manually
- 7 the possibility to [reorder rules](./updating-hosts-dynamically#order-rulesets)
Create a new ruleset
To create a new ruleset, click 4 + Add Rule
above the list.
In the sidebar that opens, enter the following information:
General
- 1 enter a descriptive name for the ruleset
- 2 (optional) enter a description for the ruleset
- 3 select the access groups for the rule; only hosts which are accessible by the selected access groups will be affected, and only users with access to all selected access groups will be able to interact with the rule
Set Host Fields
Each field is optional; provide a value only if you want to set the value directly on the hosts.
Fields left empty have no effect on matched hosts.
- 4 choose a timezone
- 5 choose a severity
- 6 set geo coordinates
7 Set Host Macros
You can also configure host macros, which will be set on matched hosts.
To add a new macro, click the +
button next to the label.
Set Notification Options
Each field is optional; provide a value only if you want to set the value directly on the hosts.
Fields left empty have no effect on matched hosts.
- 8 enable or disable notifications
- 9 choose the desired notification options to specify when a notification should be sent
10 Contacts
Setting contacts is optional
Select contacts that will be assigned to matched hosts.
When Incremental
is checked, selected contacts are added to hosts; when unchecked, selected contacts are overwritten on hosts.
- 11 Contactgroups
Setting contactgroups is optional
Select contact groups that will be assigned to matched hosts.
When Incremental
is checked, selected contact groups are added to hosts; when unchecked, selected contact groups are overwritten on hosts.
12 Define Conditions
At least one condition is required
Define the conditions used to match the hosts you want to update.
To add a new condition, click the +
button next to the label.
When adding a new condition, a dialog will appear. In this dialog, provide the following information:
- the host property to check
- the operator to use for matching the value
- the value of the selected property to check against the host
When a host matches *all defined conditions, it will be affected by the ruleset and updated.
You can combine as many conditions as you like, but ensure that conditions are strict enough to avoid matching unwanted hosts.
Remember that, in addition to the conditions, the selected access groups are also part of the conditions. This behavior ensures that only hosts from a certain organization are affected by the ruleset (MSP compliance).
Special Conditions
The following combinations allow for more specific configuration:
- property
host address
with operatormatch cidr
to check if the host address belongs to a certain subnet - property
host address
with operatorin range
to check if the host address is inside a certain ip range - property
host macro
- CIDR
- IP range
- Macros
When selecting the property host macro
you must also define the macro name to check.
You can choose the macro name from the list, which contains all utilized macro names among the monitoring system.
Alternatively, you can freely enter an unlisted (custom) macro name.
Macros may be inherited from other templates or directly set on the host. This is especially useful when you want to target hosts more specifically—such as when they belong to a certain organization, or in the case of VMware hosts, a particular container.
The value of the specified macro on a host (if present) will be checked against the provided value or regex (when operator is matches
).
If a host doesn't have the macro set or inherited, the condition will fail when the operator is:
equals
, contains
, matches
(when using matches
, an empty value will be checked if the macro is missing).
If the selected operator is not equals
or not contains
, the condition will always be true.
This behavior applies to all other properties as well.
When you filled in all required rule information and defined the conditions, you can save the the rule.
You can always edit your rule afterward.
Order Rulesets
The order of rules has a significant effect when applying the rules.
Rules are applied from top to bottom in the displayed order, so keep this behavior in mind if multiple rules affect the same hosts. One rule may overwrite fields set by another rule.
To reorder your rules, drag and drop a rule by grabbing the icon at the beginning of a row.
Test your rulesets
Before applying your rulesets directly, it is recommended to test them to identify any misconfigured rules or hosts that might be incorrectly updated.
To do this, click 5 Simulate Rules
to test all available rules (only enabled ones),
or simulate a single rule by hovering over it and clicking the simulate button.
Simulating only one rule won't inform you of any conflicts with other rules!
A dialog will display the simulation results.
If one or more rules conflict, a special view appears at the top of the simulation results, detailing the conflicts.
- Conflicts
- Results
A special orange entry appears in the simulation results when conflicts are detected. The information is as follows:
- 1 the header contains details about the number of conflicting rules and hosts
- 2 clicking the header opens a detailed view with a list of conflicts grouped by field
- 3 the
Field
column shows the host field in conflict - 4 the
Rule
column and 5Value
column indicate the value set by each rule - 6 the
Hosts
column lists all hosts affected by the conflict
Simulation results are shown by rule, with the order matching the apply-order.
Click on a result item to display details about the rule, including which fields are set and which hosts are affected.
Each simulation result provides the following information:
- 1 the header displays the rule name, the number of fields set by the rule, and the number of hosts affected
- 2 a warning icon appears if the rule conflicts with other rules (see the "Conflicts" tab for more information)
- 3 the rule description
- 4 a list of all hosts affected by this rule; these hosts will be updated with the specified field values upon applying the rule
- 5 all fields and their corresponding values set by this rule
- 6 a warning icon is displayed for a field if it conflicts with other rules
Now, when you apply the rule(s), the hosts will be updated according to the defined rules.
How to Deal with Conflicts
If you encounter conflicts during simulation, you may decide to adjust rule configurations or leave them as is. Keep in mind that rule application relies on order. For example, if multiple rules affect a host, it may not be necessary to adjust a rule if the last value applied is the desired one.
Using the simulation conflict detail view during simulation helps you identify conflicting rules and view different values set for a field.
To resolve conflicts, you have several options:
- Use more specific conditions on conflicting rules to prevent overlap
- Reorder your rules so that the preferred value is always applied last
- Leave the rules as they are if the final value already meets your requirements
We recommend preventing or resolving conflicts whenever possible. Handling conflicts can be complex, as you need absolute clarity on the final value that will be set on a host.
When many conflicts exist across different rules, this process can become confusing and hard to estimate.
Applying Rulesets
By default, all enabled rules are applied every hour.
To apply rules manually, click the 6 Apply Rules
button above the list.
After applying, ensure that you export the corresponding poller configurations for your rules to take full effect.
Other Actions
When hovering over a rule in the list, additional actions are available:
- 1 enable/disable the rule; a disabled rule has no effect when rules are applied
- 2 delete the rule
- 3 duplicate the rule
- 4 simulate the rule