[ZBX-6333] server doesn't take into account current nodeid when searches a global regexp by its name Created: 2013 Feb 28  Updated: 2017 May 30  Resolved: 2013 Mar 12

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 2.0.5, 2.1.0
Fix Version/s: 2.0.6rc1, 2.1.0

Type: Incident report Priority: Critical
Reporter: Oleksii Zagorskyi Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: dm, globalregexps, lld
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate

 Description   

This is real case !

Part of debug log of vanilla 2.0.5:
18475:20130228:150325.247 Starting Zabbix Server. Zabbix 2.0.5 (revision 33558).
...
18475:20130228:150325.248 NodeID: 998
...
18481:20130228:150339.182 query [txnlev:1] [select e.expression,e.expression_type,e.exp_delimiter,e.case_sensitive from regexps r,expressions e
where r.regexpid=e.regexpid and r.name='File systems for discovery']
18481:20130228:150339.182 DBlld_process_discovery_rule() f_macro:'

{#FSTYPE}

' f_regexp:'@File systems for discovery'

I did a patch:

Index: src/libs/zbxdbhigh/lld.c
===================================================================
--- src/libs/zbxdbhigh/lld.c    (revision 33709)
+++ src/libs/zbxdbhigh/lld.c    (working copy)
@@ -2373,8 +2373,8 @@
                        result = DBselect("select e.expression,e.expression_type,e.exp_delimiter,e.case_sensitive"
                                        " from regexps r,expressions e"
                                        " where r.regexpid=e.regexpid"
-                                               " and r.name='%s'",
-                                       f_regexp_esc);
+                                               " and r.name='%s'" DB_NODE,
+                                       f_regexp_esc, DBnode_local("r.regexpid"));

                        zbx_free(f_regexp_esc);

It helped to get this line (as it should be, IMO):
4877:20130228:160139.625 query [txnlev:1] [select e.expression,e.expression_type,e.exp_delimiter,e.case_sensitive from regexps r,expressions e where r.regexpid=e.regexpid and r.name='File systems for discovery' and r.regexpid between 99800000000000000 and 99899999999999999]

In production environment I have this:
mysql> select * from regexps;
--------------------------------------------------------------------------------

regexpid name test_string

--------------------------------------------------------------------------------

1001000000000001 File systems for discovery - linux named
1001000000000002 Network interfaces for discovery - linux eth1
1001000000000003 discovery filtering on snmp devices vlan3
1001000000000004 discovery filtering on snmp devices - VLAN GigabitEthernet0/5/6
1001000000000006 CLONE discovery filtering on snmp devices vlan3
3003000000000001 discovery filtering on snmp devices test
3003000000000002 Storage devices for SNMP discovery bla
3003000000000003 File systems for discovery test
3003000000000004 Network interfaces for discovery gt

--------------------------------------------------------------------------------
9 rows in set (0.00 sec)

As you see there two regexps with the same name - "discovery filtering on snmp devices", but they use different expressions.

And all my LLD discovery rule with the regexp name "discovery filtering on snmp devices" on master nodeid=1 do NOT work correctly - they do NOT discover experted resources.

Note - in the code I saw many places where no check for nodeid when selecting a global regexp.
So probably you need to check them all, but I'm not very sure here.



 Comments   
Comment by Andris Zeila [ 2013 Mar 07 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-6333

I updated few other places too where global regexp was being searched.

Comment by Oleksii Zagorskyi [ 2013 Mar 08 ]

(1) [Frontend]
This appeared to be also Frontend related issue.

Problem is that not possible to create/update an regexp on master node if it contains already a regexp from a child node with the same name. This is incorrect behavior of course.

ERROR: Regular expression "File systems for discovery" already exists.

REOPENED to fix frontend side.

dimir This was moved to a separate ZBX-6388 as instructed by sasha. CLOSED

Comment by dimir [ 2013 Mar 12 ]

Server side successfully tested.

Overall places where this was fixed:

  • snmptrap items
  • sending active checks containing global regexps
  • trigger functions logeventid, str, regexp, iregexp
  • lld rule processing
Comment by Andris Zeila [ 2013 Mar 13 ]

Server side fixed in:
pre-2.1.0 r34340
pre-2.0.6rc1 r34339

Generated at Fri Apr 19 23:54:18 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.