1 |
matsuu 10/03/02 12:11:55 |
2 |
|
3 |
Added: puppet-0.25.4-r1-rrd.patch |
4 |
Removed: puppet-0.25.4-rrd.patch |
5 |
puppet-0.25.0-cert-names.patch |
6 |
puppet-0.25.1-eix-0.18.patch |
7 |
Log: |
8 |
Fixed rrd issue again, bug #294304. Removed old versions. |
9 |
(Portage version: 2.1.7.17/cvs/Linux x86_64) |
10 |
|
11 |
Revision Changes Path |
12 |
1.1 app-admin/puppet/files/puppet-0.25.4-r1-rrd.patch |
13 |
|
14 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-admin/puppet/files/puppet-0.25.4-r1-rrd.patch?rev=1.1&view=markup |
15 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-admin/puppet/files/puppet-0.25.4-r1-rrd.patch?rev=1.1&content-type=text/plain |
16 |
|
17 |
Index: puppet-0.25.4-r1-rrd.patch |
18 |
=================================================================== |
19 |
diff -Naur puppet-0.25.4.orig//lib/puppet/feature/base.rb puppet-0.25.4//lib/puppet/feature/base.rb |
20 |
--- puppet-0.25.4.orig//lib/puppet/feature/base.rb 2010-01-28 12:48:33.000000000 +0900 |
21 |
+++ puppet-0.25.4//lib/puppet/feature/base.rb 2010-02-28 11:36:28.000000000 +0900 |
22 |
@@ -27,7 +27,7 @@ |
23 |
Puppet.features.add(:augeas, :libs => ["augeas"]) |
24 |
|
25 |
# We have RRD available |
26 |
-Puppet.features.add(:rrd, :libs => ["RRDtool"]) |
27 |
+Puppet.features.add(:rrd, :libs => ["RRD"]) |
28 |
|
29 |
# We have OpenSSL |
30 |
Puppet.features.add(:openssl, :libs => ["openssl"]) |
31 |
diff -Naur puppet-0.25.4.orig//lib/puppet/reports/rrdgraph.rb puppet-0.25.4//lib/puppet/reports/rrdgraph.rb |
32 |
--- puppet-0.25.4.orig//lib/puppet/reports/rrdgraph.rb 2010-01-28 12:48:34.000000000 +0900 |
33 |
+++ puppet-0.25.4//lib/puppet/reports/rrdgraph.rb 2010-02-28 11:35:34.000000000 +0900 |
34 |
@@ -1,12 +1,13 @@ |
35 |
Puppet::Reports.register_report(:rrdgraph) do |
36 |
desc "Graph all available data about hosts using the RRD library. You |
37 |
must have the Ruby RRDtool library installed to use this report, which |
38 |
- you can get from `the RubyRRDTool RubyForge page`_. This package may also |
39 |
- be available as ``ruby-rrd`` or ``rrdtool-ruby`` in your distribution's package |
40 |
+ is bundled in RRDtool, which you can get from `the RRDTool homepage`_. |
41 |
+ This package may also be available as ``librrd-ruby``, ``ruby-rrd`` or |
42 |
+ ``rrdtool-ruby`` in your distribution's package |
43 |
management system. The library and/or package will both require the binary |
44 |
``rrdtool`` package from your distribution to be installed. |
45 |
|
46 |
- .. _the RubyRRDTool RubyForge page: http://rubyforge.org/projects/rubyrrdtool/ |
47 |
+ .. _the RRDTool homepage: http://oss.oetiker.ch/rrdtool/download.en.html |
48 |
|
49 |
This report will create, manage, and graph RRD database files for each |
50 |
of the metrics generated during transactions, and it will create a |
51 |
diff -Naur puppet-0.25.4.orig//lib/puppet/util/metric.rb puppet-0.25.4//lib/puppet/util/metric.rb |
52 |
--- puppet-0.25.4.orig//lib/puppet/util/metric.rb 2010-01-28 12:48:34.000000000 +0900 |
53 |
+++ puppet-0.25.4//lib/puppet/util/metric.rb 2010-03-02 20:19:40.000000000 +0900 |
54 |
@@ -31,7 +31,6 @@ |
55 |
|
56 |
start ||= Time.now.to_i - 5 |
57 |
|
58 |
- @rrd = RRDtool.new(self.path) |
59 |
args = [] |
60 |
|
61 |
values.each { |value| |
62 |
@@ -42,14 +41,17 @@ |
63 |
args.push "RRA:AVERAGE:0.5:1:300" |
64 |
|
65 |
begin |
66 |
- @rrd.create( Puppet[:rrdinterval].to_i, start, args) |
67 |
+ RRD.create(self.path, |
68 |
+ "--start", start.to_s, |
69 |
+ "--step", Puppet[:rrdinterval].to_i, |
70 |
+ *args) |
71 |
rescue => detail |
72 |
raise "Could not create RRD file %s: %s" % [path,detail] |
73 |
end |
74 |
end |
75 |
|
76 |
def dump |
77 |
- puts @rrd.info |
78 |
+ puts RRD.info(self.path) |
79 |
end |
80 |
|
81 |
def graph(range = nil) |
82 |
@@ -84,12 +86,12 @@ |
83 |
if range |
84 |
args.push("--start",range[0],"--end",range[1]) |
85 |
else |
86 |
- args.push("--start", Time.now.to_i - time, "--end", Time.now.to_i) |
87 |
+ args.push("--start", (Time.now.to_i - time).to_s, "--end", Time.now.to_i.to_s) |
88 |
end |
89 |
|
90 |
begin |
91 |
- #Puppet.warning "args = #{args}" |
92 |
- RRDtool.graph( args ) |
93 |
+ #Puppet.warning "args = #{args.join("|")}" |
94 |
+ RRD.graph( * args ) |
95 |
rescue => detail |
96 |
Puppet.err "Failed to graph %s: %s" % [self.name,detail] |
97 |
end |
98 |
@@ -122,7 +124,6 @@ |
99 |
self.create(time - 5) |
100 |
end |
101 |
|
102 |
- @rrd ||= RRDtool.new(self.path) |
103 |
|
104 |
# XXX this is not terribly error-resistant |
105 |
args = [time] |
106 |
@@ -135,7 +136,9 @@ |
107 |
arg = args.join(":") |
108 |
template = temps.join(":") |
109 |
begin |
110 |
- @rrd.update( template, [ arg ] ) |
111 |
+ RRD.update(self.path, |
112 |
+ "--template", template, |
113 |
+ arg ) |
114 |
#system("rrdtool updatev %s '%s'" % [self.path, arg]) |
115 |
rescue => detail |
116 |
raise Puppet::Error, "Failed to update %s: %s" % [self.name,detail] |
117 |
diff -Naur puppet-0.25.4.orig//spec/unit/util/metric.rb puppet-0.25.4//spec/unit/util/metric.rb |
118 |
--- puppet-0.25.4.orig//spec/unit/util/metric.rb 2010-01-28 12:48:34.000000000 +0900 |
119 |
+++ puppet-0.25.4//spec/unit/util/metric.rb 2010-02-28 11:35:34.000000000 +0900 |
120 |
@@ -7,6 +7,13 @@ |
121 |
describe Puppet::Util::Metric do |
122 |
before do |
123 |
@metric = Puppet::Util::Metric.new("foo") |
124 |
+ #if we don't retrive it before the test the :rrddir test will |
125 |
+ #fail at after |
126 |
+ @basedir = @metric.basedir |
127 |
+ end |
128 |
+ |
129 |
+ after do |
130 |
+ FileUtils.rm_rf(@basedir) if File.directory?(@basedir) |
131 |
end |
132 |
|
133 |
it "should be aliased to Puppet::Metric" do |
134 |
@@ -84,12 +91,46 @@ |
135 |
@metric[:foo].should be_nil |
136 |
end |
137 |
|
138 |
- # LAK: I'm not taking the time to develop these tests right now. |
139 |
- # I expect they should actually be extracted into a separate class |
140 |
- # anyway. |
141 |
- it "should be able to graph metrics using RRDTool" |
142 |
- |
143 |
- it "should be able to create a new RRDTool database" |
144 |
- |
145 |
- it "should be able to store metrics into an RRDTool database" |
146 |
+ it "should be able to graph metrics using RRDTool" do |
147 |
+ ensure_rrd_folder |
148 |
+ populate_metric |
149 |
+ @metric.graph |
150 |
+ end |
151 |
+ |
152 |
+ it "should be able to create a new RRDTool database" do |
153 |
+ ensure_rrd_folder |
154 |
+ add_random_values_to_metric |
155 |
+ @metric.create |
156 |
+ File.exist?(@metric.path).should == true |
157 |
+ end |
158 |
+ |
159 |
+ it "should be able to store metrics into an RRDTool database" do |
160 |
+ ensure_rrd_folder |
161 |
+ populate_metric |
162 |
+ File.exist?(@metric.path).should == true |
163 |
+ end |
164 |
+ |
165 |
+ def ensure_rrd_folder() |
166 |
+ #in normal runs puppet does this for us (not sure where) |
167 |
+ FileUtils.mkdir_p(@basedir) unless File.directory?(@basedir) |
168 |
+ end |
169 |
+ |
170 |
+ def populate_metric() |
171 |
+ time = Time.now.to_i |
172 |
+ time -= 100 * 1800 |
173 |
+ 200.times { |
174 |
+ @metric = Puppet::Util::Metric.new("foo") |
175 |
+ add_random_values_to_metric |
176 |
+ @metric.store(time) |
177 |
+ time += 1800 |
178 |
+ } |
179 |
+ end |
180 |
+ |
181 |
+ def add_random_values_to_metric() |
182 |
+ @metric.values.clear |
183 |
+ random_params = { :data1 => 10, :data2 => 30, :data3 => 100 } |
184 |
+ random_params.each { | label, maxvalue | |
185 |
+ @metric.newvalue(label, rand(maxvalue)) |
186 |
+ } |
187 |
+ end |
188 |
end |
189 |
diff -Naur puppet-0.25.4.orig//test/util/metrics.rb puppet-0.25.4//test/util/metrics.rb |
190 |
--- puppet-0.25.4.orig//test/util/metrics.rb 2010-01-28 12:48:34.000000000 +0900 |
191 |
+++ puppet-0.25.4//test/util/metrics.rb 2010-02-28 11:35:34.000000000 +0900 |
192 |
@@ -53,6 +53,8 @@ |
193 |
report = Puppet::Transaction::Report.new |
194 |
time = Time.now.to_i |
195 |
start = time |
196 |
+ #in normal runs puppet does this for us (not sure where) |
197 |
+ Dir.mkdir(Puppet[:rrddir]) unless File.directory?(Puppet[:rrddir]) |
198 |
10.times { |
199 |
rundata(report, time) |
200 |
time += 300 |