Skip to content
Browse files

Add support for dashed lines

Improve color handling
Fix some new 0.9.9 graphite weirdness where mw*foo is not the same as mw*.foo
  • Loading branch information...
1 parent 6910e89 commit 2df9a74a0a59ee6e982017f9b5efaf5af68c5365 @ripienaar ripienaar committed Oct 15, 2011
Showing with 6 additions and 5 deletions.
  1. +5 −4 lib/graphite_graph.rb
  2. +1 −1 sample/email/cpu.graph
View
9 lib/graphite_graph.rb
@@ -8,12 +8,14 @@
#
# field :foo, :data => "some.data.item",
# :derivative => false,
+# :dashed => true,
# :color => "yellow"
#
# service :munin, :cpu do
# # this takes <host>.munin.cpu.idle
# field :idle, :derivative => true,
# :scale => 0.001,
+# :dashed => true,
# :color => "blue"
# end
#
@@ -125,14 +127,13 @@ def url(format = nil)
graphite_target = "alias(#{graphite_target},\"#{name.to_s.capitalize}\")"
end
+ graphite_target = "color(#{graphite_target},\"#{target[:color]}\")" if target[:color]
+ graphite_target = "dashed(#{graphite_target})" if target[:dashed]
+
url_parts << "target=#{graphite_target}"
end
-
- colors << target[:color] if target[:color]
end
- url_parts << "colorList=#{colors.join(",")}" unless colors.empty?
-
url_parts << "format=#{format}" if format
url_parts.join("&")
View
2 sample/email/cpu.graph
@@ -6,7 +6,7 @@ description "The combined CPU usage for all Exim Anti Spam servers"
field :iowait, :scale => 0.001,
:color => "red",
:alias => "IO Wait",
- :data => "sumSeries(derivative(mw*munin.cpu.iowait))"
+ :data => "sumSeries(derivative(mw*.munin.cpu.iowait))"
field :system, :scale => 0.001,
:color => "orange",

0 comments on commit 2df9a74

Please sign in to comment.
Something went wrong with that request. Please try again.