Ad Widget

Collapse

How to compare two Items and Trigger on second missmatch

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • grenzlaeufer
    Junior Member
    • Nov 2010
    • 24

    #1

    How to compare two Items and Trigger on second missmatch

    Hallo!

    I have a new Zabbix administration task, which is a nice riddle. Google didn´t help out. I want to compare string items and trigger, when the comparison fails the -second- time.

    A simple solution which works but triggers the first time looks like this:

    Code:
    {host1:itemname[{HOST.HOST}].str()}<>{host2:itemname[{HOST.HOST}].str()}
    I know how to work with the count() function on one item. But how do I use it in a comparison?

    I saw that I can put the expressions in brackets

    Code:
    ({host1:itemname[{HOST.HOST}].str()}<>{host2:itemname[{HOST.HOST}].str()})
    But when I add the count() function...

    Code:
    {({host1:itemname[{HOST.HOST}].str()}<>{host2:itemname[{HOST.HOST}].str()}).count(2#,1,eq}=2
    ... I get "Incorrect trigger expression".

    Has anyone an idea how to implement this test?
  • batchenr
    Senior Member
    • Sep 2016
    • 440

    #2
    Originally posted by grenzlaeufer
    Hallo!

    I have a new Zabbix administration task, which is a nice riddle. Google didn´t help out. I want to compare string items and trigger, when the comparison fails the -second- time.

    A simple solution which works but triggers the first time looks like this:

    Code:
    {host1:itemname[{HOST.HOST}].str()}<>{host2:itemname[{HOST.HOST}].str()}
    I know how to work with the count() function on one item. But how do I use it in a comparison?

    I saw that I can put the expressions in brackets

    Code:
    ({host1:itemname[{HOST.HOST}].str()}<>{host2:itemname[{HOST.HOST}].str()})
    But when I add the count() function...

    Code:
    {({host1:itemname[{HOST.HOST}].str()}<>{host2:itemname[{HOST.HOST}].str()}).count(2#,1,eq}=2
    ... I get "Incorrect trigger expression".

    Has anyone an idea how to implement this test?
    mmm maybe try with last(#2)
    like this :

    Code:
    {host1:itemname[{HOST.HOST}].str()}<>{host2:itemname[{HOST.HOST}].str()}.last(#2)
    or

    Code:
    {host1:itemname[{HOST.HOST}].str()}<>{host2:itemname[{HOST.HOST}].str()}.last(#2)=1

    Comment

    • grenzlaeufer
      Junior Member
      • Nov 2010
      • 24

      #3
      Thanks for the hint! I have not worked so much with the position parameter in the past. But I have an idea of how to accomplish with it my goal.

      Comment

      Working...