Ad Widget

Collapse

Calculate sum of values since a particular time?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dougbee
    Member
    • Apr 2011
    • 68

    #1

    Calculate sum of values since a particular time?

    Odds are this is simple and I'm not thinking clearly at the moment. But I'd like to create a calculated item that sums all the values since a particular time, like 00:00:00.

    The end result would give me items such as "total data today" versus the last 24 hours.

    thanks!
  • Koral
    Member
    • Oct 2012
    • 30

    #2
    Maybe you should create calculated item using sum(1d) function that will only fire once on flexible interval lets say on 23:59:00 and another very similar calculated item but with function sum(1d,1d) (time shifted one day ago) with the same flexible interval ?

    Comment

    • dougbee
      Member
      • Apr 2011
      • 68

      #3
      Hmm, interesting idea. Although I was hoping to have something that I could view the latest data as it accumulates through the day. (So I could look at the item at any given time during the day, and it would give the sum since 00:00.) That way looking at it at 10:00am would show me 10 hours worth of sum, at noon would be 12 hours worth, etc.

      Is there no way to have a calculated item that's based on a timestamp, versus a unit of time?

      Comment

      • supergrey
        Junior Member
        • Feb 2020
        • 1

        #4
        I know that it is an old thread but I am looking for solution. Maybe someone know how to get this working

        Comment

        • wilson.waters
          Junior Member
          • Dec 2012
          • 15

          #5
          Wow good timing, I was just about the write a post with the same question. There are quite a few posts with this requirement on the forums but no real solutions.







          I want to keep a "running daily value" based off a forever increasing counter. Specifically, I want to a calculated item that records daily power consumption from a power meter which only supplies an ever-increasing Wh counter value.

          I've tried to do the same thing with Cisco routers which provide a count of bytes received/sent since reboot. It would be ideal if I could somehow calculate daily/monthly traffic.

          The naive solution - use the last() function with a time shift specifying a specific time. I realise doing this isn't as easy is it sounds. time shift currently only allows you to specify "a day ago", not a specific time like "midnight today" or "start of month".
          The better solution - somehow calculating the integral below the graph for a specific time range. Still have the the problem of specifying a start time and you also need to calculate the integral.

          Comment

          • wilson.waters
            Junior Member
            • Dec 2012
            • 15

            #6
            Typically, after writing this post I actually read it and did a bit more searching and found a solution. This post also has some ideas


            In my case, I created a calculated item with a fixed schedule interval to be stored at 00:00:00 (i.e midnight) every day. Followed by another calculated item to store the difference between last() and last(midnight). This works to give today's energy reading!

            It assumes the "ever increasing counter" never resets back to 0. I've found most counter items (eg cisco byte router counters) reset back to 0 when the device reboots. To handle this situation you'll still need to work out how to calculate the integral below the graph. Sounds like a job for another day!

            You can download the template for this on my githib https://github.com/wilsonwaters/zabbix-fronius

            Click image for larger version

Name:	1.png
Views:	3167
Size:	29.6 KB
ID:	395197


            Followed by a calculated item
            Click image for larger version

Name:	2.png
Views:	3217
Size:	33.2 KB
ID:	395198

            Comment

            Working...