Ad Widget

Collapse

How to define a macro on a filesystem level

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ohmer
    Junior Member
    • Oct 2013
    • 20

    #1

    How to define a macro on a filesystem level

    Hello,

    I have a template with a file system discovery. On this file system discovery I have a trigger if available space is less than ${MACRO}%.

    I can define my macro on host level and it's work fine.

    Problem is I want to set a different value for one file system only. Say I want it trigger at <20% for the host but only at <10% for one specific file system.

    I didn't find any way to define my macro on a filesystem level.

    Is it possible?

    Thank you.
  • ohmer
    Junior Member
    • Oct 2013
    • 20

    #2
    Not doable?

    Comment

    • chojin
      Member
      Zabbix Certified Specialist
      • Jul 2011
      • 64

      #3
      As far as I know, defining the macro on filesystem level is indeed not possible. You could try constructing a trigger expression which will dynamically check against the correct macro depending on the value of a related item or {#variable} returned by a custom discovery script. (in a similar was as it is done for handling hysteresis in the manual: https://www.zabbix.com/documentation...ion#hysteresis)

      On the other hand if you choose to create a custom discovery script, it may be even be easier to have your script "generate" a variable with the wanted %-free in (calculated by or explicitly defined in your discovery script).
      For example, a discovery script returning:
      Code:
      {
        "data":[
       
        { "{#FSNAME}":"\/",     "{#FSTYPE}":"ext3",  "{#FSMAXFREE}:"10"},
        { "{#FSNAME}":"\/home", "{#FSTYPE}":"ext3",  "{#FSMAXFREE}:"15"},
        { "{#FSNAME}":"\/tmp",  "{#FSTYPE}":"tmpfs", "{#FSMAXFREE}:"5" },
        { "{#FSNAME}":"\/usr",  "{#FSTYPE}":"ext3",  "{#FSMAXFREE}:"20"},
        { "{#FSNAME}":"\/var",  "{#FSTYPE}":"ext3",  "{#FSMAXFREE}:"10"},
        
        ]
      }
      Would enable you to create a trigger prototype like this:
      Code:
      Name: Free disk space on {HOST.NAME} is less than {#FSMAXFREE}% on volume {#FSNAME}
      Expression: 
      {vfs.fs.size[{#FSNAME},pfree].last()}>{#FSMAXFREE}

      Comment

      Working...