I. Overview
Zabbix supports many macros that are used in various situations. A macro is a variable that is identified by the following special syntax: macro
Using macros effectively saves you time and makes Zabbix more efficient.
In a typical use, a macro can be used in a template. Therefore, the template's trigger may be named ' {host.name} ' mysql{#MYSQLPORT} port is down, please check! ”。
When this template is applied to the host (the Dragon is in the Sky roledb-192.168.1.100), and when the trigger is displayed on the Monitoring page, the name of the trigger resolves to "the Dragon's mysql3306 port on the day roledb-192.168.1.100 has been down, please pay attention to see!" ”。
Second, the use of scene 1, macro priority
- Host macro
- Set up directly on the host
- The macro that the host template defines, and if there are multiple templates, the higher the precedence of the macro (template).
- Global macro
2. Examples of use of macros
- The majority of LLD
1, for example, when monitoring MySQL multi-instance, we are not sure how many instances of MySQL how many ports, so only through a variable to represent, the macro, it will be the only choice.
When we are monitoring the host, different hosts may have different parameters (such as different passwords, ports), then you need to set the macro variable for a single host. Because the macros on the host have the highest precedence.
Third, the supported macros
Zabbix Combat-Simple tutorial-macro variable