[ZBXNEXT-2788] Use of NOT keyword in Custom expression fields (Z4) Created: 2015 Apr 20  Updated: 2024 Apr 10  Resolved: 2018 May 03

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: Frontend (F), Server (S)
Affects Version/s: None
Fix Version/s: 4.0.0alpha6, 4.0 (plan)

Type: Change Request Priority: Trivial
Reporter: Filipp Sudanov (Inactive) Assignee: Sergejs Paskevics
Resolution: Fixed Votes: 10
Labels: expressions, globalregexps, lld
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: Not Specified Time Spent: Not Specified
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Attachments: PNG File lld_filter.png    
Issue Links:
Duplicate
is duplicated by ZBXNEXT-3939 Support negation in custom expression... Closed
Sub-task
Sub-Tasks:
Key
Summary
Type
Status
Assignee
ZBXNEXT-4451 Front end changes for use of NOT keyw... Specification change (Sub-task) Closed Ivo Kurzemnieks  
Team: Team C
Sprint: Sprint 26, Sprint 27, Sprint 28, Sprint 29, Sprint 30, Sprint 31, Sprint 32, Sprint 33
Story Points: 2

 Description   

In several places, e.g. in LLD filter Zabbix supports "Custom expression". Currently it supports or and and keywords.

It would give a lot flexibility, if not keyword would be supported there. E.g. for LLD this would allow to define which file systems not to include into the discovery without using global regexps.



 Comments   
Comment by Oleksii Zagorskyi [ 2015 Apr 21 ]

The request sounds a bit illogical.

If we compare with actions - there "IS NOT" used to compare a variable and its value, but not to estimate logical expression.

In lld discovery it's the same - "IS NOT" could be used in regexp (global one or directly in the rule filters) but not in logical expression.

Problem is that server (Posix ERE) doesn't support negation in regexp, that's why the only way to use global regexps with FALSE condition.
So it leads to ZBX-3924

I don't think this feature could be implemented as requested.

Comment by Iskra Zabbix [ 2015 Apr 21 ]

IMHO, custom expression support is incomplete without not keyword (AFAIR, in boolean algebra there is no way to express not with only and and or operators).

Yes, there is "not like" for received value in actions, but there is not "is not" in LLD filter (unlike global regexps, see screenshot). So, there is no way not filter out some bad values in LLD discovery (my real-life use-case).

Why do you relate this ticket to regexps handling? It is about custom logical expressions handling

Comment by Oleksii Zagorskyi [ 2015 Apr 21 ]

Actually used global regexp it's possible to filter out bad values.
Issue description asks to do that without global regexps usage.

If could be possible to implement the feature by replacing "matches" word by a drop-down with options: 'matches, doesn't match':

But I'm not sure it's strongly required to do as it's possible to get the same results now using global regexps.

Comment by Iskra Zabbix [ 2015 Apr 21 ]

So you suggest to use global regexps to filter out bad values from every LLD discovery rule of every template? Sure, it is possible right now, but it is bad "solution". IMHO, all settings for LLD rule filter, related to template, must be attached on template itself, without global settings, otherwise template will not be self-contained (export template / import template in other installations will not work).

Sure, implementing logical not by replacing "matches" to "not matches" is one of options (but ZBX-3924 must be fixed first). Other option - implement logical not just like or and and in logical expression handler.

Comment by Ilya Kruchinin [ 2016 Jul 29 ]

Agree with Iskra Zabbix.

Referencing global regular expressions for negated regex is not enough.

LLD discovery rules should either have a "NOT" logic added to current "AND & OR", or, alternatively, a "not matches" switch to complement the current "matches" implementation.

Comment by Kevin Doren [ 2017 Mar 08 ]

Iskra and Ilya are both correct, you really need a NOT operator for custom expressions (and/or "not matches'). Global regexps don't export with the template and require manual editing, so they're not a good substitute.

Comment by Chris Gleason [ 2017 Sep 06 ]

I second this. I find that I could regularly use a NOT operator in the discovery filters.

Though I would be fine with a drop down too.

Comment by Pascal Uhlmann [ 2017 Nov 28 ]

I'd also like to have the NOT operator available. Sometimes you do not exactly know each possible value for a LLD macro but some to filter out. So there is no alternative to negate the match within the filters.

Comment by Natalja Romancaka [ 2018 Apr 21 ]

(5) [D] need to add 'not' option in Custom expression description
https://www.zabbix.com/documentation/4.0/manual/config/event_correlation/global
https://www.zabbix.com/documentation/4.0/manual/config/notifications/action/conditions

natalja.cernohajeva: RESOLVED

s.paskevics CLOSED

Comment by Sergejs Paskevics [ 2018 Apr 21 ]

Implemented in pre-4.0.0alpha6 (trunk) in r80012

Comment by Ivo Kurzemnieks [ 2018 Apr 21 ]

(6) [D] API documentation updated:

sasha

added support for not operator in custom expression filter formula and value 9 in the filter condition operator.

Information about affected places should be mentioned (lld rule custom expression and conditions, action conditions custom expression, correlation rule conditions custom espression)

REOPENED

s.paskevics Do you mean about documentation manual or API call documentation?

iivs Corrected information in https://www.zabbix.com/documentation/4.0/manual/api/changes_3.4_-_4.0

RESOLVED

sasha Thanks! CLOSED

Comment by richlv [ 2018 Jul 19 ]

(7) The changelog entry says added support "NOT" keyword in custom expression fields - looks like "for" is missing there to make a sentence.

iivs Looks like you're right. Resolved in r82873 and
CLOSED

Generated at Fri Apr 26 07:00:08 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.