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

LLD macro existence check don't work in custom calculation formulas in LLD filters and overrides


    • Sprint 92 (Sep 2022), Sprint 93 (Oct 2022), Sprint 94 (Nov 2022)
    • 1

      As per upcoming changes in vfs.fs.get and vfs.fs.discovery (ZBXNEXT-1616 Agent supported vfs mount status on discovered mounts. - ZABBIX SUPPORT) we need to adapt OS templates accordingly.

      For that we need to check if the options field exists in a value returned by the vfs.fs.get key in overrides to exclude some filesystems from discovery.

      If you want to check whether a LLD macro exists and also check it against some regex, the existence check has to be placed at the beginning of the calculation formula.

      Here's an example:

      Calculation type: And

      A. {#FSOPTIONS} exists

      B. {#FSOPTIONS} matches (?:^|,)bind\b

      This should also work with previous agent versions which don't have the options field, that's why we check for macro existence. If you use built-in And, it works fine. But if you try to use a custom formula and specify the exact same expression (A and B), it will show an error: "Cannot accurately apply filter: no value received for macro "{#FSOPTIONS}".

      I think that custom formulas should work the same way as with built-in logical operators. Also, the macro existence check should be prioritized in filters and overrides, no matter where it was placed in formula, and only then they should be tested against regex. 

      I've attached the new "Linux filesystems by Zabbix agent" template (you can test it against Zabbix agent versions 6.2 and earlier).

        1. error.png
          17 kB
        2. filter_expression_eval.diff
          8 kB
        3. overrides.png
          16 kB
        4. template_module_linux.yaml
          87 kB

            dgoloscapov Dmitrijs Goloscapovs
            drasikhov Denis Rasikhov
            Team A
            0 Vote for this issue
            7 Start watching this issue