Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-9905

Document how Zabbix evaluates comparison and logic operators in expressions

XMLWordPrintable

      Suggested text to include in Zabbix documentation (largely borrowed from C language standards):

      Each of the operators '<' (less than), '>' (greater than), '<=' (less than or equal to), '>=' (greater than or equal to), '=' (equal to), '<>' (not equal to) shall yield 1 if the specified relation is true and 0 if it is false.

      The 'and' operator shall yield 1 if both of its operands compare unequal to 0; otherwise, it yields 0.

      The 'or' operator shall yield 1 if either of its operands compare unequal to 0; otherwise, it yields 0.

      The result of the logical negation operator 'not' is 0 if the value of its operand compares unequal to 0, 1 if the value of its operand compares equal to 0.

      Knowing exactly how these operators work will allow users to write more complex calculated item and trigger expressions.

      //logic_expr ? true_value : false_value
      (logic_expr) * (true_value) + (not logic_expr) * (false_value)
      
      //max of two items
      (item1 > item2) * item1 + (item1 <= item2) * item2
      
      //number of items over threshold
      (item1 > threshold) + (item2 > threshold) + ... + (itemN > threshold)
      

            Unassigned Unassigned
            glebs.ivanovskis Glebs Ivanovskis (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: