[ZBX-24636] {HOST.IP} and {HOST.DNS} not blank if undefined in 7.0.0RC3 Created: 2024 Jun 10  Updated: 2024 Nov 26  Resolved: 2024 Aug 25

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 7.0.0
Fix Version/s: 7.0.4rc1, 7.2.0alpha1

Type: Problem report Priority: Major
Reporter: Linwood Ferguson Assignee: Vladislavs Sokurenko
Resolution: Fixed Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 22.04.04, PostgresSql, updated from distro to 7.0.0rc3.


Attachments: PNG File Screenshot 2024-08-14 at 16.34.26.png     JPEG File action.jpg     PNG File image-2024-06-17-20-14-46-542.png     JPEG File macros.jpg     PNG File screenshot-1.png    
Issue Links:
Causes
causes ZBX-25314 After the update from 7.0.3 to 7.0.4,... Closed
Duplicate
is duplicated by ZBX-25163 Zabbix Events cant translate Macros o... Closed
is duplicated by ZBX-25600 Macros not resolved for some hosts in... Closed
Team: Team B
Sprint: Prev.Sprint, S24-W32/33
Story Points: 0.25

 Description   

I upgraded from a previous beta to RC3 and numerous triggers immediately started failing.

Steps to reproduce:

  1. External check such as DNSMatchIP[\{HOST.DNS},\{HOST.IP},\{$OPTIONAL_DOMAINS}]
  2. In the host, leave either the host name or the host IP blank (not specified) in the agent interface definition (in my case only agent is defined not snmp, etc.)
  3. the script code invoked looks like
    hostname="$1"
    ip="$2"
    addedDomain="$3"
    
    if [ -z $ip ]
    then
        # Consider a blank IP as on purpose, as it implies a DNS lookup for IP anyway
        echo "Ok"
        exit
    fi
    
    if [ -z $hostname ]
    then
        # Consider a blank name as on purpose (we can report these in various debug queries if not)
        echo "Ok"
        exit
    else
        if [ -z $ip ]
        then
            echo "Missing IP address"
            exit
        fi
    fi
    
    

     

Result:
**

In the prior beta (and going back many versions over years), these macros became blank if undefined. Now they are appearing as their text, e.g. instead of (without quotes) "" they appear as "{HOST.IP}" or "{HOST.DNS}". 

Expected:

I am unable to find any documentation that this is on purpose (though I confess I may have just missed it), but it seems incorrect, and will break people's code that presume the behavior remained the same. 



 Comments   
Comment by t-np [ 2024 Jun 13 ]

i guess this also affected notification actions

Comment by Linwood Ferguson [ 2024 Jun 13 ]

e's actually a bigger problem.  I'm not sure what is happening, but my HTML mail script has no substitutions at all, it's coming through with literals.  These actually have values, or should (unless something changed in syntax). 

Here's a side by side comparison of an alert (forced by changing the IP to be wrong).  It's an attachment named side-by-side.  The HTML email generation suppresses items that are blank (which should be in 2-9 in this case) but it is not even generating the right values for the defined item.   I'm going to have to capture the intermediate files before I send the email, but this is clearly really wrong.  Unless something got broken in my install – any chance someone else could check? 

Comment by Linwood Ferguson [ 2024 Jun 13 ]

I created a custom message for the action with lots of macros that I use in HTML email, and generated it without HTML, just sent it out via regular email. 

Essentially it's just a mess.  Some things substituted as normal, some were ignored, some changed from UNKNOWN to literal substitutions.  Some worked.  Here's a set of the macro name (without brace so it comes out literally) followed by the substituted (or not) value. 

Unless this is somehow specific to me, some problem with my configuration, this looks like a show stopper to me.

Comment by Edgars Melveris [ 2024 Jun 17 ]

Hello!

I tested this on a fresh 7.0.0 and it seems to work as expected (at least {HOST.IP} and {HOST.DNS} macros)

Can you test this again on a clean installation?

Comment by t-np [ 2024 Jun 17 ]

zux did you follow Linwood reproduction steps?

  1. External check such as DNSMatchIP[
    {HOST.DNS}

    ,

    {HOST.IP}

    ,
    {$OPTIONAL_DOMAINS}]

  2. In the host, leave either the host name or the host IP blank (not specified) in the agent interface definition (in my case only agent is defined not snmp, etc.)
  3. the script code invoked looks like

im having the same issues, im using the macros in a media type and call a python script like this

