X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=contrib%2Fcollectd2html.pl;h=511b3f9d585d0a8ad2bfb1ea79e396fa7b8fdbac;hp=7953d67ccab85b6cca88c54a9e906dce6c58a4dd;hb=0976eb7abb1c17134ad82ed7ac8d07f4000ce174;hpb=fa9fd186f4e09c24a02d9541c2409d21bf282087 diff --git a/contrib/collectd2html.pl b/contrib/collectd2html.pl index 7953d67c..511b3f9d 100644 --- a/contrib/collectd2html.pl +++ b/contrib/collectd2html.pl @@ -44,7 +44,7 @@ use Getopt::Long qw(:config no_ignore_case bundling pass_through); my $DIR = "/var/lib/collectd"; my $HOST = undef; my $IMG_FMT = "PNG"; -my $RECURSIVE = 0; +my $RECURSIVE = 1; GetOptions ( "host=s" => \$HOST, @@ -63,12 +63,12 @@ if (defined($HOST) && ($DIR !~ m/\/$HOST\/?$/) && (-d "$DIR/$HOST")) { 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"; my $IMG_DIR = "${HOST}.dir"; -my $HTML = "${HOST}.html"; +my $HTML = "${HOST}.xhtml"; ################################################################################ # @@ -118,14 +118,20 @@ open(OUT, ">$HTML"); my $title="Rrd plot for $HOST"; print OUT < - + + + $title + -
END # list interesting rrd @@ -140,27 +146,28 @@ else { } chomp(@list); -foreach my $rrd (sort @list){ +@list = sort @list; +foreach my $rrd (@list){ $rrd =~ m/^$DIR\/(.*)\.rrd$/; push(@rrds, $1); } # table of contents print OUT <

$title

-

+

$title

+

END foreach my $bn (@rrds){ my $cleaned_bn = $bn; $cleaned_bn =~ tr/%\//__/; print OUT <$bn +$bn END } print OUT < +

END # graph interesting rrd @@ -205,11 +212,11 @@ for (my $i = 0; $i < scalar(@rrds); ++$i) { my $cleaned_bn = $bn; $cleaned_bn =~ tr/%\//__/; print OUT <

$bn

+

$bn

END # graph various ranges - foreach my $span qw(1hour 1day 1week 1month){ + foreach my $span (qw(1hour 1day 1week 1month)){ system("mkdir -p $IMG_DIR/" . dirname($bn)); my $img = "$IMG_DIR/${bn}-$span$IMG_SFX"; @@ -222,24 +229,28 @@ END my $cleaned_img = $img; $cleaned_img =~ s/%/%25/g; if (! $svg_p) { print OUT <${bn} $span

+

${bn} $span

END } else { print OUT < - ${bn} $span

+

+ ${bn} $span

END } } print OUT <[top] +

[top]

END } print OUT < +
+

+ Valid XHTML 1.0 Strict +

END