Ad Widget

Collapse

VMWare guest FS - backslash causing issues in context macro\trigger prototype

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • timirons
    Junior Member
    • Oct 2021
    • 4

    #1

    VMWare guest FS - backslash causing issues in context macro\trigger prototype

    Hi,

    I have noticed that setting up a context macro in a trigger prototype to monitor VMware discovered guests' free disk space on mounted file systems isn't working correctly.
    This is because VMware reports Windows file systems with a trailing backslash (i..e C:\) and the trigger cannot be created (as context macros cannot have backslashes at the end.)
    I need to have a context macro (i.e. have different values for freespace limits to report a new problem) as things like boot partitions and page file drives have a very small amount of space compared to OS and application drives.

    All Linux based guests can have their triggers created, as their filesystems do not end with a backslash symbol.

    I am using the default VMWare Guest template, and Zabbix version 5.4 with the latest updates.

    As a workaround, I have added text to the end of the macro.
    So my trigger prototype rule is:
    last(/VMware Guest/vmware.vm.vfs.fs.size[{$VMWARE.URL},{$VMWARE.VM.UUID},{#FSNAME},free])<= {$FS_LIMIT:"{#FSNAME}freespace"}

    and the macro the guests inherit is in this format:
    {$FS_LIMIT:"C:\freespace"}

    Using the above method has worked for me, but I have to add macros for every file system.

    Does anyone have any suggestions for how to clear this up?
    I suspect the easiest way would be to 'override' the value of the #FSNAME - replacing C:\ with C:, for example, but I am not sure how to do this.

    Thanks in advance,
    Tim
  • timirons
    Junior Member
    • Oct 2021
    • 4

    #2
    Thanks for your reply.
    I have looked at this this morning and have not been able to get it working unfortunately.

    I modified the Mounted Filesystems discovery rule on the VMWare guest template, to add a JavaScript pre-processing rule as follows:

    if (value.endsWith('\\') == true) {
    return (value.substring(0, value.length -1));
    }
    else {
    return value;
    }

    However - this is modifying the value of the returned items in the mounted filesystems discovery rule (i.e. free space on the drive), not the #FSNAME value.
    I cannot see where this is set explicitly in any of the VMware templates. For other templates (Windows Zabbix agent etc) it appears to be set in the template.

    Am I approaching this in the correct way?
    Thanks



    ​​​​​​​

    Comment

    • timirons
      Junior Member
      • Oct 2021
      • 4

      #3
      I've done some further research - looks like this is a bug for any Windows filesystem:
      [ZBX-10590] Macro context with Windows volumes - ZABBIX SUPPORT

      The workaround above was discovered by others about 5 years ago - I just happened to rediscover it!
      I will add comments to the bug to advise it is still an issue.

      Comment

      Working...