public/de.wigbels.ruby/hothotread/archiv/lastupdate.rb

15 lines
256 B
Ruby
Raw Permalink Normal View History

2025-02-08 16:53:10 +01:00
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