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

Tag filters on Problems screen not working as expected

XMLWordPrintable

    • S24-W8/9, S24-W10/11, S24-W12/13, S24-W14/15
    • 1

      When trying to filter by Tags with the calculation "'Tag name' equal 'value' OR 'Tag name' does not exists'" the result output will be related only to the "Does not exists" condition.
      This considering that "Tag name" is the same on both cases. 

      The purpose of this logic would be to get All the problems with that tag:value pair or problems where that tag doesn't exists at all.

      Steps to reproduce:

      1. Choose a tag that exists and apply the Tag filter on problem screen as below.
        Example: (type of operation can be either way, the result is the same)

      Result:
      The filter is applied as if only the "Does not exist" condition is applied.

      Expected:
      Get all the problem events where the tag pair "scope:availability" and "scope" doesn't exists.

      Few more details related to the Database queries from the Debug (I've been using the "scope" tag for tests):
      1 - Using only scope does not exists:

       

      SELECT p.eventid,p.objectid,p.clock,p.ns,p.name,p.severity,p.cause_eventid FROM problem p WHERE p.source='0' AND p.object='0' AND NOT EXISTS (SELECT NULL FROM event_suppress es WHERE es.eventid=p.eventid) AND p.cause_eventid IS  NULL AND NOT EXISTS (SELECT NULL FROM problem_tag WHERE p.eventid=problem_tag.eventid AND problem_tag.tag='scope') AND (p.r_eventid IS NULL OR p.r_clock>1700738961) ORDER BY p.eventid DESC LIMIT 1001

      Output on frontend is correct, showing only the problems where this tag doesn't exists.

      2 - Using scope does not exists AND/OR scope equals availability

      SELECT p.eventid,p.objectid,p.clock,p.ns,p.name,p.severity,p.cause_eventid FROM problem p WHERE p.source='0' AND p.object='0' AND NOT EXISTS (SELECT NULL FROM event_suppress es WHERE es.eventid=p.eventid) AND p.cause_eventid IS  NULL AND NOT EXISTS (SELECT NULL FROM problem_tag WHERE p.eventid=problem_tag.eventid AND problem_tag.tag='scope') AND (p.r_eventid IS NULL OR p.r_clock>1700739118) ORDER BY p.eventid DESC LIMIT 1001

      Output on frontend is incorrect. It shows only the problems where this tag doesn't exists. 
      You can see that the query is basically the same (only difference is the unixtime referenced).

      Another test:
      The same query as if we are adding a completely different tag and changing it on the query for the one we'd like to look for.

      Example:

      Output query for it is:

      SELECT p.eventid,p.objectid,p.clock,p.ns,p.name,p.severity,p.cause_eventid FROM problem p WHERE p.source='0' AND p.object='0' AND NOT EXISTS (SELECT NULL FROM event_suppress es WHERE es.eventid=p.eventid) AND p.cause_eventid IS  NULL AND (EXISTS (SELECT NULL FROM problem_tag WHERE p.eventid=problem_tag.eventid AND problem_tag.tag='scope' AND problem_tag.value='availability') OR NOT EXISTS (SELECT NULL FROM problem_tag WHERE p.eventid=problem_tag.eventid AND problem_tag.tag='asd')) AND p.r_eventid IS NULL ORDER BY p.eventid DESC LIMIT 1001

      Just replace the "asd" for the tag name we would like to check if it "Does not exists".

      SELECT p.eventid,p.objectid,p.clock,p.ns,p.name,p.severity,p.cause_eventid FROM problem p WHERE p.source='0' AND p.object='0' AND NOT EXISTS (SELECT NULL FROM event_suppress es WHERE es.eventid=p.eventid) AND p.cause_eventid IS  NULL AND (EXISTS (SELECT NULL FROM problem_tag WHERE p.eventid=problem_tag.eventid AND problem_tag.tag='scope' AND problem_tag.value='availability') OR NOT EXISTS (SELECT NULL FROM problem_tag WHERE p.eventid=problem_tag.eventid AND problem_tag.tag='scope')) AND p.r_eventid IS NULL ORDER BY p.eventid DESC LIMIT 1001;

      When doing this change on the database console, the result is the expected one.

       

            dfofanovs Dmitrijs Fofanovs
            vcredidio Victor Breda Credidio
            Team A
            Votes:
            3 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: