Ad Widget

Collapse

How to compare strings?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • g.vecchi
    Member
    • Dec 2010
    • 44

    #1

    How to compare strings?

    Hi all!
    I would like to set up an item with vfs.file.md5sum[] key but I'm in trouble how to create trigger which compare last and last-1 value.

    Any ideas?

    Thanks!!!
  • Rudd
    Member
    • Mar 2011
    • 69

    #2
    Check the triggers in the default Linux template. There are various triggers around changed checksums:

    {Template_CentOS_Linux_Base:vfs.file.cksum[/etc/passwd].diff(0)}>0

    hth

    Comment

    • g.vecchi
      Member
      • Dec 2010
      • 44

      #3
      The trigger in Linux Template uses cksum function, NOT md5sum.
      The result value from the two item key is different; number for cksum and character for md5sum.

      Any ideas?

      Comment

      • Rudd
        Member
        • Mar 2011
        • 69

        #4
        Sorry, I probably picked a bad example. You want to create an alert when the md5sum of a file changes?

        The relevant part of the trigger is ".diff(0)}>0" where it compares the new string value against the previous one.

        The following works for me:

        {Template_http:vfs.file.md5sum[/var/apache2/www/index.html].diff(0)}>0

        Comment

        • g.vecchi
          Member
          • Dec 2010
          • 44

          #5
          I've tried both ".diff(0)}>0" and "#0" but noone works.
          I'm using Zabbix 1.8.1

          Comment

          • Rudd
            Member
            • Mar 2011
            • 69

            #6
            Can you provide the full Description and Key as they appear in the items of the host, as well as full Name and Expression as they appear in the triggers of that host?

            Comment

            • g.vecchi
              Member
              • Dec 2010
              • 44

              #7
              [solved]

              I'm really sorry guys, it works great!
              I forgot to set trigger severity, so Zabbix didn't notify me.

              It's all OK.

              The item key is:

              vfs.file.md5sum[/var/www/index.html]

              and the trigger key is:

              {server001:vfs.file.md5sum[/var/www/index.html].diff(0)}#0

              Thanks to all!
              Bye

              Comment

              • Rudd
                Member
                • Mar 2011
                • 69

                #8
                Sweet, thanks for providing the solution.

                Comment

                Working...