Search code examples
macrosmonitoringzabbix

Using MACROS in item key definition


I have a problem with using a predefined macro in Zabbix. I have defined two macros as following:

{$HOSTNAME}=2008-windows-server {$IPADDRESS}=192.168.1.1

I want to use them in the item name and item key. macro {$HOSTNAME} maps to its value correctly when it is using in the Name section of the item. But when I used the {$IPADDRESS} in the key of that item, it does not convert to the ip address so I get Not Supported error !! I use it like following: getNetFlowProto[{$IPADDRESS},udp]

getNetFlowProto is a UserParameter which I defined in the zabbix_agend.conf file.

Any help appreciated.


Solution

  • Based on a rather lengthy communication, looks like the following happened :

    • you used Zabbix macros (variables) in both item name and key
    • you checked that the macro in the item name resolved in the monitoring and configuration section, but the macro in the item key did not resolve (in the configuration section)

    That might be caused by the fact that Zabbix does not resolve all macros in all of the configuration pages. That's not very consistent and not clearly documented.

    • you saw the item not working

    That could be caused by a typo and possibly by a delay of the configuration cache - as you make changes to items, Zabbix server might still operate with the previous configuration for up to a minute. You might have seen the previous error, but thought that it was generated by the latest configuration. This guess is supported by the fact that it eventually worked you with what was supposedly the same macro.