[ZBXNEXT-702] Compare last "text" value with any other string Created: 2011 Mar 15  Updated: 2024 Apr 10  Resolved: 2020 Jun 04

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: Server (S)
Affects Version/s: 1.8.3, 4.0.4
Fix Version/s: 5.0.0rc1, 5.0 (plan)

Type: New Feature Request Priority: Minor
Reporter: Bernard SCHÜPBACH Assignee: Artjoms Rimdjonoks
Resolution: Fixed Votes: 48
Labels: expressions, newtriggerfunction, trigger
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: Not Specified Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified
Environment:

Zabbix 1.8.3 Server on SLES 10, mySQL DB


Attachments: PNG File not_macro.png     PNG File problem_name.png    
Issue Links:
Causes
causes ZBX-17728 zabbix-server-mysql crashes since 5.0... Closed
causes ZBX-18410 Trigger function strlen #num does not... Closed
causes ZBX-17737 Value mappings does not work for text... Closed
Duplicate
is duplicated by ZBXNEXT-2525 SImple Counters and Comparison Functions Closed
is duplicated by ZBXNEXT-1316 Set Trigger On String Comparison Closed
is duplicated by ZBXNEXT-5835 Preprocessing rule: Numeric hash Closed
is duplicated by ZBX-11369 Last() don't work with char/text Closed
is duplicated by ZBX-11776 Trigger issue when dealing with text Closed
is duplicated by ZBX-17593 How to raise a trigger when 2 string ... Closed
Sub-Tasks:
Key
Summary
Type
Status
Assignee
ZBXNEXT-5763 Frontend changes for ability to compa... Specification change (Sub-task) Closed Alexander Vladishev  
Team: Team C
Sprint: Sprint 61 (Feb 2020), Sprint 62 (Mar 2020), Sprint 63 (Apr 2020), Sprint 64 (May 2020), Sprint 65 (Jun 2020)
Story Points: 2

 Description   

http://www.zabbix.com/forum/showthread.php?p=81507

