Ad Widget

Collapse

String comparison in calculated item

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ToomasAas
    Junior Member
    • Apr 2012
    • 14

    #1

    String comparison in calculated item

    Hello!

    I have a Text item on two hosts. I need to create a trigger which detects if values of this item are different on host A and host B. I thought I could create a calculated item for this purpose, but from the manual I can't figure out a way to do so.

    Or maybe someone can recommend an alternative way to achieve my goal. What I actually need to detect is if the contents of specific directory on two hosts are (not) identical. I started by creating an userparameter which basically does 'ls -l /the/directory | md5sum' and stores the MD5 hash as Text item on each host. However, the next step of actually comparing these items on two hosts is turning out to be a challenge...

    I am using Zabbix 2.4.1.
    Last edited by ToomasAas; 24-11-2015, 16:20.
  • nakutnyi
    Junior Member
    • Mar 2017
    • 1

    #2
    Hello.
    I believe you already found the solution, but just in case someone else needs help, it can be done like follows:
    {hostname:item.key.regexp(^(string_to_compare_with )$)}=0

    Comment

    • twentyninehairs
      Junior Member
      • Jan 2018
      • 7

      #3
      Can the above function be used to compare an item string value to another item string value? I tried {template:item.key.regexp(^(template:item.key.last ())$)}=0 and I also tried {template:item.key.regexp(template:item.key.last() ))}=0. Neither seem to work.
      Last edited by twentyninehairs; 07-05-2019, 04:45.

      Comment

      • Jeroloog
        Junior Member
        • Jul 2022
        • 3

        #4
        Late to the party, but I also need to compare 2 strings from 2 known items. Did you ever find a solution?

        Comment

        Working...