Ad Widget

Collapse

LLD Macro Issue in VMware Guest Template: Cannot create trigger

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bennyboyy
    Junior Member
    • Jun 2024
    • 6

    #1

    LLD Macro Issue in VMware Guest Template: Cannot create trigger

    Hi everyone,

    I'm encountering an issue with Low-Level Discovery (LLD) in Zabbix while using the VMware Guest Template for monitoring virtual machine disk space. The problem occurs when trying to create triggers based on the disk paths discovered by LLD macros, and I keep seeing the following error messages:

    Code:
    Cannot create trigger: failed to expand LLD macros in expression: quoted context "C:\" cannot end with '\' character.
    Cannot create trigger: failed to expand LLD macros in expression: quoted context "D:\" cannot end with '\' character.
    The trigger prototype:
    Code:
    [{#FSNAME}]: Disk space is critically low. Space free: {ITEM.LASTVALUE}
    max(/VMware Guest/vmware.vm.vfs.fs.size[{$VMWARE.URL},{$VMWARE.VM.UUID},{#FSNAME},pfree],5m)<{$VMWARE.VM.FS.PFREE.MIN.CRIT:"{#FSNAME}"} and {$VMWARE.VM.FS.TRIGGER.USED:"{#FSNAME}"}=1
    The issue seems to stem from LLD returning disk paths like C:\ and D:\, where Zabbix doesn't accept the backslash (\) at the end of these strings in the trigger expression.​

    Context:
    • The LLD is part of the VMware Guest Template provided by Zabbix, which automatically discovers virtual disks in the guest OS. (Latest version)
    • Zabbix version: 7.0.4
    • VMware environment: vSphere version 8
    • OS: Windows

    Has anyone else encountered this issue when working with VMware Guest Templates and LLD macros in Zabbix? Is there a recommended workaround or a better way to handle the backslashes in these disk paths when creating triggers?

    Any advice or guidance would be greatly appreciated!

    Thank you!

  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    In some places in trigger you have {#FSNAME} and in some "{#FSNAME}". What happens if you put ""-s around all occurrences?

    Comment

    • bennyboyy
      Junior Member
      • Jun 2024
      • 6

      #3
      Thank you very much for your response and for taking the time to help me.

      You're absolutely right to point out that I used both {#FSNAME} and "{#FSNAME}" in the trigger. After testing, I found that adding quotes around {#FSNAME} in the item key, for example in vmware.vm.vfs.fs.size[{$VMWARE.URL},{$VMWARE.VM.UUID},"{#FSNAME}",pfree], leads to an error. Zabbix seems to interpret this as a literal string and fails to resolve the macro correctly.

      The error I get is:
      Incorrect item key "vmware.vm.vfs.fs.size[{$VMWARE.URL},{$VMWARE.VM.UUID},"{#FSNAME}",pfree]" provided for trigger expression on "VMware Guest".

      By removing the quotes around {#FSNAME} in the item key, the error goes away and Zabbix successfully resolves the macro as expected.

      However, I noticed that this works fine for Linux mount points, but causes issues with Windows file systems such as C:\. It seems that certain characters, like the backslash (\), may be causing the problem. Perhaps the solution would be to strip such characters from the macro, though I’m not sure how to do that.

      I’m using the latest version of the template provided by Zabbix, and I imagine I’m not the only one facing this issue.

      Thanks again for your valuable help!

      Comment

      • jbjohnston
        Junior Member
        • May 2022
        • 1

        #4
        Exactly the same problem here. We recently upgraded from Zabbix 6.0LTS to 7.0LTS and this has caused issues with all of the VMs we monitor. It is very common to monitor Windows systems which use "C:" as a convention, and I would point out the previous template for 6.0 handled these just fine. It seems like a bug, but thanks for the workaround.

        Comment

        • jfx21
          Junior Member
          • Nov 2024
          • 1

          #5
          Same error with 7.0.5.
          I found if I wrapped {FSNAME} in single quotes first, '{FSNAME}' then wrapped back in double quotes "'{#FSNAME}'" it worked as intended and I have my guest volumes reporting.

          Code:
          max(/VMware Guest/vmware.vm.vfs.fs.size[{$VMWARE.URL},{$VMWARE.VM.UUID},{#FSNAME},pfree],5m)<{$VMWARE.VM.FS.PFREE.MIN.CRIT:"'{#FSNAME}'"} and {$VMWARE.VM.FS.TRIGGER.USED:"'{#FSNAME}'"}=1

          Comment

          Working...