[ZBXNEXT-2155] support longer regexes for discovery filters Created: 2014 Feb 12  Updated: 2014 Nov 04

Status: Open
Project: ZABBIX FEATURE REQUESTS
Component/s: Frontend (F), Server (S)
Affects Version/s: 2.2.0, 2.2.1, 2.2.2
Fix Version/s: None

Type: Change Request Priority: Minor
Reporter: Ramses Rodenburg Assignee: Unassigned
Resolution: Unresolved Votes: 2
Labels: dbpatches, lld, patch, regexps
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Please allow for longer (1023-character) filter regexes in the Zabbix frontend (and database!) for item discovery. Currently the regex may contain no more than 255 characters. We actively use regexes that are much longer than that for filtering of discovered network interfaces, CPUs, and file systems.
We have been applying a GNU patch to the last two or three versions of Zabbix and have altered our database to store the larger regex string. The SQL ALTER statement is shown in the output of our buildscript below, you'll find the patch listed below. Would you please consider importing this into the main source tree?

-------- 8< ------------
...
Patching PHP frontend to allow 1023-character regexes, PLEASE make sure to
ALSO have a larger 'filter' column for 'items' in the database:

sql> ALTER TABLE items ALTER COLUMN filter TYPE character varying(1023);

patching file frontends/php/include/views/configuration.item.edit.php
Hunk #1 succeeded at 345 (offset 6 lines).
patching file frontends/php/include/schema.inc.php
Hunk #1 succeeded at 1178 (offset 118 lines).
...
-------- 8< ------------

patch -p0 << 'PATCH1'
--- configuration.item.edit.php 2013-08-21 18:14:41.000000000 +0200
+++ frontends/php/include/views/configuration.item.edit.php     2013-08-21 18:15:19.000000000 +0200
@@ -339,7 +339,7 @@
                        SPACE,
                        _('Regexp'),
                        SPACE,
-                       new CTextBox('filter_value', $filter_value, 20)
+                       new CTextBox('filter_value', $filter_value, 20, 'no', 1023)
                )
        );
        $itemFormList->addRow(_('Allowed hosts'),
--- schema.inc.php      2013-08-19 13:28:00.108997953 +0200
+++ frontends/php/include/schema.inc.php        2013-08-19 12:34:31.629418940 +0200
@@ -1060,7 +1060,7 @@
                        'filter' => array(
                                'null' => false,
                                'type' => DB::FIELD_TYPE_CHAR,
-                               'length' => 255,
+                               'length' => 1023,
                                'default' => '',
                        ),
                        'interfaceid' => array(
PATCH1


 Comments   
Comment by richlv [ 2014 Feb 12 ]

you could use global regexps as a workaround (without patching) until field length is increased

Comment by richlv [ 2014 Nov 04 ]

hmm, too bad this was forgotten when multiple filters for lld rules were implemented.
for the record, since 2.4 lld filters are in a separate table : item_condition

Generated at Fri Apr 19 14:41:42 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.