#! /bin/sh /usr/share/dpatch/dpatch-run ## bts561577_collectd2html_recursive_fix.dpatch ## by Yuri D'Elia ## ## DP: collectd2html: Fixed recursive mode. ## DP: ## DP: Also, improved default settings to match the collectd4 series. @DPATCH@ diff a/contrib/collectd2html.pl b/contrib/collectd2html.pl --- a/contrib/collectd2html.pl +++ b/contrib/collectd2html.pl @@ -44,7 +44,7 @@ my $DIR = "/var/lib/collectd"; my $HOST = undef; my $IMG_FMT = "PNG"; -my $RECURSIVE = 0; +my $RECURSIVE = 1; GetOptions ( "host=s" => \$HOST, @@ -63,7 +63,7 @@ my @COLORS = (0xff7777, 0x7777ff, 0x55ff55, 0xffcc77, 0xff77ff, 0x77ffff, 0xffff77, 0x55aaff); -my @tmp = `/bin/hostname`; chomp(@tmp); +my @tmp = `/bin/hostname -f`; chomp(@tmp); $HOST = $tmp[0] if (! defined $HOST); my $svg_p = ($IMG_FMT eq "SVG"); my $IMG_SFX = $svg_p ? ".svg" : ".png"; @@ -140,7 +140,8 @@ } chomp(@list); -foreach my $rrd (sort @list){ +@list = sort @list; +foreach my $rrd (@list){ $rrd =~ m/^$DIR\/(.*)\.rrd$/; push(@rrds, $1); }