Ad Widget

Collapse

Trigger to compare Template Macro

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mskenderian
    Junior Member
    • Jan 2021
    • 9

    #1

    Trigger to compare Template Macro

    I have a template which monitors some backup scripts I wrote. One of the files in my scripts has a Version number of the script, so I know which host has a old outaged script.

    My template has a Macro Named: {$WPS.BASH.BACKUP.VERSION}

    I created a trigger with the expressions

    Code:
    last(/WPS - Bash Backup Script - Version Check/vfs.file.contents[/wps/bash-backup-scripts/VERSION])<>{$WPS.BASH.BACKUP.VERSION}
    This checks and makes sure the version of my script is correct. Works great.

    but this is not my intention. I was trying to check if the script has a minimum version >=

    Code:
    last(/WPS - Bash Backup Script - Version Check/vfs.file.contents[/wps/bash-backup-scripts/VERSION])>= {$WPS.BASH.BACKUP.VERSION}

    this does not work. I am assuming because the template macro is a string and the Item is a float, but i am not sure. I tried using macro functions, but that doesnt seems to work.

    Any ideas on how i can accomplish this?
  • Hamardaban
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2019
    • 2713

    #2
    If complex comparisons are needed, you can use the following hack: create a dependent item and in preprocessing using JS make the necessary comparison and return 0 or 1, depending on the result. And already build a trigger from this.
    Last edited by Hamardaban; 04-11-2023, 13:48.

    Comment

    Working...