[ZBX-3423] value mapping not performed for {ITEM.VALUE} inside trigger names Created: 2011 Jan 14  Updated: 2017 May 30  Resolved: 2012 Jun 19

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 1.8.3, 1.8.4, 1.8.10, 1.9.9 (beta)
Fix Version/s: 1.8.14rc1, 2.0.1, 2.1.0

Type: Incident report Priority: Major
Reporter: Dmitrij Gavrilenko Assignee: Unassigned
Resolution: Fixed Votes: 1
Labels: macros, valuemapping
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Zabbix 1.8.4
PHP 5.3.2
Mysql Server 5.1.48
FreeBSD 8.1-RELEASE x64


Attachments: File 2011.01.13 ValueMapping - ConfigVM.JPG     File 2011.01.13 ValueMapping - Email.JPG     File 2011.01.13 ValueMapping - Events.JPG     File 2011.01.13 ValueMapping - ItemConfig.JPG     File 2011.01.13 ValueMapping - LastValue.JPG     File 2011.01.13 ValueMapping - TriggerConfig.JPG    
Issue Links:
Duplicate
is duplicated by ZBX-4918 Value mapping not works on dashboard Closed

 Description   

Problem similar to that described by me in ZBX-2250, only with the macro {ITEM.VALUE}
The problem lies in the fact that the function does not work when using a macro ValueMapped {ITEM.VALUE} in the description of the trigger.
For the macro {ITEM.LASTVALUE}, at least in the menu Monitoring -> Events and Monitoring -> Triggers, data are substituted correctly.

For the macro {ITEM.VALUE} data correctly substituted for notification via e-mail.
At the same time in Monitoring -> Events and Monitoring -> Triggers using ValueMapped, the data is displayed without any conversion.
----------------------------------------------
???????? ??????????? ????????? ???? ? ZBX-2250, ?????? ? ???????? {ITEM.VALUE}
???? ???????? ??????????? ? ???, ??? ?? ??????????? ??????? ValueMapped ??? ????????????? ??????? {ITEM.VALUE} ? ???????? ????????.
??? ??????? {ITEM.LASTVALUE} , ?? ??????? ???? ? ???? Monitoring -> Events ? Monitoring -> Triggers, ?????? ????????????? ?????????.

??? ??????? {ITEM.VALUE} ?????? ????????? ????????????? ??? ??????????? ?? ??????????? ?????.
? ???? ????? ? Monitoring -> Events ? Monitoring -> Triggers ??? ????????????? ValueMapped, ?????? ???????????? ??? ??????????????.



 Comments   
Comment by José Roberto Prado [ 2011 May 11 ]

I suffer with this problem. I do not use {ITEM.LASTVALUE} lose because the historical of events, which is only possible with {ITEM.VALUE}. Can anything be done to bypass this problem? Any predictions to fix?

Zabbix Version 1.8.4

Comment by Dmitrij Gavrilenko [ 2011 Jun 01 ]

Для решения данной проблемы выполнил модификацию файла zabbix-1.8.5/frontends/php/include/triggers.inc.php в строках 1633-1639

строки:

                      $macro = '{ITEM.VALUE'.($i ? $i : '').'}';
                      if(zbx_strstr($description, $macro)){
                              $value=($flag==ZBX_FLAG_TRIGGER)?
                                              trigger_get_func_value($row['expression'],ZBX_FLAG_TRIGGER,$i ? $i : 1, 1):
                                              trigger_get_func_value($row['expression'],ZBX_FLAG_EVENT,$i ? $i : 1, $row['clock']);

                              $description = str_replace($macro, $value, $description);
                      }

заменил на:

                      $macro = '{ITEM.VALUE'.($i ? $i : '').'}';
                      if(zbx_strstr($description, $macro)){
                                        $value=($flag==ZBX_FLAG_TRIGGER)?
                                                trigger_get_func_value($row['expression'],ZBX_FLAG_TRIGGER,$i ? $i : 1, 1):
                                                trigger_get_func_value($row['expression'],ZBX_FLAG_EVENT,$i ? $i : 1, $row['clock'])
//                                      $description = str_replace($macro, $value, $description);

                                        $functionid = trigger_get_N_functionid($row['expression'], $i ? $i : 1);
                                        if(isset($functionid)){
                                                $sql = 'SELECT i.lastvalue, i.value_type, i.itemid, i.valuemapid, i.units '.
                                                                ' FROM items i, functions f '.
                                                                ' WHERE i.itemid=f.itemid '.
                                                                        ' AND f.functionid='.$functionid;
                                                $row2=DBfetch(DBselect($sql));
                                                $row2['lastvalue'] = $value;
                                                $description = str_replace($macro, format_lastvalue($row2), $description);
                                        }
                      }

Сдела некий симбиоз обработки маппирования для макросов {ITEM.VALUE} и {ITEM.LASTVALUE}
В принципе, маппирование работает, но за корректность модификации 100% гарантию дать не могу. Используйте на свой страх и риск!!!

Comment by José Roberto Prado [ 2011 Jun 06 ]

Thank you. It worked very well in both the 1.8.3 and the 1.8.5 version.

Just an observation: with the change I noticed that the text of trigger were shortened. But this is no problem for me.

Comment by Alexander Vladishev [ 2012 Jun 19 ]

Fixed with ZBX-4918 in pre-1.8.14rc1 r27509, pre-2.0.1rc1 r27697, pre-2.1.0 (beta) r27698.

Generated at Thu Apr 25 12:39:46 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.