Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-6333

server doesn't take into account current nodeid when searches a global regexp by its name

XMLWordPrintable

      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.

            Unassigned Unassigned
            zalex_ua Oleksii Zagorskyi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: