Ad Widget

Collapse

Macros units and evaluating expressions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dexit
    Junior Member
    • Sep 2018
    • 2

    #1

    Macros units and evaluating expressions

    Hi all

    I use zabbix server 3.4 and zabbix agents 3.2

    I need to tune several hosts to slightly different value of e.g. time when zabbix-agent is unreachable.
    T accomplish that I set up new macro {$TIME_UNREACHABLE} and replaced default expression:

    {Template App Zabbix Agent:agent.ping.nodata(5m)}=1

    with:

    {Template App Zabbix Agent:agent.ping.nodata({$TIME_UNREACHABLE}m)}=1

    Unfortunately zabbix raise a syntax error due to merging macro and unit. So I decided to pass this value in seconds so now expression is:

    {Template App Zabbix Agent:agent.ping.nodata({$TIME_UNREACHABLE})}=1

    and macro specified with seconds. Everything works now but there is other issue.
    The name of trigger is:

    Zabbix agent on {HOST.NAME} is unreachable for 5 minutes

    so I decided to change it too. Now it is like this:

    Zabbix agent on {HOST.NAME} is unreachable for {$TIME_UNREACHABLE}/60 minutes

    The issue is that zabbix doesn't evaluate this expression and prints:

    Zabbix agent on {HOST.NAME} is unreachable for 300/60 minutes

    That's not perfect solution and printing values in seconds is not satisfying either...

    Somebody know better solution?
  • perlestius
    Junior Member
    • May 2020
    • 8

    #2
    Try this:
    (for macro)
    {$TIME_UNREACHABLE}=1h

    (for trigger expression)
    {Template App Zabbix Agent:agent.ping.nodata({$TIME_UNREACHABLE})}=1

    (for trigger name)
    Zabbix agent on {HOST.NAME} is unreachable for {$TIME_UNREACHABLE}

    Comment

    • frater
      Senior Member
      • Oct 2010
      • 340

      #3
      If you make the units in seconds, then Zabbix converts it to minutes. You don't need to divide by 60
      Zabbix agents on Linux, FreeBSD, Windows, AVM-Fritz!box, DD-WRT and QNAP

      Comment

      Working...