Ok, what would be the best practice to add multiple user defined tags to a host, substracted from a host name? This should be universally applicable to diferent HW host types, where data collection is achieved by different methods (SNMP agent to various LAN/SAN switches, HTTPS API thrown at servers and different types of storage devices, etc.). Can this be somehow universally automated via discovery and/or other functions within 7.0 LTS? The point is - the hostname of any HW device/host is always constrained by a specific nomenclature, i.e. same lenght, same defining substrings within the name, etc. Anyone has any good example for such purpose?
Ad Widget
Collapse
Derive multiple tags from purposedly constructed hostnames for any type of HW hosts
Collapse
This topic has been answered.
X
X
-
Answer selected by molnarm at 18-02-2025, 09:01.
the output of the preprocessing step should be a JSON. For example:If the hosts are added via discovery, the yes. You can use scripts or regexp to achieve this. When creating a discovery rule, in the preprocessing steps, one can add a custom script or a custom regexp expression to parse the hostname and extract the meaningful sub-strings from it and assign them to macros which later on can be used as tags in the host prototype.
Otherwise, if hosts are added manually, you could create a script which scans the Zabbix periodically and updates the hosts which do not have the tags yet configured.
Last edited by vsergione; 14-02-2025, 13:50.👍 1- Selected Answer
-
<tag> -> value something like {{HOST.NAME}.regsub("<your regex>",\1 \2..\n)}
Comment
-
If the hosts are added via discovery, the yes. You can use scripts or regexp to achieve this. When creating a discovery rule, in the preprocessing steps, one can add a custom script or a custom regexp expression to parse the hostname and extract the meaningful sub-strings from it and assign them to macros which later on can be used as tags in the host prototype.
Otherwise, if hosts are added manually, you could create a script which scans the Zabbix periodically and updates the hosts which do not have the tags yet configured.Last edited by vsergione; 14-02-2025, 13:40.Comment
-
the output of the preprocessing step should be a JSON. For example:If the hosts are added via discovery, the yes. You can use scripts or regexp to achieve this. When creating a discovery rule, in the preprocessing steps, one can add a custom script or a custom regexp expression to parse the hostname and extract the meaningful sub-strings from it and assign them to macros which later on can be used as tags in the host prototype.
Otherwise, if hosts are added manually, you could create a script which scans the Zabbix periodically and updates the hosts which do not have the tags yet configured.
Last edited by vsergione; 14-02-2025, 13:50.👍 1- Selected Answer
Comment
Comment