There is a type of macro used within the low-level discovery (LLD) function:
It is a macro that is used in an LLD rule and returns real values of the file system name, network interface, SNMP OID, etc.
These macros can be used for creating item, trigger and graph prototypes. Then, when discovering real file systems, network interfaces etc., these macros are substituted with real values and are the basis for creating real items, triggers and graphs.
These macros are also used in creating host and host group prototypes in virtual machine discovery.
Some low-level discovery macros come "pre-packaged" with the LLD function in Zabbix - {#FSNAME}, {#FSTYPE}, {#IFNAME}, {#SNMPINDEX}, {#SNMPVALUE}. However, adhering to these names is not compulsory when creating a custom low-level discovery rule. Then you may use any other LLD macro name and refer to that name.
LLD macros can be used:
In all those places LLD macros can be used inside static user macro context.
Macro functions are supported with low-level discovery macros (except in low-level discovery rule filter), allowing to extract a certain part of the macro value using a regular expression.
For example, you may want to extract the customer name and interface number from the following LLD macro for the purposes of event tagging:
To do so, the regsub
macro function can be used with the macro in the event tag value field of a trigger prototype:
Note, that commas are not allowed in unquoted item key parameters, so the parameter containing a macro function has to be quoted. The backslash (\
) character should be used to escape double quotes inside the parameter. Example:
For more information on macro function syntax, see: Macro functions
Macro functions are supported in low-level discovery macros since Zabbix 4.0.
1 In the fields marked with 1 a single macro has to fill the whole field. Multiple macros in a field or macros mixed with text are not supported.