Zabbix Documentation 5.0

3.04.05.0 (current)| In development:5.2 (devel)| Unsupported:1.82.02.22.43.23.44.24.4Guidelines

User Tools

Site Tools


manual:config:macros:lld_macros

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
manual:config:macros:lld_macros [2018/08/21 08:14]
martins-v more precise wording
manual:config:macros:lld_macros [2020/06/10 08:40]
martins-v updating link target
Line 1: Line 1:
-==== Low-level discovery macros ====+==== Low-level discovery macros ====
  
 === Overview === === Overview ===
Line 7: Line 7:
   {#​MACRO} ​   {#​MACRO} ​
  
-It is a macro that is used in an LLD rule and returns real values of file system ​names, network ​interfaces and SNMP OIDs.+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 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.
Line 19: Line 19:
 LLD macros can be used: LLD macros can be used:
  
 +  * in the low-level discovery rule filter
   * for item prototypes in   * for item prototypes in
-    * names+    * name
     * key parameters     * key parameters
-    * units +    * unit 
-    * update ​intervals +    * update ​interval<​sup>​[[lld_macros#​footnotes|1]]</​sup> ​ 
-    * history storage ​periods +    * history storage ​period<​sup>​[[lld_macros#​footnotes|1]]</​sup> ​ 
-    * trend storage ​periods +    * trend storage ​period<​sup>​[[lld_macros#​footnotes|1]]</​sup>​  
-    * SNMP OIDs +    * item value preprocessing steps 
-    * IPMI sensor ​fields +    * SNMP OID 
-    * calculated item formulas +    * IPMI sensor ​field 
-    * SSH and Telnet ​scripts +    * calculated item formula 
-    * database monitoring SQL queries +    * SSH script ​and Telnet ​script 
-    * JMX item endpoint ​fields +    * database monitoring SQL query 
-    * descriptions +    * JMX item endpoint ​field 
-    ​* since Zabbix 4.0 also in: +    * description 
-      * item value preprocessing steps +    * HTTP agent URL field 
-      ​* HTTP agent URL field +    * HTTP agent HTTP query fields field 
-      * HTTP agent HTTP query fields field +    * HTTP agent request body field 
-      * HTTP agent request body field +    * HTTP agent required status codes field 
-      * HTTP agent required status codes field +    * HTTP agent headers field key and value 
-      * HTTP agent headers field key and value +    * HTTP agent HTTP authentication username field 
-      * HTTP agent HTTP authentication username field +    * HTTP agent HTTP authentication password field 
-      * HTTP agent HTTP authentication password field +    * HTTP agent HTTP proxy field 
-      * HTTP agent HTTP proxy field +    * HTTP agent HTTP SSL certificate file field 
-      * HTTP agent HTTP SSL certificate file field +    * HTTP agent HTTP SSL key file field 
-      * HTTP agent HTTP SSL key file field +    * HTTP agent HTTP SSL key password field 
-      * HTTP agent HTTP SSL key password field +    * HTTP agent HTTP timeout<​sup>​[[lld_macros#​footnotes|1]]</​sup> ​field
-      * HTTP agent HTTP timeout field+
   * for trigger prototypes in   * for trigger prototypes in
-    * names +    * name 
-    * expressions +    * operational data 
-    * URLs +    * expression (only in constants and function parameters) 
-    * descriptions +    * URL 
-    * event tag names and values+    * description 
 +    * event tag name and value
   * for graph prototypes in   * for graph prototypes in
-    * names+    * name
   * for host prototypes in   * for host prototypes in
-    * names +    * name 
-    * visible ​names +    * visible ​name 
-    * host group prototype ​names+    * host group prototype ​name 
 +    * host macro value
     * (see the [[:​manual/​vm_monitoring/​discovery_fields|full list]])     * (see the [[:​manual/​vm_monitoring/​discovery_fields|full list]])
  
-In all those places LLD macros can be used inside user [[:manual/config/macros/​usermacros#​user_macro_context|macro context]].+In all those places LLD macros can be used inside ​static ​user [[manual:config:macros:​user_macros_context|macro context]].
  
 === Using macro functions === === Using macro functions ===
  
-Macro functions are supported with low-level discovery macros, allowing to extract a certain part of the macro value using a regular expression.+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: For example, you may want to extract the customer name and interface number from the following LLD macro for the purposes of event tagging:
Line 74: Line 76:
  
 {{:​manual:​config:​macros:​lld_macro_function.png|}} {{:​manual:​config:​macros:​lld_macro_function.png|}}
 +
 +Note, that commas are not allowed in unquoted item [[:​manual/​config/​items/​item/​key#​key_parameters|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:
 +  net.if.in["​{{#​IFALIAS}.regsub(\"​(.*)_([0-9]+)\",​ \1)}",​bytes]
  
 For more information on macro function syntax, see: [[:​manual/​config/​macros/​macro_functions|Macro functions]] For more information on macro function syntax, see: [[:​manual/​config/​macros/​macro_functions|Macro functions]]
Line 79: Line 84:
 Macro functions are supported in low-level discovery macros since Zabbix 4.0. Macro functions are supported in low-level discovery macros since Zabbix 4.0.
  
 +== Footnotes ==
 +
 +<​sup>​**1**</​sup>​ In the fields marked with <​sup>​[[lld_macros#​footnotes|1]]</​sup>​ a single macro has to fill the whole field. Multiple macros in a field or macros mixed with text are not supported.