[ZBX-7878] Don't work macro {ITEM.VALUE2}, {ITEM.VALUE3} in trigger's name Created: 2014 Feb 27  Updated: 2017 Jul 24  Resolved: 2017 Jul 24

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 2.0.11
Fix Version/s: None

Type: Incident report Priority: Major
Reporter: Pavel Zabortsev Assignee: Unassigned
Resolution: Cannot Reproduce Votes: 2
Labels: macros, regression, triggers
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 12.04.4 LTS



 Description   

After upgrade zabbix from 2.0.10 to 2.0.11 I've got some problems with trigger's name, that use more than one values in their expressions.

Trigger example:

{mx01:system_updates[total].last(0)}>0 | {mx01:system_updates[security].last(0)}>0 | {mx01:system_updates[optional].last(0)}>0

Its name:
There are {ITEM.VALUE1} systems updates need to be installed: {ITEM.VALUE2}/{ITEM.VALUE3}

If zabbix 2.0.10 was used I received correct e-mail notification:
mx01: There are 6 systems updates need to be installed: 4/2

But after upgrade to 2.0.11 e-mail notification looks like this:
mx01: There are 6 systems updates need to be installed: UNKNOWN/UNKNOWN

And in frontend I see:
mx01: There are 6 systems updates need to be installed: 0/0

PS. More detailed information is in forum (Russian): https://www.zabbix.com/forum/showthread.php?t=44331



 Comments   
Comment by richlv [ 2014 Mar 16 ]

for the record, seems to work fine in trunk r43430, and 2.0.11 changelog does not seem to have anything suspicious.
do those items have values in history ?

Comment by richlv [ 2014 Mar 16 ]

just to check, history is not set to '0', is it ?
that would be ZBX-7548 then

Comment by Pavel Zabortsev [ 2014 Mar 27 ]

Sorry, but I can't check anything with version 2.0.11: I was forced to return to version 2.0.10, that works correctly.
Sorry again...

Comment by Pavel Zabortsev [ 2014 May 15 ]

Zabbix server 2.0.12 is affected by this error too.

I've carefully read your questions and my apologies that did not respond immediately.
Yes, all of those items have values in history for 30 days.

I can check something more if you need until we'll reverted to version 2.0.10 again.

Comment by Pavel Zabortsev [ 2014 May 30 ]

I think the problem is in parsing of tigger's expression.
There are 3 ITEM.VALUE macros in trigger's expression, all of them match trapper items. A script on some host checks need to update and send 3 values in the same time.
When the first of these values come trigger triggered and didn't wait other values.
In version 2.0.10 triggers triggered when all of values come.
(Sorry for my English ))

Comment by Pavel Zabortsev [ 2014 Jun 02 ]

On Triggers part of frontend the names of triggers looks correct.
Wrong trigger's names appear only on Dashboad and in email notification.
Hope this information helps to locate the error.

Comment by Pavel Zabortsev [ 2014 Aug 28 ]

