Zabbix Documentation 3.2

3.04.04.24.4 (current)| In development:5.0 (devel)| Unsupported:1.82.02.22.43.23.4Guidelines

User Tools

Site Tools


manual:config:macros:usermacros

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:usermacros [2016/09/28 07:52]
martins-v link to examples
manual:config:macros:usermacros [2017/04/26 12:45]
martins-v more precise wording
Line 14: Line 14:
   * item key parameters ​   * item key parameters ​
   * trigger names and descriptions   * trigger names and descriptions
-  * trigger expression parameters and constants ([[#​examples#example_2|examples]]) +  * trigger expression parameters and constants (see [[#​examples|examples]]) 
-  * several ​other [[manual:appendix:macros:supported_by_location#​additional_support_for_user_macros|locations]]+  * many other locations (see [[:manual/appendix/macros/supported_by_location|Macros supported by location]])
  
 The following characters are allowed in the macro names: **A-Z** , **0-9** , **_** , **.** The following characters are allowed in the macro names: **A-Z** , **0-9** , **_** , **.**
Line 80: Line 80:
   {$MACRO:​context} ​   {$MACRO:​context} ​
  
-Macro context is a simple text value. The common use case for macro contexts would be using an [[:​manual/​discovery/​low_level_discovery#​using_lld_macros_in_user_macro_contexts|LLD macro value]] as a user macro context. For example, a trigger prototype could be defined for mounted file system discovery to use a different low space limit depending on the mount points or file system types.+Macro context is a simple text value. The common use case for macro contexts would be using a low-level discovery ​[[:​manual/​discovery/​low_level_discovery#​using_lld_macros_in_user_macro_contexts|macro value]] as a user macro context. For example, a trigger prototype could be defined for mounted file system discovery to use a different low space limit depending on the mount points or file system types.
  
-Only discovery macros are supported in macro contexts. Any other macros are ignored and treated as plain text.+Only low-level ​discovery macros are supported in macro contexts. Any other macros are ignored and treated as plain text.
  
 Technically,​ macro context is specified using rules similar to [[manual:​config:​items:​item:​key|item key]] parameters, except macro context is not parsed as several parameters if there is a '',''​ character: Technically,​ macro context is specified using rules similar to [[manual:​config:​items:​item:​key|item key]] parameters, except macro context is not parsed as several parameters if there is a '',''​ character:
  
-  * Macro context ​is quoted with ''<​nowiki>"</​nowiki>''​ if the context contains a ''​}''​ character or starts with a ''<​nowiki>"</​nowiki>''​ character. Quotes inside quoted ​macros ​must be escaped with the ''​\''​ character. The ''​\''​ character itself is not escaped, which means it's impossible to have a quoted ​macro ending with the ''​\''​ character - the macro ''​{$MACRO:<​nowiki>"</​nowiki>​a:​\b\c\<​nowiki>"</​nowiki>​}''​ is invalid.+  * Macro context ​must be quoted with ''<​nowiki>"</​nowiki>''​ if the context contains a ''​}''​ character or starts with a ''<​nowiki>"</​nowiki>''​ character. Quotes inside quoted ​context ​must be escaped with the ''​\''​ character. The ''​\''​ character itself is not escaped, which means it's impossible to have a quoted ​context ​ending with the ''​\''​ character - the macro ''​{$MACRO:<​nowiki>"</​nowiki>​a:​\b\c\<​nowiki>"</​nowiki>​}''​ is invalid.
   * The leading spaces in context are ignored, the trailing spaces are not. For example ''​{$MACRO:​A}''​ is the same as ''​{$MACRO:​ A}'',​ but not ''​{$MACRO:​A }''​.   * The leading spaces in context are ignored, the trailing spaces are not. For example ''​{$MACRO:​A}''​ is the same as ''​{$MACRO:​ A}'',​ but not ''​{$MACRO:​A }''​.
   * All spaces before leading quotes and after trailing quotes are ignored, but all spaces inside quotes are not. Macros ''​{$MACRO:<​nowiki>"</​nowiki>​A<​nowiki>"</​nowiki>​}'',​ ''​{$MACRO:​ <​nowiki>"</​nowiki>​A<​nowiki>"</​nowiki>​}'',​ ''​{$MACRO:<​nowiki>"</​nowiki>​A<​nowiki>"</​nowiki>​ }''​ and ''​{$MACRO:​ <​nowiki>"</​nowiki>​A<​nowiki>"</​nowiki>​ }''​ are the same, but macros ''​{$MACRO:<​nowiki>"</​nowiki>​A<​nowiki>"</​nowiki>​}''​ and ''​{$MACRO:<​nowiki>"</​nowiki>​ A <​nowiki>"</​nowiki>​}''​ are not.   * All spaces before leading quotes and after trailing quotes are ignored, but all spaces inside quotes are not. Macros ''​{$MACRO:<​nowiki>"</​nowiki>​A<​nowiki>"</​nowiki>​}'',​ ''​{$MACRO:​ <​nowiki>"</​nowiki>​A<​nowiki>"</​nowiki>​}'',​ ''​{$MACRO:<​nowiki>"</​nowiki>​A<​nowiki>"</​nowiki>​ }''​ and ''​{$MACRO:​ <​nowiki>"</​nowiki>​A<​nowiki>"</​nowiki>​ }''​ are the same, but macros ''​{$MACRO:<​nowiki>"</​nowiki>​A<​nowiki>"</​nowiki>​}''​ and ''​{$MACRO:<​nowiki>"</​nowiki>​ A <​nowiki>"</​nowiki>​}''​ are not.