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

Subscribers

People subscribed via source and target branches

to all changes: