Ad Widget

Collapse

Need help for a logfile trigger

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • steveboyson
    Senior Member
    • Jul 2013
    • 582

    #1

    Need help for a logfile trigger

    Hi all,
    I need some help constructing a trigger against an item of type "Log".

    The "log time format" is set to "yyyy-MM-dd hh:mm:ss", I have correct values of "2013-09-12 09:00:13" and similar.


    I want to create a trigger when the "lastvalue" for that trigger is older than 1 day (86400 seconds).

    What is the correct trigger expression?

    Thanks and any hints are appreciated!
  • steveboyson
    Senior Member
    • Jul 2013
    • 582

    #2
    Up!

    Nobody has an idea? Come on folks, please!

    Comment

    • kmaslowski
      Junior Member
      • Sep 2013
      • 4

      #3
      Maybe check file modification time instead.

      Comment

      • steveboyson
        Senior Member
        • Jul 2013
        • 582

        #4
        We are using vSphere Data Protection appliance from Vmware for backups of our virtual machines. Therefore I wrote a fairly complex logfile parser where my item value is originating from.

        It returns - besides many other values - the last backup date for a particular system.

        So I want to get notified whenever a "lastvalue" is older than "XXX" time units meaning whenever a succesfull backup is older than lets say one day.

        Comment

        • chojin
          Member
          Zabbix Certified Specialist
          • Jul 2011
          • 64

          #5
          I understand that you have a script that returns many values to different host-items (using the agent or sender/trapper) and one of them is the last successful backup date?

          In this case you will have to convert your last backup date that you send to zabbix into unixtime (seconds elapsed since epoch) So that you have a host item containing the unixtime of the last successful backup.
          That item can now be used in a trigger using the fuzzytime or now functions

          Code:
          {host:last_successful_backup.fuzzytime(86400)}=0
          or
          Code:
          {host:last_successful_backup.now(0)} - {host:last_succesfull_backup.last(0)} > 86400
          Conversion of the timestamp into unixtime can be done with the linux command line utility: date

          Code:
          $ date -d "2012-05-01 22:03:10" +%s
          1335902590
          Last edited by chojin; 30-09-2013, 23:16.

          Comment

          • steveboyson
            Senior Member
            • Jul 2013
            • 582

            #6
            Thank you very much.

            This is quite exactly the way I implemented it. The script returns the delta in seconds between last backup date (extracted from logfile) and the current script run date/time
            .
            Then I have a trigger which checks that returned value against different conditions.

            I wish Zabbix would have a "timeconvert" function just built in.

            Thanks again.

            Comment

            • gavind
              Member
              • Mar 2013
              • 59

              #7
              {host:last_successful_backup.fuzzytime(86400)}=0
              This worked well for me. My boss was actually amazed! Thanks.

              Comment

              Working...