I want to be able to compare text value (containing space, slash, colon) with earlier value, not previous. somthing like:
(last(#1) equal to last(#2)) but not equal to last(#3).
My expression is :

({host:list_partition[].last(#1)}={host:list_partition[].last(#2)})&({host:list_partition[].last(#1)}#{host:list_partition[].last(#3)})

But I have the following error in my server log:
Format error or unsupported operator. Exp: [C: F:]
Expression [(C: F: =C: F: )&(C: F: #C: F: )] cannot be evaluated: Format error or unsupported operator. Exp: [C: F:]

How can I do this compare ?



 Comments   
Comment by Oleksii Zagorskyi [ 2011 Mar 27 ]

Just a note: "1) All functions return numeric values only. Comparison to strings is not supported, for example."
http://www.zabbix.com/documentation/1.8/manual/config/triggers#trigger_functions

Comment by Pascal Uhlmann [ 2014 Jun 05 ]

Comparing two string items is very important. So I hope this feature will be added soon.

Comment by Alexei Vladishev [ 2014 Sep 26 ]

See also ZBXNEXT-1316

Comment by tagwolf [ 2014 Dec 10 ]

I know you guys probably look at number of requests for a feature.

In this instance, I ask that you please don't do that, but instead look at what having this ability, and the abilities in ZBXNEXT-2527 would give the user.

We basically wouldn't need to utilize userparameters and scripts anymore for a large percentage of the checks and triggers that we do today.

Thank you for your time!

Comment by Robin Roevens [ 2015 Apr 27 ]

A suggestion to implement this request is to add the ability to functions like change and abschange to not only compare between last and previous values, but also between other values:
The example

({host:list_partition[].last(#1)}={host:list_partition[].last(#2)})&({host:list_partition[].last(#1)}#{host:list_partition[].last(#3)})

could then be implemented as such where .change compares between last value and the given most recent value:

({host:list_partition[].change(#2)}=0&({host:list_partition[].change(#3)}=1

Extending this even more to comparing any value to any value by supporting 2 parameters:

({host:list_partition[].change(#3,#5)}=0&({host:list_partition[].change(#4,#6)}=1

which would compare the 3th against the 5th value and the 4th against the 6th value. (not sure what use case it would have in this example, but for flexibility I think it is best to consider this also)

This method of-course is not so flexible that it could be used for ZBXNEXT-1316.. But maybe it is easier to implement on a short term as it still honours all current trigger expression rules and limitations. It would make zabbix that bit more powerful without needing big changes to the trigger evaluator..

Comment by richlv [ 2015 Nov 02 ]

(1) it would be also useful to specify how the comparison of greater/less than works - enabling version comparison, for example. see "sort -V" :

$ echo -e "11.2\n2.11" | sort
11.2
2.11
$ echo -e "11.2\n2.11" | sort -V
2.11
11.2

otherwise comparing software versions would be unreliable

glebs.ivanovskis Slightly better illustration:

$ echo -e "1.9\n2.2\n2.10" | sort
1.9
2.10
2.2
$ echo -e "1.9\n2.2\n2.10" | sort -r
2.2
2.10
1.9
$ echo -e "1.9\n2.2\n2.10" | sort -V
1.9
2.2
2.10
$ echo -e "1.9\n2.2\n2.10" | sort -V -r
2.10
2.2
1.9
Comment by Johannes T. [ 2016 Sep 21 ]
  • Upon comparison of ZBXNEXT-1314 with this one and its comments I want to highlight that ZBXNEXT-1314 explicitly asked for the ability to compare strings from different hosts.
    •  {host:item_name.last(0)} != {another_host:item_name.last(0)} 
  • I just ran into this issue as well and would appreciate such a function very much.
Comment by Brian Smyk [ 2016 Oct 28 ]

I vote for this issue. I need to be able to compare the last 3 values of a text item to ensure they match.

Comment by Sean Nienaber [ 2017 Feb 06 ]

I would also like to see this feature please.

Comment by Shane Arnold [ 2018 Mar 27 ]

Adding my vote, would also help address the feature request I just added (ZBXNEXT-4449).

Comment by richlv [ 2018 Jun 27 ]

Johannes, the issue you referenced is titled "Capability to rotate the labels" - you probably intended to link to a different issue.

Comment by Ian Kelly [ 2018 Sep 11 ]

Just wanted to add my support for this. 

I'm trying to compare strings from system.localtime<local> which returns strings, whereas UTC returns a number. 

I've got a regex to get just the timezone info eg +01:00 

I'd like to create a trigger that goes off if the value returned differs from a reference comparison value, in the same trigger something like. 

{Template Timezone CET Check:system.localtime[local].str == {ALT_HOST:system.localtime[local].str}

this is not a sync check, but to ensure servers in the various templates are on the correct TZ. 

But the ability to compare strings would seem like a HUGE advantage. 

Please consider seriously this feature request. 

 

Thanks

Comment by Justin Addams [ 2019 Jan 30 ]

As per Forum Post this feature would be greatly appreciated, I've added my vote

Comment by Alexei Vladishev [ 2020 Jan 24 ]

Thanks for your votes. We already started initial research, if everything goes fine this functionality has all chances to be included into Zabbix 5.0. Finally!

Comment by Héctor Sánchez [ 2020 Mar 25 ]

I would like this feature also (ZBXNEXT-5835), thanks!!!!

Comment by Artjoms Rimdjonoks [ 2020 Apr 17 ]

Available in versions:

Comment by dimir [ 2020 Apr 20 ]

Could not quickly make it out of the spec, do I understand it correctly that this task is limited to single item, i. e. I will not be able to compare the strings returned by different items, e. g.:

{host:foo.last()} = {host:bar.last()}

?
<arimdjonoks> You should be able to compare different items - what is the problem?

<dimir> OK, will update ticket title then, it's misleading to users.

Generated at Sat Apr 27 01:37:34 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.