[ZBX-7212] Host interface macros are resolved incorrectly in script confirmations Created: 2013 Oct 25  Updated: 2017 May 30  Resolved: 2013 Oct 29

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 2.1.9
Fix Version/s: 2.1.9

Type: Incident report Priority: Minor
Reporter: Pavels Jelisejevs (Inactive) Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: hostinterfaces, macros, scripts
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Host interface priorities are not taken into account when resolving interface-related macros. Here's how you can reproduce the problem:
1. Create a script that uses a

{HOST.IP}

macro in its confirmation text.
2. Create a host with a JMX interface.
3. Save the host.
4. Add a SNMP interface to that host.
5. Execute the script.
The confirmation text will contain the IP of the JMX interface, even, thought the SNMP interface has a higher priority.

The problem is caused by the following code in CMacrosResolver.php:240:

$dbInterfaces = DBselect(
'SELECT i.hostid,i.ip,i.dns,i.useip,i.type'.
' FROM interface i'.
' WHERE i.main='.INTERFACE_PRIMARY.
' AND '.dbConditionInt('i.hostid', $hostIds).
' AND '.dbConditionInt('i.type', $this->interfacePriorities)
);

Not only doesn't it sort interfaces by priority, but it tries to filter interface types using priority values.

I suggest to fix this problem after ZBX-7137 is finished.



 Comments   
Comment by Eduards Samersovs (Inactive) [ 2013 Oct 29 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-7212

Comment by Ivo Kurzemnieks [ 2013 Oct 31 ]

TESTED

Comment by Eduards Samersovs (Inactive) [ 2013 Oct 31 ]

Fixed in versions pre-2.1.9 (trunk) r.39707

Generated at Fri Apr 26 22:29:29 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.