Ad Widget

Collapse

Possible to detect when item last changed to set value?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jason
    Senior Member
    • Nov 2007
    • 430

    #1

    Possible to detect when item last changed to set value?

    I'd like to be able to detect how long since the value of an item last changed to a set value...

    i.e Item1 changes from 0 to 1
    sometime later Item1 changes back from 1 to 0

    A trigger that reports the time since the last change from 0 to 1 or 1 to 0.

    Is this possible?
  • richlv
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Oct 2005
    • 3112

    #2
    i might be wrong, but i don't think that's possible currently.
    might make for a decent feature request, but one would need to think how to make this user friendly and efficient
    Zabbix 3.0 Network Monitoring book

    Comment

    • Jason
      Senior Member
      • Nov 2007
      • 430

      #3
      Surely it'd be done as something like

      item.lastchange(from,to) and would return the time in seconds since that point or either 0 or -1 if it's not found. You'd probably only monitor data as it came in and so then its just a question of checking the last 2 values and then store a double with the date and time and then just a diff between that and the current time?

      Comment

      • richlv
        Senior Member
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Oct 2005
        • 3112

        #4
        this would require a little bit more sophistication - you might have 2, 1, thousands of 0, then 2. and now you have a trigger "when did it last change from 2 to 1".

        returned time would be unix timestamp for sure
        Zabbix 3.0 Network Monitoring book

        Comment

        • Jason
          Senior Member
          • Nov 2007
          • 430

          #5
          But surely if it changed from 1 to 2 with something else inbetween then its not the change you're looking for?

          Alternatively,

          Item.LastChange(From,To,NumValues) where the change From to To has to happen within ValueNum values? NumValues is an optional parameter...

          Comment

          • richlv
            Senior Member
            Zabbix Certified Trainer
            Zabbix Certified SpecialistZabbix Certified Professional
            • Oct 2005
            • 3112

            #6
            Originally posted by Jason
            But surely if it changed from 1 to 2 with something else inbetween then its not the change you're looking for?
            why not ?
            the expression you suggested was lastchange(from,to) - so if we used lastchange(2,1), it would be exactly that
            Originally posted by Jason
            Item.LastChange(From,To,NumValues) where the change From to To has to happen within ValueNum values? NumValues is an optional parameter...
            that gets even more tricky, as now last period also has to support both time period and number of values (as most functions do).

            i think a couple of use cases for what you want to do could help
            Zabbix 3.0 Network Monitoring book

            Comment

            • Jason
              Senior Member
              • Nov 2007
              • 430

              #7
              I've been working on a script that pulls information out of the SQL database for backup exec and then uses zabbix_sender to send the info back to zabbix. All the agents are on remote servers behind firewalls that I don't want to poke holes in so haven't used the database connection directly, and want to monitor multiple jobs on each BackupExec server.

              Part of the information I pull out and send back is a counter that shows whether job is running or not. Currently the information I send back is an integer that is 1 when running and 0 when not running.

              I'd like to be able to do a trigger to trigger if I've not picked up a job start for over than 24 hours (i.e. the job hasn't run). Currently I'm just using nodata to see the last time any value was reported, but for a job that takes quite a while to run then it is possible to miss a backup job and zabbix not know about it.

              Comment

              • richlv
                Senior Member
                Zabbix Certified Trainer
                Zabbix Certified SpecialistZabbix Certified Professional
                • Oct 2005
                • 3112

                #8
                ok, so i'll to summarise...

                1. data is pushed for a backup job, 1 being 'running' and 0 being 'not running';
                2. requirement is to find out from this data whether a job was started within last 24 hours;
                3. checking for "1" in the last 24 hours is not an option as that would not notice that some backup job has been running for 3 days.

                suggested solution is a trigger that can match a condition when item has changed to a particular value and returns timestamp.

                if i understood this correctly, there's still a chance that one backup job starts right after previous finished, so zabbix would not receive "0" in that case, right ?

                sounds a bit tricky and i'm not sure how resources intensive such a trigger would be, but feel free to file it on the feature request tracker
                Zabbix 3.0 Network Monitoring book

                Comment

                Working...