[ZBX-22777] Undefined user macro is resolved to user macro name Created: 2023 May 09  Updated: 2024 Jun 26  Resolved: 2023 Jul 26

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 5.0.34, 6.0.17, 6.4.2, 7.0.0alpha1
Fix Version/s: 6.0.20rc1, 6.4.5rc1, 7.0.0alpha3, 7.0 (plan)

Type: Problem report Priority: Minor
Reporter: Edgar Akhmetshin Assignee: Ivo Kurzemnieks
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

RHEL 8.7/6.0.17


Attachments: PNG File Screenshot 2023-05-09 at 09.15.08.png    
Issue Links:
Causes
Duplicate
Team: Team B
Sprint: Sprint 100 (May 2023), Sprint 101 (Jun 2023), Sprint 102 (Jul 2023)
Story Points: 0.25

 Description   

Steps to reproduce:

  • Create a new Host
  • Add a SNMP Interface
  • Create a template where you define the Macros needed for the interface configuration but forget to create the “{$SNMP_CONTEXT} macro
  • Add some SNMP Agent Item to the Host

    Result:
  • The SNMP Interface will become “Not available” with a timeout error: “Timeout while connecting...".
  • If you click on the SNMP Item on the host and click “Test” the item works and you get a value back, since device is configured without context name.

This is caused by the fact that in the SNMP Interface configuration in the “Context name” field the macro “{$SNMP_CONTEXT}” is set, but this macro has not been defined on the Template or Host
What seems to be happening is that for “normal” SNMP Items checks Zabbix is sending the Value {$SNMP_CONTEXT} as context name since the macro has not been defined, but when manually testing the Item Zabbix seems to not send this context name → this is inconsitent und leads to confusion while troubleshooting because the interface gives a timeout error while a manual test works just fine.

Documentation:
https://www.zabbix.com/documentation/current/en/manual/config/macros/user_macros

If Zabbix is unable to find a macro, the macro will not be resolved.

Expected:
Consistent behaviour of the undefined macro - no value or macro name returned and also described behaviour in the documentation.



 Comments   
Comment by Ivo Kurzemnieks [ 2023 Jun 21 ]

Fixed in development branch feature/ZBX-22777-6.0

Comment by Ivo Kurzemnieks [ 2023 Jul 20 ]

Fixed in:

Generated at Mon Jun 30 09:32:44 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.