ZABBIX BUGS AND ISSUES

Host macro inside map label trigger expression macro

Details

  • Zabbix ID:
    RTF

Description

- trigger elements should support {HOST.HOST1-9} macros inside item value referencing macros
- host elements should support {HOST.HOST} macros inside item value referencing macros

In case of macro like "{{HOST.HOST}:log[{HOST.HOST}.log].last(0)}" only first {HOST.HOST} macro should be resolved.

Issue Links

Activity

Hide
Alexei Vladishev added a comment - - edited

All macros must be resolved just by one pass. If a macro value contains another macro, the value should stay as it is. There are some exceptions, for example, if {TRIGGER.NAME} value has some macros, the macros must be expanded before processing of {TRIGGER.NAME}.

<Toms> Looks like {TRIGGER.NAME} should be only expanded in notifications and commands according to documentation.

Show
Alexei Vladishev added a comment - - edited All macros must be resolved just by one pass. If a macro value contains another macro, the value should stay as it is. There are some exceptions, for example, if {TRIGGER.NAME} value has some macros, the macros must be expanded before processing of {TRIGGER.NAME}. <Toms> Looks like {TRIGGER.NAME} should be only expanded in notifications and commands according to documentation.
Hide
Toms added a comment - - edited

(1) There is problem in trigger name macros {HOST.NAME1} resolving in Monitoring->Triggers, if trigger expression has same function more than once.

<Toms> CLOSED. Created https://support.zabbix.com/browse/ZBX-5608.

Show
Toms added a comment - - edited (1) There is problem in trigger name macros {HOST.NAME1} resolving in Monitoring->Triggers, if trigger expression has same function more than once. <Toms> CLOSED. Created https://support.zabbix.com/browse/ZBX-5608.
Hide
Toms added a comment - - edited

(2) When resolving {HOST.DNS} (as well others) macros in Maps for host item, default selection is not taken into account.

<Toms> RESOLVED in r30319

Alexey Fukalov CLOSED

Show
Toms added a comment - - edited (2) When resolving {HOST.DNS} (as well others) macros in Maps for host item, default selection is not taken into account. <Toms> RESOLVED in r30319 Alexey Fukalov CLOSED
Hide
Toms added a comment -

Fixed in dev. branch: svn://svn.zabbix.com/branches/dev/ZBX-4187 r30317

Show
Toms added a comment - Fixed in dev. branch: svn://svn.zabbix.com/branches/dev/ZBX-4187 r30317
Hide
Toms added a comment - - edited

(3) There was a problem with HOST.DNS priorities when only JMX and IPMI interfaces are used in host

<Toms> RESOLVED in r30323

Alexey Fukalov CLOSED

Show
Toms added a comment - - edited (3) There was a problem with HOST.DNS priorities when only JMX and IPMI interfaces are used in host <Toms> RESOLVED in r30323 Alexey Fukalov CLOSED
Hide
Alexey Fukalov added a comment - - edited

(4)

  • open a map with trigger element
  • change trigger for that element
  • save map.

Image reload failed.

Toms RESOLVED in r30409

Alexey Fukalov CLOSED

Show
Alexey Fukalov added a comment - - edited (4)
  • open a map with trigger element
  • change trigger for that element
  • save map.
Image reload failed. Toms RESOLVED in r30409 Alexey Fukalov CLOSED
Hide
Alexey Fukalov added a comment - - edited

(5)
Not sure if {HOST.HOST1} macro should be supported for hosts.

Toms RESOLVED in r30410

Alexey Fukalov CLOSED

Show
Alexey Fukalov added a comment - - edited (5) Not sure if {HOST.HOST1} macro should be supported for hosts. Toms RESOLVED in r30410 Alexey Fukalov CLOSED
Hide
Alexey Fukalov added a comment - - edited

(6)
Maybe not directly related to this issue.
Why newly created item without values show 0 for macro like {{HOST.HOST}:log[{HOST.HOST}.log].last(0)} ?

Toms RESOLVED in r30413

Alexey Fukalov CLOSED

Show
Alexey Fukalov added a comment - - edited (6) Maybe not directly related to this issue. Why newly created item without values show 0 for macro like {{HOST.HOST}:log[{HOST.HOST}.log].last(0)} ? Toms RESOLVED in r30413 Alexey Fukalov CLOSED
Hide
Alexey Fukalov added a comment - - edited

(7)
comment

// get host host if element is host

doesn't seem correct

Toms RESOLVED in r30413

Alexey Fukalov CLOSED

Show
Alexey Fukalov added a comment - - edited (7) comment
// get host host if element is host
doesn't seem correct Toms RESOLVED in r30413 Alexey Fukalov CLOSED
Hide
Alexey Fukalov added a comment - - edited

