graphite_graph 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/lib/graphite_graph/version.rb +1 -1
- data/lib/graphite_graph.rb +20 -3
- metadata +40 -26
- data/Gemfile.lock +0 -14
data/.gitignore
CHANGED
data/lib/graphite_graph.rb
CHANGED
@@ -37,10 +37,13 @@ class GraphiteGraph
|
|
37
37
|
:fontsize => nil,
|
38
38
|
:fontbold => false,
|
39
39
|
:timezone => nil,
|
40
|
+
:background_color => nil,
|
41
|
+
:foreground_color => nil,
|
40
42
|
:draw_null_as_zero => false,
|
41
43
|
:major_grid_line_color => nil,
|
42
44
|
:minor_grid_line_color => nil,
|
43
|
-
:area => :none
|
45
|
+
:area => :none,
|
46
|
+
:placeholders => nil}.merge(@overrides)
|
44
47
|
end
|
45
48
|
|
46
49
|
def [](key)
|
@@ -270,6 +273,8 @@ class GraphiteGraph
|
|
270
273
|
url_parts << "tz=#{properties[:timezone]}" if properties[:timezone]
|
271
274
|
url_parts << "majorGridLineColor=#{properties[:major_grid_line_color]}" if properties[:major_grid_line_color]
|
272
275
|
url_parts << "minorGridLineColor=#{properties[:minor_grid_line_color]}" if properties[:minor_grid_line_color]
|
276
|
+
url_parts << "bgcolor=#{properties[:background_color]}" if properties[:background_color]
|
277
|
+
url_parts << "fgcolor=#{properties[:foreground_color]}" if properties[:foreground_color]
|
273
278
|
|
274
279
|
target_order.each do |name|
|
275
280
|
target = targets[name]
|
@@ -282,6 +287,7 @@ class GraphiteGraph
|
|
282
287
|
graphite_target = target[:data]
|
283
288
|
|
284
289
|
graphite_target = "derivative(#{graphite_target})" if target[:derivative]
|
290
|
+
graphite_target = "highestAverage(#{graphite_target},#{target[:highest_average]})" if target[:highest_average]
|
285
291
|
graphite_target = "scale(#{graphite_target},#{target[:scale]})" if target[:scale]
|
286
292
|
graphite_target = "drawAsInfinite(#{graphite_target})" if target[:line]
|
287
293
|
graphite_target = "movingAverage(#{graphite_target},#{target[:smoothing]})" if target[:smoothing]
|
@@ -291,11 +297,19 @@ class GraphiteGraph
|
|
291
297
|
graphite_target = "secondYAxis(#{graphite_target})" if target[:second_y_axis]
|
292
298
|
|
293
299
|
unless target.include?(:subgroup)
|
294
|
-
if target[:
|
300
|
+
if target[:alias_by_node]
|
301
|
+
graphite_target = "aliasByNode(#{graphite_target},#{target[:alias_by_node]})"
|
302
|
+
elsif target[:alias]
|
295
303
|
graphite_target = "alias(#{graphite_target},\"#{target[:alias]}\")"
|
296
304
|
else
|
297
305
|
graphite_target = "alias(#{graphite_target},\"#{name.to_s.capitalize}\")"
|
298
306
|
end
|
307
|
+
|
308
|
+
if target[:cacti_style]
|
309
|
+
graphite_target = "cactiStyle(#{graphite_target})"
|
310
|
+
elsif target[:legend_value]
|
311
|
+
graphite_target = "legendValue(#{graphite_target},\"#{target[:legend_value]}\")"
|
312
|
+
end
|
299
313
|
end
|
300
314
|
|
301
315
|
url_parts << "target=#{graphite_target}"
|
@@ -305,7 +319,10 @@ class GraphiteGraph
|
|
305
319
|
url_parts << "format=#{format}" if format
|
306
320
|
|
307
321
|
if url
|
308
|
-
|
322
|
+
url_str = url_parts.join("&")
|
323
|
+
properties[:placeholders].each { |k,v| url_str.gsub!("%{#{k}}", v.to_s) } if properties[:placeholders].is_a?(Hash)
|
324
|
+
|
325
|
+
URI.encode(url_str)
|
309
326
|
else
|
310
327
|
url_parts
|
311
328
|
end
|
metadata
CHANGED
@@ -1,30 +1,39 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphite_graph
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- R.I.Pienaar
|
9
14
|
- Tom Taylor
|
10
15
|
autorequire:
|
11
16
|
bindir: bin
|
12
17
|
cert_chain: []
|
13
|
-
|
18
|
+
|
19
|
+
date: 2012-04-15 00:00:00 +01:00
|
20
|
+
default_executable:
|
14
21
|
dependencies: []
|
22
|
+
|
15
23
|
description:
|
16
|
-
email:
|
24
|
+
email:
|
17
25
|
- rip@devco.net
|
18
26
|
- tom@tomtaylor.co.uk
|
19
|
-
executables:
|
27
|
+
executables:
|
20
28
|
- check_graph.rb
|
21
29
|
extensions: []
|
30
|
+
|
22
31
|
extra_rdoc_files: []
|
23
|
-
|
32
|
+
|
33
|
+
files:
|
24
34
|
- .gitignore
|
25
35
|
- COPYING
|
26
36
|
- Gemfile
|
27
|
-
- Gemfile.lock
|
28
37
|
- README.md
|
29
38
|
- Rakefile
|
30
39
|
- bin/check_graph.rb
|
@@ -58,34 +67,39 @@ files:
|
|
58
67
|
- samples/monitoring/monitor.png
|
59
68
|
- samples/thresholds/thresholds.graph
|
60
69
|
- samples/thresholds/thresholds.png
|
70
|
+
has_rdoc: true
|
61
71
|
homepage: https://github.com/ripienaar/graphite-graph-dsl
|
62
72
|
licenses: []
|
73
|
+
|
63
74
|
post_install_message:
|
64
75
|
rdoc_options: []
|
65
|
-
|
76
|
+
|
77
|
+
require_paths:
|
66
78
|
- lib
|
67
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
80
|
none: false
|
69
|
-
requirements:
|
70
|
-
- -
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
|
73
|
-
segments:
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
hash: 3
|
85
|
+
segments:
|
74
86
|
- 0
|
75
|
-
|
76
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
version: "0"
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
89
|
none: false
|
78
|
-
requirements:
|
79
|
-
- -
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
|
82
|
-
segments:
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
hash: 3
|
94
|
+
segments:
|
83
95
|
- 0
|
84
|
-
|
96
|
+
version: "0"
|
85
97
|
requirements: []
|
98
|
+
|
86
99
|
rubyforge_project: graphite_graph
|
87
|
-
rubygems_version: 1.
|
100
|
+
rubygems_version: 1.3.7
|
88
101
|
signing_key:
|
89
102
|
specification_version: 3
|
90
103
|
summary: DSL for generating Graphite graphs
|
91
104
|
test_files: []
|
105
|
+
|