As I could undestand the problem is in how the server processes history_uint table.
Example from debug mode (take a look to 20475 macro):

    [14] => Array
        (
            [hosts] => Array
                (
                    [0] => Array
                        (
                            [hostid] => 10337
                            [name] => FS03
                        )

                )

            [triggerid] => 19073
            [value_flags] => 0
            [error] => 
            [url] => 
            [expression] => {20475}>0 | {20476}>0 | {20477}>0
            [description] => Требуется установка {ITEM.VALUE1} обновлений системы: {ITEM.VALUE2}/{ITEM.VALUE3}
            [priority] => 2
            [type] => 0
            [lastchange] => 1409202042
[...skip...]
SQL (0.000595): SELECT DISTINCT f.triggerid,f.functionid,i.itemid,i.lastvalue,i.lastclock,i.value_type,i.units,i.valuemapid,m.mappingid,m.newvalue FROM functions f INNER JOIN items i ON f.itemid=i.itemid INNER JOIN hosts h ON i.hostid=h.hostid LEFT JOIN mappings m ON i.valuemapid=m.valuemapid AND i.lastvalue=m.value WHERE f.functionid IN ('20475','20476','20477')
make_latest_issues() -> CEventHelper::expandDescription() -> CTriggerDescription->expand() -> CTriggerDescription->expandDescriptions() -> CTriggerDescription->expandItemMacros() -> DBselect()

SQL (0.000393): SELECT value FROM history_uint WHERE itemid='38603' AND clock='1409202042' AND ns='105456357' LIMIT 1 OFFSET 0
make_latest_issues() -> CEventHelper::expandDescription() -> CTriggerDescription->expand() -> CTriggerDescription->expandDescriptions() -> CTriggerDescription->expandItemMacros() -> CEventDescription->resolveItemValueMacro() -> item_get_history() -> DBselect()

SQL (0.000394): SELECT DISTINCT clock FROM history_uint WHERE itemid='38603' AND clock='1409202042' AND ns<'105456357'
make_latest_issues() -> CEventHelper::expandDescription() -> CTriggerDescription->expand() -> CTriggerDescription->expandDescriptions() -> CTriggerDescription->expandItemMacros() -> CEventDescription->resolveItemValueMacro() -> item_get_history() -> DBselect()

SQL (0.000325): SELECT MAX(clock) AS clock FROM history_uint WHERE itemid='38603' AND clock<'1409202042'
make_latest_issues() -> CEventHelper::expandDescription() -> CTriggerDescription->expand() -> CTriggerDescription->expandDescriptions() -> CTriggerDescription->expandItemMacros() -> CEventDescription->resolveItemValueMacro() -> item_get_history() -> DBselect()

SQL (0.001036): SELECT value FROM history_uint WHERE itemid='38603' AND clock='1409115611' ORDER BY itemid,clock desc,ns desc LIMIT 1 OFFSET 0
make_latest_issues() -> CEventHelper::expandDescription() -> CTriggerDescription->expand() -> CTriggerDescription->expandDescriptions() -> CTriggerDescription->expandItemMacros() -> CEventDescription->resolveItemValueMacro() -> item_get_history() -> DBselect()
[...skip till the end...]

Actual data:

mysql> SELECT DISTINCT f.triggerid,f.functionid,i.itemid,i.lastvalue,i.lastclock,i.value_type,i.units,i.valuemapid,m.mappingid,m.newvalue FROM functions f INNER JOIN items i ON f.itemid=i.itemid INNER JOIN hosts h ON i.hostid=h.hostid LEFT JOIN mappings m ON i.valuemapid=m.valuemapid AND i.lastvalue=m.value WHERE f.functionid IN ('20475','20476','20477');
+-----------+------------+--------+-----------+------------+------------+-------+------------+-----------+----------+
| triggerid | functionid | itemid | lastvalue | lastclock  | value_type | units | valuemapid | mappingid | newvalue |
+-----------+------------+--------+-----------+------------+------------+-------+------------+-----------+----------+
|     19073 |      20475 |  38603 | 1         | 1409202042 |          3 |       |       NULL |      NULL | NULL     |
|     19073 |      20476 |  38600 | 1         | 1409202042 |          3 |       |       NULL |      NULL | NULL     |
|     19073 |      20477 |  38601 | 0         | 1409202042 |          3 |       |       NULL |      NULL | NULL     |
+-----------+------------+--------+-----------+------------+------------+-------+------------+-----------+----------+
3 rows in set (0.00 sec)

mysql> SELECT value FROM history_uint WHERE itemid='38603' AND clock='1409202042' AND ns='105456357' LIMIT 1 OFFSET 0;
Empty set (0.00 sec)

mysql> SELECT DISTINCT clock FROM history_uint WHERE itemid='38603' AND clock='1409202042' AND ns<'105456357';
Empty set (0.01 sec)

mysql> SELECT MAX(clock) AS clock FROM history_uint WHERE itemid='38603' AND clock<'1409202042';
+------------+
| clock      |
+------------+
| 1409115611 |
+------------+
1 row in set (0.00 sec)

mysql> SELECT value FROM history_uint WHERE itemid='38603' AND clock='1409115611' ORDER BY itemid,clock desc,ns desc LIMIT 1 OFFSET 0;
+-------+
| value |
+-------+
|     0 |
+-------+
1 row in set (0.01 sec)

As you can see in table items lastvalues of all three macros are (1, 1, 0). It is correct data.
But in history_uint table value with itemid='38603' is 0. It is NOT correct.

With version 2.0.10 this problem does not appear.

Comment by Pavel Zabortsev [ 2014 Aug 28 ]

It a miracle: I've change ITEM.VALUE macros to ITEM.LASTVALUE, and now all data are displayed correct!

Maybe I don't understand the difference between ITEM.VALUE and ITEM.LASTVALUE macros...

Comment by Pavel Zabortsev [ 2014 Aug 28 ]

I do think that the key is in processing of event by server.
More details are in forum: https://www.zabbix.com/forum/showthread.php?t=44331&page=2

Comment by Glebs Ivanovskis (Inactive) [ 2017 Jul 24 ]

Support for 2.0 is over, please create a new report if the issue is still present in latest versions.

Closing as Cannot Reproduce.

Generated at Sun Jun 07 04:21:33 EEST 2026 using Jira 10.3.18#10030018-sha1:5642e4ad348b6c2a83ebdba689d04763a2393cab.