Zabbix Documentation 2.0

3.04.04.4 (current)| In development:5.0 (devel)| Unsupported:1.82.02.22.43.23.44.2Guidelines

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

Next revision
Previous revision
manual:config:macros:usermacros [2011/10/17 08:40]
martins-v created, moving info here
manual:config:macros:usermacros [2015/05/05 07:56] (current)
asaveljevs [Example 1] fixed net.tcp.service item key
Line 7: Line 7:
 The macros can be used in: The macros can be used in:
  
-  * item keys and descriptions ​ +  * item names 
-  * trigger ​expressions and names +  * item key parameters ​ 
-  * [[2.0/manual/appendix/macros/supported_by_location#​additional_support_for_user_macros|numerous other locations]]+  * trigger names 
 +  * trigger expression parameters and constants (see examples) 
 +  * several other [[manual:appendix:macros:supported_by_location#​additional_support_for_user_macros|locations]]
  
 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 28: Line 30:
 To define user macros, go to the corresponding locations in the frontend: To define user macros, go to the corresponding locations in the frontend:
   * for global macros, visit //​Administration -> General -> Macros//   * for global macros, visit //​Administration -> General -> Macros//
-  * for host and template level macros, open host or template properties and look for the //​Macros// ​block+  * for host and template level macros, open host or template properties and look for the //​Macros// ​tab
  
 <note tip>If a user macro is used in items or triggers in a template, it is suggested to add that macro to the template even if it is defined on a global level. That way, exporting the template to XML and importing it in another system will still allow it to work as expected.</​note>​ <note tip>If a user macro is used in items or triggers in a template, it is suggested to add that macro to the template even if it is defined on a global level. That way, exporting the template to XML and importing it in another system will still allow it to work as expected.</​note>​
Line 43: Line 45:
 Use of host-level macro in the "​Status of SSH daemon"​ item key: Use of host-level macro in the "​Status of SSH daemon"​ item key:
  
-**net.tcp.service[ssh,​{$SSH_PORT}]**+**net.tcp.service[ssh,,​{$SSH_PORT}]**
  
 This item can be assigned to multiple hosts, providing that the value of **{$SSH_PORT}** is defined on those hosts. This item can be assigned to multiple hosts, providing that the value of **{$SSH_PORT}** is defined on those hosts.
Line 64: Line 66:
  
 Note that a macro can be used as a parameter of trigger function, in this example function **min()**. Note that a macro can be used as a parameter of trigger function, in this example function **min()**.
 +
 +<note important>​In trigger expressions user macros will expand if referencing a parameter or constant. They will NOT expand if referencing the host, item key, function, operator or another trigger expression.</​note>​