Merge lp:~blueyed/munin/lp729709 into lp:ubuntu/natty/munin

Proposed by Daniel Hahler
Status: Merged
Merged at revision: 36
Proposed branch: lp:~blueyed/munin/lp729709
Merge into: lp:ubuntu/natty/munin
Diff against target: 337 lines (+312/-0)
4 files modified
debian/changelog (+11/-0)
debian/patches/series (+2/-0)
debian/patches/upstream_bug_832.patch (+260/-0)
debian/patches/upstream_bug_990.patch (+39/-0)
To merge this branch: bzr merge lp:~blueyed/munin/lp729709
Reviewer Review Type Date Requested Status
Dave Walker (community) Approve
Ubuntu branches Pending
Review via email: mp+52304@code.launchpad.net
To post a comment you must log in.
lp:~blueyed/munin/lp729709 updated
38. By Daniel Hahler

* Fix "munin-cgi-graph fails on multigraphs"
  - debian/patches/upstream_bug_832.patch (backported upstream fix)
  - LP: #729719

Revision history for this message
Dave Walker (davewalker) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2011-01-27 00:36:44 +0000
3+++ debian/changelog 2011-03-05 20:49:16 +0000
4@@ -1,3 +1,14 @@
5+munin (1.4.5-3ubuntu3) natty; urgency=low
6+
7+ * Fix hosts being skipped because of low max_processes value.
8+ - debian/patches/upstream_bug_990.patch (upstream fix)
9+ - LP: #729709
10+ * Fix "munin-cgi-graph fails on multigraphs"
11+ - debian/patches/upstream_bug_832.patch (backported upstream fix)
12+ - LP: #729719
13+
14+ -- Daniel Hahler <ubuntu@thequod.de> Sat, 05 Mar 2011 21:45:23 +0100
15+
16 munin (1.4.5-3ubuntu2) natty; urgency=low
17
18 * Add debian/patches/upstream_bug_952.patch (LP: #699967) to fix empty list
19
20=== modified file 'debian/patches/series'
21--- debian/patches/series 2011-01-27 00:36:44 +0000
22+++ debian/patches/series 2011-03-05 20:49:16 +0000
23@@ -1,3 +1,5 @@
24+upstream_bug_832.patch
25+upstream_bug_990.patch
26 upstream_add-timeout-to-legal-options.patch
27 upstream_bug-975-fixed-in-1.4.6.patch
28 upstream_bug_952.patch
29
30=== added file 'debian/patches/upstream_bug_832.patch'
31--- debian/patches/upstream_bug_832.patch 1970-01-01 00:00:00 +0000
32+++ debian/patches/upstream_bug_832.patch 2011-03-05 20:49:16 +0000
33@@ -0,0 +1,260 @@
34+Description: Backported fix for nested groups with munin-cgi-graph.
35+Origin: other, http://munin-monitoring.org/attachment/ticket/832/fix_munin832.patch
36+Bug: http://munin-monitoring.org/ticket/832
37+Bug-Ubuntu: https://bugs.launchpad.net/debian/+source/munin/+bug/729719
38+Forwarded: not-needed
39+Author: Daniel Reichelt <debian@itamservices.de>
40+Last-Update: 2011-03-05
41+
42+Index: munin/master/_bin/munin-cgi-graph.in
43+===================================================================
44+--- munin.orig/master/_bin/munin-cgi-graph.in 2011-03-05 21:39:37.000000000 +0100
45++++ munin/master/_bin/munin-cgi-graph.in 2011-03-05 21:39:44.000000000 +0100
46+@@ -62,10 +62,7 @@
47+ my $config = &munin_readconfig ($conffile);
48+
49+ my $path = $ENV{PATH_INFO} || "";
50+-$path =~ s/^\///;
51+-($dom, $host, $serv) = split /\//, $path;
52+-($serv, $scale) = split /-/, $serv, 2;
53+-$scale =~ s/\.png$//;
54++($dom, $host, $serv, $scale) = $path =~ m#^/(.*)/([^/]+)/(\w+)-(\w+)\.png#; ## avoid bug in vim
55+
56+ &verify_parameters ($dom, $host, $serv, $scale);
57+
58+@@ -81,7 +78,7 @@
59+ my $no_cache = defined($ENV{HTTP_CACHE_CONTROL}) && $ENV{HTTP_CACHE_CONTROL} =~ /no-cache/i;
60+
61+ if ($no_cache or (! &graph_usable($filename,$time) )) {
62+- exit 0 unless draw_graph_or_complain($host, $serv, $TIMES{$scale});
63++ exit 0 unless draw_graph_or_complain($dom, $host, $serv, $TIMES{$scale});
64+ goto draw;
65+ }
66+
67+@@ -106,7 +103,7 @@
68+
69+ draw:
70+
71+- @stats = stat ($filename) unless @stats;
72++ @stats = stat ($filename); # restat to be sure
73+
74+ $last_modified = strftime ("%a, %d %b %Y %H:%M:%S %Z", localtime ($stats[9]))
75+ unless defined($last_modified);
76+@@ -115,7 +112,9 @@
77+ gmtime($stats[9]+($period{$scale}-($stats[9]%$period{$scale}))))
78+ unless defined($expires);
79+
80++print "Status: 200\n";
81+ print "Content-Type: image/png\n";
82++print "Content-Length: $stats[7]\n";
83+ print "Expires: ", strftime ("%a, %d %b %Y %H:%M:%S GMT", gmtime(time+($period{$scale}-($time%$period{$scale})))), "\n";
84+ print "Last-Modified: $last_modified\n";
85+ print "\n";
86+@@ -167,10 +166,9 @@
87+ # This just serves the file, no file is made.
88+ my $filename = shift;
89+
90+- open (my $GRAPH, '<', $filename)
91+- or die "Warning: Could not open picture file \"$filename\" for reading: $!\n";
92+- print while (<$GRAPH>);
93+- close ($GRAPH);
94++ open (GRAPH_PNG_FILE, '<', $filename) or die "Warning: Could not open picture file \"$filename\" for reading: $!\n";
95++ print while (<GRAPH_PNG_FILE>);
96++ close (GRAPH_PNG_FILE)
97+ }
98+
99+
100+@@ -288,6 +286,7 @@
101+
102+
103+ sub draw_graph {
104++ my $dom = shift;
105+ my $host = shift;
106+ my $serv = shift;
107+ my $scale = shift;
108+@@ -296,10 +295,13 @@
109+ # . needs to be legal in host names
110+ $host =~ s{[^\w_/"'\[\]\(\)\.+=-]}{_}g; $host =~ /^(.+)$/; $host = $1; #"
111+
112++ my $fqn = "root/$dom/$host/$serv";
113++
114+ my @params = ($GRAPHER);
115+ push @params, @$scale;
116+ push @params, "--skip-locking", "--skip-stats", "--nolazy", "--list-images";
117+- push @params, "--host", $host, "--service", $serv;
118++ push @params, "--host", $host, "--only-fqn", $fqn;
119++ push @params, "--no-fork"; # FastCgi forks for us
120+ push @params, "STDERR>&STDOUT";
121+
122+ my $file = "/dev/null";
123+Index: munin/master/_bin/munin-fastcgi-graph.in
124+===================================================================
125+--- munin.orig/master/_bin/munin-fastcgi-graph.in 2011-03-05 21:39:37.000000000 +0100
126++++ munin/master/_bin/munin-fastcgi-graph.in 2011-03-05 21:39:44.000000000 +0100
127+@@ -70,10 +70,7 @@
128+ # BEGIN FAST-CGI LOOP:
129+ while (new CGI::Fast) {
130+ my $path = $ENV{PATH_INFO} || "";
131+- $path =~ s/^\///;
132+- ($dom, $host, $serv) = split /\//, $path;
133+- ($serv, $scale) = split /-/, $serv, 2;
134+- $scale =~ s/\.png$//;
135++ ($dom, $host, $serv, $scale) = $path =~ m#^/(.*)/([^/]+)/(\w+)-(\w+)\.png#; ## avoid bug in vim
136+
137+ if (! &verify_parameters ($dom, $host, $serv, $scale)) {
138+ print "Status: 500\n";
139+@@ -91,7 +88,7 @@
140+ my $no_cache = defined($ENV{HTTP_CACHE_CONTROL}) && $ENV{HTTP_CACHE_CONTROL} =~ /no-cache/i;
141+
142+ if ($no_cache or (! &graph_usable ($filename, $time) )) {
143+- next unless draw_graph_or_complain($host, $serv, $TIMES{$scale});
144++ next unless draw_graph_or_complain($dom, $host, $serv, $TIMES{$scale});
145+ goto draw;
146+ }
147+
148+@@ -115,17 +112,19 @@
149+ }
150+
151+ draw:
152+- @stats = stat ($filename) unless @stats;
153++ @stats = stat ($filename); # restat to be sure
154+ $last_modified = strftime ("%a, %d %b %Y %H:%M:%S %Z", localtime ($stats[9])) unless defined($last_modified);
155+ # "Expires" has to use last modified time as base:
156+ $expires = strftime ("%a, %d %b %Y %H:%M:%S GMT",
157+ gmtime($stats[9]+($period{$scale}-($stats[9]%$period{$scale})))) unless defined ($expires);
158+
159++ print "Status: 200\n";
160+ print "Content-Type: image/png\n";
161++ print "Content-Length: $stats[7]\n";
162+ print "Expires: ", $expires, "\n";
163+ print "Last-Modified: $last_modified\n";
164+ print "\n";
165+-
166++
167+ &graph ($filename);
168+ }
169+
170+@@ -169,10 +168,9 @@
171+ # Serve the graph contents. This is not heavy, no semaphore.
172+ my $filename = shift;
173+
174+- open (my $GRAPH, '<', $filename)
175+- or die "Warning: Could not open picture file \"$filename\" for reading: $!\n";
176+- print while (<$GRAPH>);
177+- close ($GRAPH);
178++ open (GRAPH_PNG_FILE, '<', $filename) or die "Warning: Could not open picture file \"$filename\" for reading: $!\n";
179++ print while (<GRAPH_PNG_FILE>);
180++ close (GRAPH_PNG_FILE)
181+ }
182+
183+
184+@@ -293,6 +291,7 @@
185+
186+ sub draw_graph {
187+ # Draw a new graph - use semaphore to avoid too many concurrent munin-graph calls.
188++ my $dom = shift;
189+ my $host = shift;
190+ my $serv = shift;
191+ my $scale = shift;
192+@@ -301,11 +300,14 @@
193+ # . needs to be legal in host names
194+ $host =~ s{[^\w_\/"'\[\]\(\)\.+=-]}{_}g; $host =~ /^(.+)$/; $host = $1; #"
195+
196++ my $fqn = "root/$dom/$host/$serv";
197++
198+ my @params = ($GRAPHER);
199+ push @params, @$scale;
200+ push @params, "--skip-locking", "--skip-stats", "--nolazy";
201+ push @params, "--list-images";
202+- push @params, "--host", $host, "--service", $serv;
203++ push @params, "--host", $host, "--only-fqn", $fqn;
204++ push @params, "--no-fork"; # FastCgi forks for us
205+ push @params, "STDERR>&STDOUT";
206+
207+ my $file = "/dev/null";
208+Index: munin/master/lib/Munin/Master/GraphOld.pm
209+===================================================================
210+--- munin.orig/master/lib/Munin/Master/GraphOld.pm 2011-03-05 21:39:37.000000000 +0100
211++++ munin/master/lib/Munin/Master/GraphOld.pm 2011-03-05 21:39:44.000000000 +0100
212+@@ -145,6 +145,7 @@
213+ # Limit graphing to certain hosts and/or services
214+ my @limit_hosts = ();
215+ my @limit_services = ();
216++my $only_fqn;
217+
218+ my $watermark = "Munin " . $Munin::Common::Defaults::MUNIN_VERSION;
219+
220+@@ -175,6 +176,7 @@
221+ "lazy!" => \$force_lazy,
222+ "host=s" => \@limit_hosts,
223+ "service=s" => \@limit_services,
224++ "only-fqn=s" => \$only_fqn,
225+ "config=s" => \$conffile,
226+ "stdout!" => \$stdout,
227+ "day!" => \$draw{'day'},
228+@@ -1339,13 +1341,26 @@
229+ return $fieldname;
230+ }
231+
232++sub ends_with {
233++ my ($src, $searched) = @_;
234++ DEBUG "[DEBUG] ends_with($src, $searched)\n";
235++
236++ my $is_ending = (substr($src, - length($searched)) eq $searched);
237++ return $is_ending;
238++}
239++
240+
241+ sub skip_service {
242+ my $service = shift;
243+- my $sname = munin_get_node_name($service);
244++ my $fqn = munin_get_node_fqn($service);
245++
246++ # Skip if we've limited services with the omnipotent cli option only-fqn
247++ return 1 if ($only_fqn and ! ends_with($fqn, $only_fqn));
248++ DEBUG "[DEBUG] $fqn is in ($only_fqn)\n";
249+
250+ # Skip if we've limited services with cli options
251+- return 1 if (@limit_services and !grep /^$sname$/, @limit_services);
252++ return 1 if (@limit_services and ! (grep { ends_with($fqn, $_) } @limit_services));
253++ DEBUG "[DEBUG] $fqn is in (" . join(",", @limit_services) . ")\n";
254+
255+ # Always graph if --force is present
256+ return 0 if $force_graphing;
257+Index: munin/master/lib/Munin/Master/Utils.pm
258+===================================================================
259+--- munin.orig/master/lib/Munin/Master/Utils.pm 2011-03-05 21:39:37.000000000 +0100
260++++ munin/master/lib/Munin/Master/Utils.pm 2011-03-05 21:39:44.000000000 +0100
261+@@ -54,6 +54,7 @@
262+ 'munin_get_rrd_filename',
263+ 'munin_get_node_name',
264+ 'munin_get_parent_name',
265++ 'munin_get_node_fqn',
266+ 'munin_get_node_loc',
267+ 'munin_get_node',
268+ 'munin_set_var_loc',
269+@@ -517,6 +518,24 @@
270+ }
271+ }
272+
273++sub munin_get_node_fqn
274++{
275++ my $hash = shift;
276++
277++ if (ref ($hash) eq "HASH") {
278++ my $fqn = "";
279++ if (defined $hash->{'#%#name'}) {
280++ $fqn = $hash->{'#%#name'};
281++ }
282++ if (defined $hash->{'#%#parent'}) {
283++ # Recursively prepend the parent, concatenation with /
284++ $fqn = munin_get_node_fqn ($hash->{'#%#parent'}) . "/" . $fqn;
285++ }
286++ return $fqn;
287++ } else {
288++ return;
289++ }
290++}
291+
292+ sub munin_get_picture_loc {
293+ my $hash = shift;
294
295=== added file 'debian/patches/upstream_bug_990.patch'
296--- debian/patches/upstream_bug_990.patch 1970-01-01 00:00:00 +0000
297+++ debian/patches/upstream_bug_990.patch 2011-03-05 20:49:16 +0000
298@@ -0,0 +1,39 @@
299+Description: Fix hosts being skipped with low max_processes
300+Origin: upstream, http://munin-monitoring.org/changeset/3981
301+Bug: http://munin-monitoring.org/ticket/990
302+Bug-Ubuntu: https://bugs.launchpad.net/munin/+bug/729709
303+Forwarded: not-needed
304+Author: Matthew Kent
305+Last-Update: 2011-06-03/05/11
306+
307+Index: munin-1.4.5/master/lib/Munin/Master/ProcessManager.pm
308+===================================================================
309+--- munin-1.4.5.orig/master/lib/Munin/Master/ProcessManager.pm 2011-03-05 17:56:29.000000000 +0100
310++++ munin-1.4.5/master/lib/Munin/Master/ProcessManager.pm 2011-03-05 17:56:47.000000000 +0100
311+@@ -107,7 +107,7 @@
312+ my ($self) = @_;
313+
314+ while (@{$self->{workers}}) {
315+- DEBUG "[DEBUG] Active workers: " . scalar %{$self->{active_workers}};
316++ DEBUG "[DEBUG] Active workers: " . (scalar keys %{$self->{active_workers}}) . "/" . $self->{max_concurrent};
317+ last if scalar keys %{$self->{active_workers}} == $self->{max_concurrent};
318+ # Here we just start'em, check results in _collect_results
319+ $self->_start_next_worker();
320+@@ -140,7 +140,7 @@
321+ sub _collect_results {
322+ my ($self, $sock) = @_;
323+
324+- while (%{$self->{result_queue}}) {
325++ while (%{$self->{result_queue}} || @{$self->{workers}}) {
326+
327+ do {
328+ $self->_vet_finished_workers();
329+@@ -148,7 +148,7 @@
330+ } while (!%{$self->{result_queue}} && @{$self->{workers}});
331+
332+ my $worker_sock;
333+- DEBUG "[DEBUG] Active workers: " . scalar %{$self->{active_workers}};
334++ DEBUG "[DEBUG] Active workers: " . (scalar keys %{$self->{active_workers}}) . "/" . $self->{max_concurrent};
335+
336+ if (not %{$self->{active_workers}}) {
337+ # Nothing left do do

Subscribers

People subscribed via source and target branches

to all changes: