def last_rrd_count
  val = 0.0
  handle = IO.popen("rrdtool lastupdate power.rrd")
  handle.each_line do |line|
    m = line.match("^[0-9]*: ([0-9.]*) [0-9.]*")
    if m
      val = m[1].to_f
      break
    end
  end
  return val
end

puts last_rrd_count