0`{EVENT.TIME}`{EVENT.DATE}`{EVENT.NAME}`{HOST.HOST}`{TRIGGER.SEVERITY}`{EVENT.ID}`{HOST.NAME}`{TRIGGER.ID}`{HOST.DESCRIPTION}`{HOST.IP}`{HOST.DNS}

everything works except HOST.IP and HOST.DNS

i noticed following https://support.zabbix.com/browse/ZBX-24560  https://git.zabbix.com/projects/ZBX/repos/zabbix/commits/1056038f8c7ed184d522db750a25a03d75e42412#src/libs/zbxexpression/datafunc.c that falls in this ballpark but for our issue there has to be a problem finding the interface at all

Comment by Linwood Ferguson [ 2024 Jun 17 ]

By "clean installation" if you mean not modified, this is installed from the distro not from source.

If you mean completely empty install with default database and everything else - I have not.  I'd need to spin up a new VM.  I probably can't take time for that until later in the week, but given that it is not just me.... ?

Question: Mine is labeled 7.0.0rc3.  Is that the same as "fresh 7.0.0" you are using?  I am wondering if ubuntu's distro is current? 

Comment by Edgars Melveris [ 2024 Jun 17 ]

Sorry, I checked again and looks like you're right.
I've modified the script to just output the values:

hostname="$1"
ip="$2"
addedDomain="$3"

echo "IP - $ip "
echo "Hostname - $hostname"

It works when using test:


But in actual history of the item HOST IP is not expanded:

Confirmed.

Comment by Linwood Ferguson [ 2024 Jun 17 ]

Glad you can see it.  I suspect this is going to bite a lot of people who have written external checks and notifications.  Hope it can get cleared up before too many people jump on the 7.0 bandwagon for real (my install is my home only, been telling clients "wait for a point release!"). 

Comment by Adawid [ 2024 Jul 10 ]

Hi,

I'm testing the V7.0.0 and I notice this point.

{HOST.DNS}

and {HOST.IP} block the resolution to macro

Result Without DNS:



Step Time User/Recipient Action Message/Command Status Info
1 2024-07-10 01:21:14 PM zbx_alerting_user
test 1 PROBLEM : 211
EVENT.DATE: 2024.07.10
EVENT.ACK.STATUS: No
EVENT.ID: 211
EVENT.NAME: Heartbeat
EVENT.NSEVERITY: 2
EVENT.OPDATA: 0
EVENT.TAGS: Heartbeat
EVENT.TAGSJSON: [{"tag":"Heartbeat","value":""}]
EVENT.TIME: 13:21:14
EVENT.STATUS: PROBLEM
HOST.DNS: {HOST.DNS}

HOST.HOST:

{HOST.HOST}

HOST.IP:

{HOST.IP}

HOST.NAME:

{HOST.NAME}

ITEM.LASTVALUE:

{ITEM.LASTVALUE}

TRIGGER.NAME:

{TRIGGER.NAME}

TRIGGER.NSEVERITY:

{TRIGGER.NSEVERITY}

TRIGGER.DESCRIPTION:

{TRIGGER.DESCRIPTION}

TRIGGER.URL:

{TRIGGER.URL}

TRIGGER.ID:

{TRIGGER.ID}

TRIGGER.HOSTGROUP.NAME:

{TRIGGER.HOSTGROUP.NAME}

ZABBIX.URL: {$ZABBIX.URL}

---
Same incident but dns buil-in macro put at the end:
{code:java}
1    2024-07-10 01:21:14 PM    zbx_alerting_user
test        PROBLEM : 211
EVENT.DATE: 2024.07.10
EVENT.ACK.STATUS: No
EVENT.ID: 211
EVENT.NAME: Heartbeat
EVENT.NSEVERITY: 2
EVENT.OPDATA: 0
EVENT.TAGS: Heartbeat
EVENT.TAGSJSON: [{"tag":"Heartbeat","value":""}]
EVENT.TIME: 13:21:14
EVENT.STATUS: PROBLEM
HOST.HOST: zabbix server - heartbeat
HOST.IP: 127.0.0.1
HOST.NAME: zabbix server - heartbeat
ITEM.LASTVALUE: 0
TRIGGER.NAME: Hearthbeat
TRIGGER.NSEVERITY: 2
TRIGGER.DESCRIPTION:
TRIGGER.URL:
TRIGGER.ID: 23731
TRIGGER.HOSTGROUP.NAME: zabbix hearthbeat
ZABBIX.URL: https://xxxxx
HOST.DNS: {HOST.DNS}

 

Comment by Linwood Ferguson [ 2024 Jul 28 ]

So on 7.0.1rc1 this appears fixed on external checks, but is not fix on substitution in trigger action messages, where it continues to not only fail but also causes other macros not to be replaced. 

I noticed this was fixed in ZBX-24560  and will attempt to also re-open that bug once I try on rc2 which appears out but does not mention this.

In some brief tests I see no difference in 7.0.2rc2

Comment by user185953 [ 2024 Aug 07 ]

Same on 7.0.2. release, biting me hard.
For most notification this works fine.
But if host has no interface, all macro after {HOST.CONN} are not replaced.

Problem has been resolved at 14:59:59 on 2024.08.07
Problem name: Zabbix proxy: Utilization of poller processes over 75%
Host: Zabbix proxy 1 (internal) (\{HOST.CONN})
Severity: \{EVENT.SEVERITY}
Original problem ID: \{EVENT.ID}
\{TRIGGER.URL}

Please ignore extra backslash. Anyone know how I make {noformat} work and ignore { characters?

Comment by Alexander Vladishev [ 2024 Aug 14 ]

Part of the problem was resolved in version 7.0.1 in scope of ZBX-24560, where macros will resolved to empty values if the corresponding field is not filled.

However, another issue remains – all {HOST.*} macros do not expand if there is no interface. This needs to be fixed.

Comment by Vladislavs Sokurenko [ 2024 Aug 14 ]

Implemented in pull request feature/ZBX-24636-7.0

Comment by Vladislavs Sokurenko [ 2024 Aug 23 ]

Fixed in:

Generated at Wed Jul 30 03:06:55 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.