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

Incorrect macro is resolved in problem event details in case if context macro with regex exists and context in trigger configuration contains word "regex"

XMLWordPrintable

    • S24-W42/43, S24-W44/45
    • 2

      Problem description: In case if a host has both macro (for example {$TEST}) and macro with context (like {$TEST:regex:"x"}) and then this macro is used in trigger expression or in operational data, then it is possible that the context macro will be resolved with plain macro value in the event details form. To observe the problem, please follow the steps below.

      Steps to reproduce:

      1. Create host with the following macros:
        1. {$TEST} => 33
        2. {$TEST:regex:"x"} => 15
      2. Create a trapper item with key "trap" on this host
      3. Create a trigger that will use the TEST macro in its operational data and in its function in the following way:
        1. Operational data =>Some text {$TEST:regex:x}
        2. {<host name>:trap.last()}>{$TEST:regex:x}
      1. Send a value to the trapper item, that would be higher then the value of the context macro but lower than the value of the plain user macro, for example 17
      2. Go to Monitoring => Problems and make sure that the problem is created
      3. Open event details of the created problem
      4. Check "Problem expression" and "Operational data" fields

      Result: "Problem expression" and "Operational data" fields contain the value of macro {$TEST} even though it was the {$TEST:regex:"x"} macro that was resolved when creating the problem (33 instead of 15).
      Expected:
      The context macro should've been resolved in "Operational data" and "Problem expression" fields.

      Example:

        1. image-2024-10-28-11-10-40-598.png
          9 kB
          Alexander Vladishev
        2. image-2024-10-28-11-12-08-708.png
          21 kB
          Alexander Vladishev
        3. inherited.png
          151 kB
          Ivo Kurzemnieks
        4. trailing_spaces_in_macro_regex_inheritance.gif
          553 kB
          Sergejs Olonkins
        5. wrong_macro_resolved.gif
          8.48 MB
          Sergejs Olonkins
        6. zbx_export_hosts (3).yaml
          0.9 kB
          Sergejs Olonkins

            sasha Alexander Vladishev
            solonkins Sergejs Olonkins
            Team B
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - Not Specified
                Not Specified
                Logged:
                Time Spent - 7h 38m
                7h 38m