Ad Widget

Collapse

Sawtooth wave

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zubkov
    Junior Member
    Zabbix Certified Specialist
    • Nov 2013
    • 2

    #1

    Sawtooth wave

    Hello dear Zabbix users,

    Can you please help me with following task:
    I'd like to draw a sawtooth graph using a calculated item
    which adds the last value from an item till the end of a day and at 12pm resets the value to 0 and then starts to add all values from an item again.
    So it look's like this:

    I already tried to achieve that by using the date macro but according to the documentation it doesn't work.

    Do you have any hint?

    Thank you in advance

    Cheers

    Alex
  • aib
    Senior Member
    • Jan 2014
    • 1615

    #2
    First, I want to say that your diagram is for different function:
    - at 12pm set x=2
    - every time subtract the last value from an item till the end of a day.

    For you formula the calculated Item can be done only by using external scripts.
    - cron will call the external script every 24 hours. that external script will use zabbix_sender to send "0" into your Item "x"
    - calculated Item "x" will have formula: (if you would like to increase "x" by adding value of "y")
    Code:
    last(x)+last(y)
    Then you can create a graph for "x"
    Sincerely yours,
    Aleksey

    Comment

    • zubkov
      Junior Member
      Zabbix Certified Specialist
      • Nov 2013
      • 2

      #3
      Hello Aleksey,
      Thank you very much for your reply.
      Yes you are totally right. The function in the graph is wrong. But I'm glad you understood what I want to achieve anyways.

      Your solution is actually the same I'm having in mind. But we try not to use external scripts especially the ones being triggered by cron jobs or any other scheduling scripts to keep our dependencies flat.

      So the idea was to use the date macro and an if clause approximately like this:
      {lastvalue(0)date - lastvalue(1).date = 0} last(x)+last(y) * 1 | {lastvalue(0)date - lastvalue(1).date != 0} last(x)+last(y) * 0

      But for some reasons I can't find the right syntax for this.

      Cheers

      Alex

      Comment

      • aib
        Senior Member
        • Jan 2014
        • 1615

        #4
        I never heard about "if" statement in formulas.
        Sorry, I cannot help you.
        Sincerely yours,
        Aleksey

        Comment

        Working...