Zabbix Documentation 3.2

2.23.04.04.2 (current)In development:4.4 (devel)Unsupported:1.82.02.43.23.4

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:56]
martins-v better link target
manual:config:macros:usermacros [2017/04/26 12:45] (current)
martins-v more precise wording
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.