[ZBX-19425] Host macros are not resolved when used in actions Created: 2021 May 21  Updated: 2024 Apr 10  Resolved: 2021 Jun 22

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 5.4.0
Fix Version/s: 5.4.2rc2, 6.0.0alpha1, 6.0 (plan)

Type: Problem report Priority: Trivial
Reporter: Brian van Baekel Assignee: Dmitrijs Goloscapovs
Resolution: Fixed Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Centos8, MariaDB


Attachments: PNG File Screenshot 2021-05-21 at 10.46.11.png     PNG File Screenshot 2021-05-21 at 10.46.28.png     PNG File Screenshot 2021-05-21 at 10.47.31.png     PNG File Screenshot 2021-05-21 at 10.49.15.png    
Team: Team A
Sprint: Sprint 76 (May 2021), Sprint 77 (Jun 2021)
Story Points: 1

 Description   

Start with a 5.0 instance.

Create host, and on that host add 2 macros:

 

Macro name Macro value Macro type
{$MACRO1} clear clear text
{$MACRO2} hidden secret text

Build an item, trigger and make an action based on that trigger.

Action:

Force the trigger to go into the problem state, and see what's going on in the event details:

This can be confirmed by checking that log.log file:

 

[root@zbx50 zabbix]# cat log.log  
The hidden macro: hidden and the clear: clear

 

 

Now build the same setup in a 5.4 instance (or upgrade your 5.0), and check the event details:

 

 

When opening that log file:

 

[root@zbx54 zabbix]# cat log.log
The hidden macro: {} and the clear: {}

 

 

Expected: The same behaviour as 5.0 since hostmacros aren't that strange to use in your actions.

 



 Comments   
Comment by dimir [ 2021 May 21 ]

Just a note, in the log of 5.4

[root@zbx54 zabbix]# cat log.log
The hidden macro: {} and the clear: {}

Looks like macros are passed to shell {$MACRO1} and since variable $MACRO1 does not exist it translates to {}.

Comment by dimir [ 2021 May 21 ]

Possibly caused by ZBXNEXT-6451

Comment by Vladislavs Sokurenko [ 2021 May 21 ]

Also related ZBX-19012

Comment by Vladislavs Sokurenko [ 2021 May 21 ]

Confirmed, previously Zabbix server would always retrieve current host for all global scripts, the only exception was not to retrieve host for custom scripts if it is executed on Zabbix server (though custom script could use global script, in this case it was not possible to configure Zabbix server as target in actions). From now on scripts and global scripts are merged as one so should continue retrieving host unconditionally.

There was confusion because you could use custom script that uses global script and you would configure Zabbix server as target on global script level but custom script would have agent as target in database.

Comment by Dmitrijs Goloscapovs [ 2021 Jun 21 ]

Available in versions:

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