[ZBX-7137] Interface macros are not resolved on the host inventory page Created: 2013 Oct 11  Updated: 2017 May 30  Resolved: 2013 Oct 28

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

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


 Description   

If the IP, DNS or port fields of a host interface contain macros, they are not resolved in the host inventory page. They must be.



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

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

Comment by Ivo Kurzemnieks [ 2013 Oct 18 ]

(1) "port" field is not resolved

Eduards RESOLVED r.39415

jelisejev CLOSED.

Comment by Ivo Kurzemnieks [ 2013 Oct 18 ]

(2) if a macros like

{HOST.IP}

or

{HOST.DNS}

are entered in default interface, they should stay unresolved instead of *UNKNOWN*

Eduards RESOLVED r.39476,39480

jelisejev CLOSED.

Comment by Pavels Jelisejevs (Inactive) [ 2013 Oct 25 ]

(3) hostinterfaces.php:

	if ($data['host']['interfaces']) {
		$data['host']['interfaces'] = CMacrosResolverHelper::resolveHostInterfaces($data['host']['interfaces']);
	}

No need for an if here, the host will always have at least one interface.

Eduards RESOLVED r.39570

jelisejev CLOSED.

Comment by Pavels Jelisejevs (Inactive) [ 2013 Oct 25 ]

(4) In CMacrosResolver.php:226

if ($this->findMacros(self::PATTERN_HOST, array($macros[$hostId][$interfaceMacro]))
	|| $this->findMacros(ZBX_PREG_EXPRESSION_USER_MACROS, array($macros[$hostId][$interfaceMacro]))) {
	
	// attention recursion!
	$macrosInMacros = $this->resolveTexts(array($hostId => array($macros[$hostId][$interfaceMacro])));
	$macros[$hostId][$interfaceMacro] = $macrosInMacros[$hostId][0];
}

This code shouldn't be repeated for each interface, it's enough to run it once for the main agent interface.

Eduards RESOLVED r.39580

jelisejev Main interfaces should be retrieved and resolved for all hosts with macros at once.
Eduards This place can be optimized for interface data from multiple hosts. But for this moment this is not used. Decided not fix at now.

jelisejev CLOSED.

Comment by Pavels Jelisejevs (Inactive) [ 2013 Oct 25 ]

(5) In CMacrosResolver.php:

  • line 110: &$interface must be unset right after the foreach loop that declared it.
  • please don't use $n++ in array keys, it's hard to read.

Eduards RESOLVED r.39580

jelisejev CLOSED.

Comment by Pavels Jelisejevs (Inactive) [ 2013 Oct 25 ]

(6) I've made a minor change in r39588: switched places the JMX and IPMI interfaces, so that they would match the order on the host configuration page.

Eduards CLOSED

Comment by Pavels Jelisejevs (Inactive) [ 2013 Oct 28 ]

TESTED.

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

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

Generated at Fri Apr 26 12:33:54 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.