Package: collectd
Version: 4.8.1-2
Severity: normal
Tags: patch

The provided example "collectd2html.pl" script does not work correctly in
recursive mode. Just one of the two filename arrays is sorted within the
script. If 'find' is used instead of `ls`, and thus the file list is not
pre-sorted, the images are randomly assigned. Fun!

The attached patch fixes this.

I've also changed the defaults of the script to reflect the default
configuration (which requires recursive and FQDN).
--- /usr/share/doc/collectd/examples/collectd2html.pl   2009-10-04 
09:46:13.000000000 +0200
+++ collectd2html       2009-12-18 12:19:20.580413809 +0100
@@ -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);
 }

Reply via email to