(8)
Why array_key_exists instead of isset there?

// allowed item types for min, max and avg function
			$history_table = array(
				ITEM_VALUE_TYPE_FLOAT => 'history',
				ITEM_VALUE_TYPE_UINT64 => 'history_uint'
			);
			if (!array_key_exists($item['value_type'], $history_table)) {

Toms RESOLVED in r30413

Alexey Fukalov CLOSED

Show
Alexey Fukalov added a comment - - edited (8) Why array_key_exists instead of isset there?
// allowed item types for min, max and avg function
			$history_table = array(
				ITEM_VALUE_TYPE_FLOAT => 'history',
				ITEM_VALUE_TYPE_UINT64 => 'history_uint'
			);
			if (!array_key_exists($item['value_type'], $history_table)) {
Toms RESOLVED in r30413 Alexey Fukalov CLOSED
Hide
Alexey Fukalov added a comment - - edited

(9)

$macro = preg_replace('/{({HOSTNAME'.$i.'}|{HOST.HOST'.$i.'}):(.*)}/Uu', '{'.$host['host'].':$2}', $macro);

regexp 'u' modifier seems not needed here.

Toms RESOLVED in r30413

Alexey Fukalov CLOSED

Show
Alexey Fukalov added a comment - - edited (9)
$macro = preg_replace('/{({HOSTNAME'.$i.'}|{HOST.HOST'.$i.'}):(.*)}/Uu', '{'.$host['host'].':$2}', $macro);
regexp 'u' modifier seems not needed here. Toms RESOLVED in r30413 Alexey Fukalov CLOSED
Hide
Alexey Fukalov added a comment - - edited

(10)

$res = DBselect('SELECT hi.ip,hi.dns,hi.useip,h.host,h.name,f.functionid,hi.type AS interfacetype' .
					' FROM interface hi,items i,functions f,hosts h'.
					' WHERE h.hostid=hi.hostid'.
						' AND hi.hostid=i.hostid'.
						' AND i.itemid=f.itemid'.
						' AND hi.main=1 AND f.triggerid='.$selement['elementid']);

			// process interface priorities, build $hostsByFunctionId array
			$tmpFunctionId = -1;
			while ($dbHost = DBfetch($res)) {
				if ($dbHost['functionid'] != $tmpFunctionId) {
					$tmpPriority = 0;
					$tmpFunctionId = $dbHost['functionid'];
				}
				if  ($priorities[$dbHost['interfacetype']] > $tmpPriority) {
					$hostsByFunctionId[$dbHost['functionid']] = $dbHost;
					$tmpPriority = $priorities[$dbHost['interfacetype']];
				}
			}

I think this code can return incorrect results in case we have trigger with 2 hosts and many interfaces. Select can return functions mixed in order from different hosts.

Toms RESOLVED in r30418.

Alexey Fukalov CLOSED

Show
Alexey Fukalov added a comment - - edited (10)
$res = DBselect('SELECT hi.ip,hi.dns,hi.useip,h.host,h.name,f.functionid,hi.type AS interfacetype' .
					' FROM interface hi,items i,functions f,hosts h'.
					' WHERE h.hostid=hi.hostid'.
						' AND hi.hostid=i.hostid'.
						' AND i.itemid=f.itemid'.
						' AND hi.main=1 AND f.triggerid='.$selement['elementid']);

			// process interface priorities, build $hostsByFunctionId array
			$tmpFunctionId = -1;
			while ($dbHost = DBfetch($res)) {
				if ($dbHost['functionid'] != $tmpFunctionId) {
					$tmpPriority = 0;
					$tmpFunctionId = $dbHost['functionid'];
				}
				if  ($priorities[$dbHost['interfacetype']] > $tmpPriority) {
					$hostsByFunctionId[$dbHost['functionid']] = $dbHost;
					$tmpPriority = $priorities[$dbHost['interfacetype']];
				}
			}
I think this code can return incorrect results in case we have trigger with 2 hosts and many interfaces. Select can return functions mixed in order from different hosts. Toms RESOLVED in r30418. Alexey Fukalov CLOSED
Hide
Toms added a comment -

Fixed in 2.0.4rc1 r30616, 2.1.0 r30617

Show
Toms added a comment - Fixed in 2.0.4rc1 r30616, 2.1.0 r30617
Hide
Alexey Fukalov added a comment - - edited

(11)
If map has trigger element, error is shown.
Undefined index elementExpressionTrigger

Alexey Fukalov cannot reproduce, probably some bug with my setup. CLSOED

Show
Alexey Fukalov added a comment - - edited (11) If map has trigger element, error is shown. Undefined index elementExpressionTrigger Alexey Fukalov cannot reproduce, probably some bug with my setup. CLSOED

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: