[rrd-users] Huge memory usage of rrdtool

Masahiko KIMOTO kimoto at ohnolab.org
Fri Apr 23 04:11:21 CEST 2010


Hello Tobi,

# i'm resending this mail. possibly attached files are not acceptable
# in this list?

 > if you could provide a simple rrd file and the graphing
 > instructions you use (just as atext file), this would helpful
 > for debugging this problem.

We wrote two small programs, gen_test.rb for generating RRD, graph_test.rb
for generating graph.
Both are the followings,

Regards,

gen_test.rb:
---------------------------------------------------------------------------
#!/usr/local/bin/ruby

$rrdtool="/usr/local/bin/rrdtool"

def pipe_run()

  rrd=open("|#{$rrdtool} -","w+")

  message =
    "create test.rrd " +
    "--step 1 "+
    "DS:Watt:GAUGE:600:0:U "+
    "DS:Voltage:GAUGE:600:0:U "+
    "DS:Current:GAUGE:600:0:U "+
    "RRA:AVERAGE:0.5:1:3600 "+
    "RRA:AVERAGE:0.5:60:1440 "+
    "RRA:AVERAGE:0.5:600:1008 "+
    "RRA:AVERAGE:0.5:3600:720 "+
    "RRA:AVERAGE:0.5:86400:365"
  rrd.puts(message)

  for i in (0 .. 10000) 
    now=Time.now().to_i + i
    start_time=now-1024
    val = rand(100).to_i
    rrd.puts("update test.rrd #{now}:#{val}:#{val}:#{val}")
    line=rrd.gets()
    print line
  end
end

pipe_run()


---------------------------------------------------------------------------

graph_test.rb:
---------------------------------------------------------------------------
#!/usr/local/bin/ruby

#$rrdtool="/usr/local/bin/rrdtool"
$rrdtool="/local/home/kimoto/source/rrdtool-1.4.3/src/rrdtool"

def pipe_run()

  rrd=open("|#{$rrdtool} -","w+")

  loop {
    now=Time.now().to_i
    start_time=now-1024
    rrd.puts("graph test.png --start #{start_time} --end #{now} DEF:a=test.rrd:Watt:AVERAGE LINE1:a#FF0000:in")
    line=rrd.gets()
    print line
    line=rrd.gets()
    print line
    sleep 1
  }
end

pipe_run()

---------------------------------------------------------------------------

----------------------------------------------------------------------
Masahiko KIMOTO, Ph. D.
E-mail: kimoto at ohnolab.org        URL: http://www.ohnolab.org/~kimoto



More information about the rrd-users mailing list