Reputation: 2171
I can't add user custom macros in templated zabbix trappers' name & key, getting this error:
Invalid key "nginx_50x_error-{$MACROS}" for item "Nginx: nginx 50x errors on {$MACROS}" on "Template_app_nginx": incorrect syntax near "{$MACROS}".
How can I use custom host-macros in templated zabbix trappers? Tnx.
Upvotes: 0
Views: 3287
Reputation: 137
You can use user macro in zabbix key like this:
key_name[{$MACRO1}, {MACRO2}] NOTE: Define macros first and then use above logic
Your user parameter file will look like this: UserParameter=key_name[*],/path/to/executable "$1" "$2"
Upvotes: 0
Reputation: 28716
Documentation: https://www.zabbix.com/documentation/2.4/manual/appendix/macros/supported_by_location
Macro is not allowed in the item key; that's the reason of "invalid key" error:
nginx_50x_error-{$MACROS}
Fortunately, macro is allowed in the item key parameters (Item key parameters - column 7) - and this will be your solution:
nginx_50x_error[{$MACROS}]
Upvotes: 1