Ad Widget

Collapse

Using the value of a calculated item in a iregexp type function.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dominic123
    Junior Member
    • May 2017
    • 1

    #1

    Using the value of a calculated item in a iregexp type function.

    Hello everyone. I'm new to this forum and to zabbix also. I'm curently Learning how all of this works. So far so good, everything is fine. Exept..

    I want to have certain conditions in a trigger that evaluate if we are during a work day and Inside of the opening hours. I can't use user created macros or hard coded values for the workdays because my zabbix server monitors a bunch of interfaces that have different work days and opening hours. I managed to tell zabbyx what are those values using a zabbix trapper item. What i'd like to do is simply use a calculated item or even conditions Inside of a trigger to compare the value of that trapper item to a dayofweek function.

    For example, I'd like to use a calculated item like that:

    iregexp("item.work.days","item.curentday")

    Zabbix will interpret the second argument ("item.curentday") as a string while I would like it to interpret it as the value of that item.

    Has anyone ever encountered that problem?

    Thanks for your help.

    Dominic
  • ovas
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Apr 2017
    • 138

    #2
    Hello Dominic123!

    Indeed, iregexp function's second value is either time in seconds or Nth value number as per the documentation: iregexp (pattern,<sec|#num>)

    dayofweek, on the other hand, operates with the days, so if you do something like item.curentday = (dayofweek(0)=1) in trigger expression, it might work.

    For example, I quickly added a Zabbix trapper item.current.day, sent it value "2" and added a trigger expressions:
    Code:
    {<hostname>:item.current.day.last()}={<hostname>:item.current.day.dayofweek()}
    It fired. You just need to set your own logic in a similar trigger.

    Comment

    Working...