Ad Widget

Collapse

Execute Trigger if expression is true for x counts / minutes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bjoern123
    Junior Member
    • Nov 2023
    • 8

    #1

    Execute Trigger if expression is true for x counts / minutes

    Hello all,

    for Windows Disk space monitoring I use a slightly modified Trigger from the default "Windows by Zabbix Agent" template (without the "timeleft" expression). So the expression looks like this:
    Code:
    last(/Windows by Zabbix agent/vfs.fs.dependent.size[{#FSNAME},pused])>{$VFS.FS.PUSED.MAX.WARN:"{#FSNAME}"} or ((last(/Windows by Zabbix agent/vfs.fs.dependent.size[{#FSNAME},total])-last(/Windows by Zabbix agent/vfs.fs.dependent.size[{#FSNAME},used]))<{$VFS.FS.FREE.MIN.WARN:"{#FSNAME}"})
    What I try to accomplish is that the Trigger is executed after the Expression is True for 15 counts or minutes (the Item is executed once per minute therefore no difference). So only if the Disk Usage is above the limit for 15 minutes straight I want to know it. If it is below the limit once during the 15 minutes, no Trigger should be executed. I don´t really know how to accomplish that especially with the "(total-used)<MIN.WARN" section...

    Does anyone have an idea how to solve that?

    Thank you!

    Best regards,
    Bjoern
  • bjoern123
    Junior Member
    • Nov 2023
    • 8

    #2
    Something like this would be what I want but unfortunately that is not working:
    Code:
    min(last(/Windows by Zabbix agent/vfs.fs.dependent.size[C:,total])-last(/Windows by Zabbix agent/vfs.fs.dependent.size[C:,used]),15m)<{$VFS.FS.FREE.MIN.WARN:"C:"}
    This Trigger is executed instantly, even though the free Space Value is higher then VFS.FS.FREE.MIN.WARN.
    Any ideas?

    Comment

    • bjoern123
      Junior Member
      • Nov 2023
      • 8

      #3
      I solved it.
      The main problem is that the Trigger is using a calculated item (total - used). I presume they want to use those two values as operational data. The downside, as mentioned in the documentation, is: "Expressions (including function calls) cannot be used as history, trend, or foreach function parameters"
      I don´t know why there is no Item Prototype in the "Windows by Zabbix Agent"-Template for "Free space" (btw, I´m using Zabbix v6.4.8), because that value can be received easily. With that value I can use it as history.
      What I did, add an Item prototype to the Discovery "Mounted filesystem discovery" (basically copy the Item from e.g. "Total space" and adjust where necessary):
      Name: {#FSLABEL} ({#FSNAME}): Free space
      Key: vfs.fs.dependent.size[{#FSNAME},free]
      Preprocessing: JSONPath -> $.bytes.free​

      Change the Trigger expression to:
      Low:
      Code:
      min(/Windows by Zabbix agent/vfs.fs.dependent.size[{#FSNAME},pused],#15)>{$VFS.FS.PUSED.MAX.WARN:"{#FSNAME}"} or max(/Windows by Zabbix agent/vfs.fs.dependent.size[{#FSNAME},free],#15)<{$VFS.FS.FREE.MIN.WARN:"{#FSNAME}"}
      Crit:
      Code:
      min(/Windows by Zabbix agent/vfs.fs.dependent.size[{#FSNAME},pused],#15)>{$VFS.FS.PUSED.MAX.CRIT:"{#FSNAME}"} or max(/Windows by Zabbix agent/vfs.fs.dependent.size[{#FSNAME},free],#15)<{$VFS.FS.FREE.MIN.CRIT:"{#FSNAME}"}
      I changed the operational data to:
      Code:
      Free space: {ITEM.LASTVALUE2}
      With this configuration the Trigger is executed if the last 15 values are above the percentage or under the GB limit.

      Comment

      Working...