[ZBX-16018] Context based macro - text is seen as logical OR function Created: 2019 Apr 17 Updated: 2024 Apr 10 Resolved: 2019 May 18 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Documentation (D), Frontend (F) |
Affects Version/s: | 4.0.6 |
Fix Version/s: | 4.0.8rc1, 4.2.2rc1, 4.4.0alpha1, 4.4 (plan) |
Type: | Problem report | Priority: | Minor |
Reporter: | Twan K. | Assignee: | Andrejs Verza |
Resolution: | Fixed | Votes: | 0 |
Labels: | expressions, macro, macrocontext, trigger | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
Redhat VM |
Attachments: |
![]() ![]() ![]() |
Team: | |
Sprint: | Sprint 52 (May 2019) |
Story Points: | 1 |
Description |
Scenario: Discovering temperature sensors on a Cisco switch using SNMP. I want to use context based macro's so that i can set a different temperature limit for all sensors. However with the discovered values (Temperature sensor names) i get some odd results. Trigger prototype configuration temperature.entity"{#SENSOR_NAME}".last() > {$MAX_TEMP:"{#SENSOR_NAME}"} Discovered names This all works great in the template expression constructor. However when i run the discovery rule i get the following values for {#SENSOR_NAME} back: Switch 1 - WS-C3850-48T - Temp inlet Sensor 0 The discovered triggers looks like this: temperature.entity["Switch 1 - WS-C3850-48T - Temp inlet Sensor 0"].last() > {$MAX_TEMP:"Switch 1 - WS-C3850-48T - Temp inlet Sensor 0"} However the expression constructor shows why the trigger is failing. It seems like the last 2 letters of the word "sensor" are being treated as a logical OR. The formal stuff: Steps to reproduce:
Result:
Expected:
It this behavior intentional, am i formatting the expression wrong, it there a workaround (other than using the SNMPINDEX in the key and context macro) or am i dealing with a bug here? Thanks in advance. |
Comments |
Comment by Twan K. [ 2019 Apr 17 ] |
Initially i created this bug report under the "new features" project. I've closed that one and made a new one in the correct project. |
Comment by Edgar Akhmetshin [ 2019 Apr 18 ] |
Hello Twan, Thank you for reporting the issue. Looks like an error with parsing, i'm able to reproduce: Confirmed. Regards, |
Comment by Edgar Akhmetshin [ 2019 Apr 18 ] |
However, the documentation states the restriction - the following characters are allowed in the macro names: A-Z, 0-9, ,. Macro context is specified using rules similar to item key parameters: 0-9a-zA-Z-. Is it possible to get the name of the sensor in a short way regarding this rules? Regards, |
Comment by Twan K. [ 2019 Apr 18 ] |
Hi Edgar, Yes i can also use the SNMPINDEX value in the macro. This isn't pretty but will work for sure. Thanks for the troubleshooting thus far.
|
Comment by richlv [ 2019 Apr 18 ] |
The quoted line does not appear in the documentation page, it was likely merged from the macro and item pages. |
Comment by Glebs Ivanovskis [ 2019 Apr 18 ] |
Where is it said that item key parameters have this restriction? When quoted, macro context can contain any Unicode characters except double quotes, which should be escaped. |
Comment by Glebs Ivanovskis [ 2019 Apr 18 ] |
Actually, this is a 100% Frontend issue, Server will process the expression correctly. Please fix the Components. As a workaround - simply stop using trigger expression wizard. |
Comment by Edgar Akhmetshin [ 2019 Apr 18 ] |
Glebs, It's not clear from the documentation which part from the item key description page will used for the context macro and or characters from macro context are recognized as logical OR. Regards, |
Comment by Glebs Ivanovskis [ 2019 Apr 18 ] |
I disagree, documentation says:
Perhaps, "parameters" should be part of the link text and the link itself should point to https://www.zabbix.com/documentation/current/manual/config/items/item/key#key_parameters to be less ambiguous. |
Comment by Twan K. [ 2019 Apr 19 ] |
After some more testing i can confirm that its a frontend bug, not server / database related. The configuration with a custom macro it seems to be working perfectly in the background |
Comment by Andrejs Verza [ 2019 May 10 ] |
Resolved in development branch feature/ZBX-16018-4.0. |
Comment by Andrejs Verza [ 2019 May 15 ] |
Fixed in:
|