Skip to content
This repository has been archived by the owner on Jun 29, 2019. It is now read-only.

Commit

Permalink
quick bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lloydpick committed May 9, 2011
1 parent 0a0de7f commit 31a0c77
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/impulse.rb
Expand Up @@ -28,15 +28,15 @@ def draw(name, time_scale = :day, params = {})
c = 0
name.each do |k,v|
v = { :color => '#FF0000', :data => :data }.merge(v)
cmd << "DEF:d#{c}=./#{v[:name]}.rrd:#{v[:data].to_s}:MAX"
cmd << "DEF:d#{c}=#{v[:name]}.rrd:#{v[:data].to_s}:MAX"
cmd << "LINE1:d#{c}#{v[:color]}:'#{k}' GPRINT:d#{c}:LAST:\"Last\\:%8.0lf\" GPRINT:d#{c}:MIN:\" Min\\:%8.0lf\" GPRINT:d#{c}:AVERAGE:\" Avg\\:%8.0lf\" GPRINT:d#{c}:MAX:\" Max\\:%8.0lf\\n\""
c += 1
end
else
cmd << "DEF:average=./#{name}.rrd:data:MAX"
cmd << "DEF:average=#{name}.rrd:data:MAX"
cmd << "LINE1:average#FF0000:'#{params[:legend]}' GPRINT:average:LAST:\"Last\\:%8.0lf\" GPRINT:average:MIN:\" Min\\:%8.0lf\" GPRINT:average:AVERAGE:\" Avg\\:%8.0lf\" GPRINT:average:MAX:\" Max\\:%8.0lf\\n\""
end

system cmd.join(" ")
end

Expand All @@ -58,7 +58,7 @@ def create_or_find_rrd(name, datas)
end

def push_to_rrd(name, data)
unless File.exist?(name + ".rrd")
if File.exist?(name + ".rrd")
puts 'Updating RRD' if @debug
system "rrdtool update #{name}.rrd #{Time.now.to_i}:#{data}"
end
Expand Down

0 comments on commit 31a0c77

Please sign in to comment.