Ad Widget

Collapse

Unable to find how to set trigger prototype per found discovered filesystem volume

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xant1s
    Junior Member
    • Dec 2020
    • 5

    #1

    Unable to find how to set trigger prototype per found discovered filesystem volume

    Setting up a new Zabbix server for 400-600 hosts.

    All the hosts have a simple template assigned for uptime, default info (hostname and etc)
    All the Zabbix agents are Zabbix active agents.

    Created a new template with the Discovery rule which I am planning to assign to all hosts.

    template key: fs.mountpoint.discovery
    with masteritem: vfs.fs.get item

    The item prototype key:
    free[{#FSNAME}]
    based on master: masteritem: vfs.fs.get item
    Units: B

    Added preprocessing:
    JSONPath
    Parameter: $.[?(@.fsname=='{#FSNAME}')].bytes.free.first()


    This so far is working fine and as expected, as on the hosts to which I have assigned this template, I am being informed about the free space in Gigabytes
    Click image for larger version

Name:	2022-10-27-115943720.png
Views:	398
Size:	37.4 KB
ID:	453446


    Got stuck with the following idea/problem

    I would like to have a trigger based on "minimum space" per volume.
    However, as the hosts are different, the minimum space value will be the different per host.
    I do not want to add an item and trigger per host, as with 600 hosts it will be a pain and would prefer to have it simplified as much as I can.

    Example scenario:

    Host 1 has the following volumes:

    C:
    D:
    E:

    Where I would like to set the trigger for this host as
    Trigger high when C: free space lower than 5GB
    Trigger high when D: free space lower than 10GB
    Trigger high when E: free space lower than 20GB


    Host 2 has the following volumes:
    C:
    E:

    Where I would like to set the trigger for this host as
    Trigger high when C: free space lower than 15GB
    Trigger high when E: free space lower than 50GB

    -----------------------------------------------

    The original idea was:

    Assign the template to all hosts.
    Create 21 triggers in the template

    1. Free disk space on C: is less than {$MINSPACE_C}
    2. Free disk space on D: is less than {$MINSPACE_D}
    3. Free disk space on E: is less than {$MINSPACE_E}
    4. Free disk space on F: is less than {$MINSPACE_F}
    [...]
    21. Free disk space on Z: is less than {$MINSPACE_Z}

    At the "host" level, use MACRO to set the minimum space as the present drives.
    So based on the example, on HOST1 I will use MACRO tab and set the following MACROs
    {$MINSPACE_C} set to 5G
    {$MINSPACE_D} set to 10G
    {$MINSPACE_E} set to 20G

    Where on HOST2, I will use the following MACROs
    {$MINSPACE_C} set to 15G
    {$MINSPACE_E} set to 50G

    The trigger will not be "active" unless the expressions will be true, so having 21 triggers in the template would not cause any issues,
    because they rely on {$MINSPACE_C} to {$MINSPACE_Z}. If $MINSPACE_DRIVELETTER does not exist, the trigger won't be functional.

    But. I am stuck with a basic, extremely basic issue.
    How to set up the trigger so that it would consider checking the drive_letter less than $MACROVALUE
    if the trigger is a trigger prototype?

    Currently, it is set as follows:

    Click image for larger version

Name:	2022-10-27-121128873.png
Views:	282
Size:	131.7 KB
ID:	453447

    I am not sure if it is a lack of coffee or a simple brain block that I am not able to move any further.

    The goal would be to have the following expression (alike)
    last(/Filesystem discovery/free[C:,])<{$MINSPACE_C}
    copy/paste the trigger 20 times for each drive letter
    and on each host set the MINSPACE_DRIVEletter in MACRO


    is it possible with the LLD?
    or would I have to create the triggers per host (so 600 hosts * 2-5 drives)?




    ​​
  • Markku
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Sep 2018
    • 1781

    #2
    Context macros are what you are probably looking for: https://www.zabbix.com/documentation...macros_context

    Markku

    Comment

    • xant1s
      Junior Member
      • Dec 2020
      • 5

      #3
      Thank you.
      Haven't thought about using this specific functionality at all
      I will look into this today.
      Can't promise I will be able to "solve it" today (depending on the amount of other duties)

      Comment

      Working...