Discussion:
[rrd-users] RRD Graph downward to 0 date prediction
(too old to reply)
Alexander von Gluck IV
2015-06-26 15:13:54 UTC
Permalink
Good morning,

I'm working through doing a low-disk space prediction (based on slope)
I see a lot of examples floating around of doing a 90% and 100%
prediction, however nothing for 0 prediction.

I'm extremely close to the final prediction and have a nice slope
line... however I just can't seem to get the
prediction date to work:

#{c} is a string such as "storage01"
#.. is a commented out line (this is all ruby)

The final "GPRINT:#{c}warning: 2TB free @ %c\\l:strftime" is the
final prediction
that isn't functioning. (I just get a "-")

# A nice 500GB / 2TB limit red
options.push("LINE1:0")
options.push("AREA:500000000000#FF000044::STACK")
options.push("AREA:2000000000000#FF000022::STACK")
index = 0
counters.each do |c|
options.push("--end", "now+#{range}", "--start",
"now-#{range}")
options.push("--vertical-label", "Space Available")
options.push("DEF:#{c}=#{rrdfile}:#{c}:MIN")
options.push("VDEF:#{c}slope=#{c},LSLSLOPE")
options.push("VDEF:#{c}int=#{c},LSLINT")

options.push("CDEF:#{c}avg=#{c},POP,#{c}slope,COUNT,*,#{c}int,+")
options.push("CDEF:#{c}limit=#{c}avg,2000000000000,0,LIMIT")
options.push("VDEF:#{c}warning=#{c}limit,FIRST")
options.push("LINE2:#{c}#{get_color(index)}cc:#{c}")
options.push("LINE1:#{c}avg#{get_color(index)}cc::dashes=2");
options.push("GPRINT:#{c}:LAST:Available\\: %7.2lf %s\\l")
#options.push("GPRINT:#{metric}:MIN:Min Available\\: %7.2lf
%s")
#options.push("GPRINT:#{metric}:MAX:Max Available\\: %7.2lf
%s\\l")
options.push("GPRINT:#{c}warning: 2TB free @
%c\\l:strftime")
index += 1
end
options.push("--title", "#{(object[:name] or object[:hostname])} -
Disksafe Storage Trending / Last #{range}")
#options.push("--lower-limit", "0", "--upper-limit",
"25000000000000")


Thoughts? Trying to predict when 2TB is going to be all that is
remaining. All data is in bytes.


-- Alex
Steve Shipway
2015-06-28 07:55:33 UTC
Permalink
options.push("VDEF:#{c}warning=#{c}limit,FIRST")
options.push("GPRINT:#{c}warning: 2TB free @%c\\l:strftime")

In the VDEF, did you really mean FIRST (which just takes the first sample in the range) or did you mean MIN?

If you want the time it reaches 0, then MIN would make more sense - and this also has a time component, whereas FIRST does not.

Steve

Steve Shipway
University of Auckland ITS
UNIX Systems Design Lead
***@auckland.ac.nz
Ph: +64 9 373 7599 ext 86487
Alexander von Gluck IV
2015-06-29 13:27:53 UTC
Permalink
Post by Alexander von Gluck IV
options.push("VDEF:#{c}warning=#{c}limit,FIRST")
options.push("GPRINT:#{c}warning: 2TB free
@%c\\l:strftime")
In the VDEF, did you really mean FIRST (which just takes the first
sample in the range) or did you mean MIN?
If you want the time it reaches 0, then MIN would make more sense -
and this also has a time component, whereas FIRST does not.
Steve
Well, ideally I'd want to estimate when only (heh only) 2TB of disk
space is free.
(thus the 2000000000000,0 , 2TB and 0) I see a lot of examples for
estimates
using 90,100 (90% and 100%) and then doing FIRST and LAST VDEF's


I tried going with a MIN VDEF on the limit CDEF however it just breaks
the graph:

Unknown function 'MIN' in VDEF 'storage01warning'
options.push("DEF:#{c}=#{rrdfile}:#{c}:MIN")
options.push("VDEF:#{c}slope=#{c},LSLSLOPE")
options.push("VDEF:#{c}int=#{c},LSLINT")

options.push("CDEF:#{c}avg=#{c},POP,#{c}slope,COUNT,*,#{c}int,+")

options.push("CDEF:#{c}limit=#{c}avg,2000000000000,0,LIMIT")
options.push("VDEF:#{c}warning=#{c}limit,MIN")
options.push("LINE4:#{c}#{get_color(index)}:#{c}")

options.push("LINE1:#{c}avg#{get_color(index)}cc::dashes=6");
Result >> options.push("GPRINT:#{c}:LAST:Available\\: %7.2lf
%s\\l")

I also tried going with a MIN VDEF on the avg CDEF however it also just
breaks:

Unknown function 'MIN' in VDEF 'storage01warning'

options.push("DEF:#{c}=#{rrdfile}:#{c}:MIN")
options.push("VDEF:#{c}slope=#{c},LSLSLOPE")
options.push("VDEF:#{c}int=#{c},LSLINT")

options.push("CDEF:#{c}avg=#{c},POP,#{c}slope,COUNT,*,#{c}int,+")

options.push("CDEF:#{c}limit=#{c}avg,2000000000000,0,LIMIT")
options.push("VDEF:#{c}warning=#{c}avg,MIN")
options.push("LINE4:#{c}#{get_color(index)}:#{c}")

options.push("LINE1:#{c}avg#{get_color(index)}cc::dashes=6");
Result >> options.push("GPRINT:#{c}:LAST:Available\\: %7.2lf
%s\\l")


At this point getting and estimated date @ 2TB and 0TB would replace a
lot of manual work :P

A reference I've used so far:
http://hints.jeb.be/2009/12/04/trend-prediction-with-rrdtool/

-- Alex
Steve Shipway
2015-06-29 22:13:24 UTC
Permalink
Post by Alexander von Gluck IV
Unknown function 'MIN' in VDEF 'storage01warning'
The VDEF function is MAXIMUM or MINIMUM (not MAX and MIN)
http://oss.oetiker.ch/rrdtool/doc/rrdgraph_rpn.en.html

The abbreviated form is used in create statements. Makes things confusing,
maybe Tobi should allow both abbreviated and full forms :)

Steve

Steve Shipway
***@auckland.ac.nz
Alexander von Gluck IV
2015-07-01 13:33:57 UTC
Permalink
Post by Steve Shipway
Post by Alexander von Gluck IV
Unknown function 'MIN' in VDEF 'storage01warning'
The VDEF function is MAXIMUM or MINIMUM (not MAX and MIN)
http://oss.oetiker.ch/rrdtool/doc/rrdgraph_rpn.en.html
The abbreviated form is used in create statements. Makes things
confusing,
maybe Tobi should allow both abbreviated and full forms :)
Steve
Steve Shipway
Hm, this doesn't help any. Now I do get a date, but it is just the end
date of the graph...

Result:
http://imagebin.ca/v/278T8G2Hy6oQ

Code:

options.push("--end", "now+#{range}", "--start", "now-#{range}")
options.push("--vertical-label", "Space Available")
options.push("DEF:#{c}=#{rrdfile}:#{c}:MIN")
options.push("VDEF:#{c}slope=#{c},LSLSLOPE")
options.push("VDEF:#{c}int=#{c},LSLINT")
options.push("CDEF:#{c}avg=#{c},POP,#{c}slope,COUNT,*,#{c}int,+")
options.push("CDEF:#{c}limit=#{c}avg,0,2000000000000,LIMIT")
options.push("VDEF:#{c}warning=#{c}avg,MINIMUM")
options.push("LINE4:#{c}#{get_color(index)}:#{c}")
options.push("LINE1:#{c}avg#{get_color(index)}cc::dashes=6");
options.push("GPRINT:#{c}:LAST:Available\\: %7.2lf %s\\l")
options.push("GPRINT:#{c}warning: 2TB free @ %c\\l:strftime")

If I scale the timeout to past the slope meeting 0 MINIMUM still
follows the end date of the graph :-\
Steve Shipway
2015-07-01 21:30:35 UTC
Permalink
Post by Alexander von Gluck IV
Hm, this doesn't help any. Now I do get a date, but it is just the end
date of
Post by Alexander von Gluck IV
the graph...
...
Post by Alexander von Gluck IV
options.push("DEF:#{c}=#{rrdfile}:#{c}:MIN")
options.push("VDEF:#{c}slope=#{c},LSLSLOPE")
options.push("VDEF:#{c}int=#{c},LSLINT")
options.push("CDEF:#{c}avg=#{c},POP,#{c}slope,COUNT,*,#{c}int,+")
options.push("CDEF:#{c}limit=#{c}avg,0,2000000000000,LIMIT")
options.push("VDEF:#{c}warning=#{c}avg,MINIMUM")
You are using the wrong cdef in your warning definition! So, of course you
get the end time of the graph...

options.push("VDEF:#{c}warning=#{c}limit,MINIMUM")

Define your warning on the limited CDEF. Now, #{c}limit becomes unknown
when #{c}avg drops below 0. Therefore, the minimum value of #{c}warning
must be 0 (if it reaches 0) and so the strftime for this point will be the
time it hits 0.

Steve

Steve Shipway
***@auckland.ac.nz
Alexander von Gluck IV
2015-07-01 21:38:43 UTC
Permalink
Post by Alexander von Gluck IV
Post by Alexander von Gluck IV
Hm, this doesn't help any. Now I do get a date, but it is just the end
date of
Post by Alexander von Gluck IV
the graph...
...
Post by Alexander von Gluck IV
options.push("DEF:#{c}=#{rrdfile}:#{c}:MIN")
options.push("VDEF:#{c}slope=#{c},LSLSLOPE")
options.push("VDEF:#{c}int=#{c},LSLINT")
options.push("CDEF:#{c}avg=#{c},POP,#{c}slope,COUNT,*,#{c}int,+")
options.push("CDEF:#{c}limit=#{c}avg,0,2000000000000,LIMIT")
options.push("VDEF:#{c}warning=#{c}avg,MINIMUM")
You are using the wrong cdef in your warning definition! So, of course
you
get the end time of the graph...
options.push("VDEF:#{c}warning=#{c}limit,MINIMUM")
Define your warning on the limited CDEF. Now, #{c}limit becomes
unknown
when #{c}avg drops below 0. Therefore, the minimum value of
#{c}warning
must be 0 (if it reaches 0) and so the strftime for this point will be
the
time it hits 0.
No luck, now I'm back where I started :-) warning / strftime is "-"

options.push("--end", "now+#{range}", "--start", "now-#{range}")
options.push("--vertical-label", "Space Available")
options.push("DEF:#{c}=#{rrdfile}:#{c}:MIN")
options.push("VDEF:#{c}slope=#{c},LSLSLOPE")
options.push("VDEF:#{c}int=#{c},LSLINT")
options.push("CDEF:#{c}avg=#{c},POP,#{c}slope,COUNT,*,#{c}int,+")
options.push("CDEF:#{c}limit=#{c}avg,0,2000000000000,LIMIT")
options.push("VDEF:#{c}warning=#{c}limit,MINIMUM")
options.push("LINE4:#{c}#{get_color(index)}:#{c}")
options.push("LINE1:#{c}avg#{get_color(index)}cc::dashes=6");
options.push("GPRINT:#{c}:LAST:Available\\: %7.2lf %s\\l")
options.push("GPRINT:#{c}warning: 2TB free @ %c\\l:strftime")

Thanks!

-- Alex

Loading...