[ZBXNEXT-1250] count() filter by regexp Created: 2012 Jun 04  Updated: 2016 May 23  Resolved: 2016 May 06

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: API (A), Server (S)
Affects Version/s: None
Fix Version/s: 3.2.0alpha1

Type: Change Request Priority: Minor
Reporter: richlv Assignee: Unassigned
Resolution: Fixed Votes: 12
Labels: calculateditems, patch, triggerfunctions, triggers
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File zabbix-2.2.2-evalfunc_count_regexp.patch    
Issue Links:
Duplicate
is duplicated by ZBXNEXT-797 Add 'not like' operator to 'count' tr... Closed
is duplicated by ZBXNEXT-1379 count like parameter to support regex Closed
is duplicated by ZBXNEXT-2287 Add regexp operator for count function Closed

 Description   

currently trigger function count() accepts a pattern as the second param, but it can be at most searched as "like".
would be nice to specify a regexp there (directly, and a global one)

that would include both trigger expressions and calculated item formulas



 Comments   
Comment by Michael Kolomiets [ 2014 Apr 08 ]

I made change for regexp in count function. Used it for three month without any troubles.

Comment by Ivo Kurzemnieks [ 2016 Apr 13 ]

(1) No translation string changes.

gunarspujats CLOSED

Comment by Ivo Kurzemnieks [ 2016 Apr 13 ]

Frontent part RESOLVED in svn://svn.zabbix.com/branches/dev/ZBXNEXT-1250 r59428

Comment by Aleksandrs Saveljevs [ 2016 Apr 13 ]

Server side ready for testing in the same branch, too.

Comment by Glebs Ivanovskis (Inactive) [ 2016 Apr 22 ]

(2) Updated to the latest trunk and resolved conflicts caused by ZBX-10658 and ZBX-10674 bugfixes. Please review r59586.

asaveljevs CLOSED

Comment by Glebs Ivanovskis (Inactive) [ 2016 Apr 22 ]

(3) Nowadays we have a great opportunity to show detailed function evaluation error messages in the frontend. Let's use it!

Unfortunately, there is currently no way of distinguishing invalid non-global regular expression in second parameter and the case when no values match valid regexp. Troubleshooting will be somewhat inconvenient.

RESOLVED in r59634.

glebs.ivanovskis This solution was incorrect. Fixed in r59698. Still RESOLVED

asaveljevs Please see a bit of stylistic suggestions in r59766. Still RESOLVED.

glebs.ivanovskis Thank you very much! CLOSED

Comment by Glebs Ivanovskis (Inactive) [ 2016 Apr 22 ]

It's probably worth reviving ZBX-8410 to provide decent error messages in case of invalid regular expressions. As far as I can tell it addresses performance issues too.

Actually, ZBXNEXT-1638 addresses similar issues, we just need to sync the changes, therefore...
(4) Provide a frontend error message in case of invalid regular expression.

glebs.ivanovskis RESOLVED in r59698 and r59699.

asaveljevs The following definitions should be renamed, so that naming conflicts are less likely:

#define NO_MATCH	0
#define MATCH		1

asaveljevs Function regexp_match_ex_regsub() returns FAIL on an invalid regular expression in case zbx_regexp() is used, but not in case of regexp_sub(). Why so?

asaveljevs Function regexp_sub_ex() does not seem to propagate FAIL from regexp_match_ex_regsub() correctly.

REOPENED

glebs.ivanovskis We are currently in race condition with ZBXNEXT-1638 which changes behaviour of regexp_sub() significantly and there will be an inevitable conflict in regexp_match_ex_regsub(). Sorry, forgot to mention that.

glebs.ivanovskis Naming, matching result inversion problem and issue with global regexps consisting of multiple strings/regexps RESOLVED in r59789. Please have a look.

asaveljevs Function regexp_match_ex_substring() does not return FAIL, but we checked for it. Fixed that in r59793.

glebs.ivanovskis Nice catch! Thanks again!
CLOSED

Comment by Glebs Ivanovskis (Inactive) [ 2016 Apr 25 ]

(5) Minor bug in count(). It was decided not to fix it separately.

Different functions are used to read mask for band operator. In evaluate_COUNT() it's either str2uint64() if it's simply mask or it's is_uint64() in case of pattern/mask. In evaluate_BAND() we use get_function_parameter_uint64() which is based on is_uint64(). I think the latter should be used in every case.

glebs.ivanovskis RESOLVED in r59721.

asaveljevs CLOSED

Comment by Gunars Pujats (Inactive) [ 2016 Apr 26 ]

(F) Frontend tested.

Comment by Glebs Ivanovskis (Inactive) [ 2016 Apr 26 ]

(6) Support for numeric items added in r59721.
RESOLVED

asaveljevs CLOSED

Comment by Aleksandrs Saveljevs [ 2016 Apr 28 ]

Assuming that we are going to leave (4) for ZBXNEXT-1638, tested.

glebs.ivanovskis Yes, that part of (4) which is about distinguishing fails and not matches of regexp_sub() we leave for ZBXNEXT-1638. I shall leave a reminder there. We also leave for the future a proper handling or invalid regular expressions in many Zabbix places (logfiles, low-level discovery and others).

Comment by Glebs Ivanovskis (Inactive) [ 2016 Apr 28 ]

Available in pre-3.1.0 (trunk) r59797.

Comment by Glebs Ivanovskis (Inactive) [ 2016 May 03 ]

Documented in:

asaveljevs Looks good!

martins-v I did change the wording and formatting in both places a bit. If you wish to review it, please do.

glebs.ivanovskis Thank you, Mārtiņš!

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