Ad Widget

Collapse

Calculated Item using current timestamp and sysUptime values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • christiananton
    Junior Member
    • Sep 2016
    • 4

    #1

    Calculated Item using current timestamp and sysUptime values

    Hi folks,

    this is my very first question in this forum. I am stumbling over how to design a Calculated Item for a specific case that I need. It's a Cisco device we are talking about.

    I have two items that fetch values by SNMP:

    - "sysUpTime" - uptime of a a system in 100ths of seconds, with a custom multiplier of 0.01 set so that in fact this value is the amount of seconds the device is "UP", fetched every 5 minutes.

    - "lastConfigChange" - the value of "sysUpTime" at the moment of the last configuration change, also fetched every 5 minutes.

    as a formula, this would look something like that:

    now("sysUpTime") - last("sysUpTime") + last("lastConfigChange")


    What I need is a value that indicates either the unixtime that defines the exact date and hour when the configuration change was issued, or the amount of seconds that this event was ago. Preferably, the first.

    So, basically I can calculate it in the following manner:

    Unix-Timestamp NOW() (in seconds) MINUS "sysUpTime" PLUS "lastConfigChange" gives me the point in time that the configuration change happened.


    My problem now is that this value will vary depending on which of the items is calculated when. If I generate a calculated item that realizes the above mentioned logic, it will not be exact: sysUpTime increases by 5 minutes every time the check is issued, so that the correct way to calculate the exact time of config change would be something like:

    Unix-Timestamp of last poll of "sysUpTime" MINUS "sysUpTime" PLUS "lastConfigChange"

    This, in theory should give a defined result that only changes if "lastConfigChange" changges, not moving up and down depending on the current time.

    Now, I have no idea whether it is possible how to access the "time of last poll" of an item from within a calculated item formula. Any ideas? Any suggestions to solve this differently?


    Thanks a lot!


    Christian
  • Colttt
    Senior Member
    Zabbix Certified Specialist
    • Mar 2009
    • 878

    #2
    take a look into last and previous..

    something like:
    Code:
    last("sysUpTime") - prev("sysUpTime") + last("lastConfigChange")
    Debian-User

    Sorry for my bad english

    Comment

    • christiananton
      Junior Member
      • Sep 2016
      • 4

      #3
      Originally posted by Colttt
      take a look into last and previous..

      something like:
      Code:
      last("sysUpTime") - prev("sysUpTime") + last("lastConfigChange")
      Hi Colttt,

      thanks for your reply.

      Actually, I am not sure how this could solve my problem. Maybe you could explain a but more in detail?

      the term
      Code:
      last("sysUpTime") - prev("sysUpTime")
      would always return a value of 300 seconds ( 5 minutes ) which is the amount of time between the two checks. But how would this, added to the latest value of sysUptime (which is a number of seconds a device is up) give me the answer of what I am searching for, considering that lastConfigChange is the value of sysUpTime at the moment that the config change happened?


      Cheers


      Christian

      Comment

      • christiananton
        Junior Member
        • Sep 2016
        • 4

        #4
        I have now solved this case by implementing a custom script that is triggered with one of the items, fetches all the needed values at once, calculates the needed timestamps and pushes all calculated values back into Zabbix via the Zabbix Sender method.
        With this method I have all the values within the same time, can calculate all belonging values against each other and have all of the items belonging to this fed with data at the same time.

        Works neatly


        Christian

        Comment

        Working...