Package: bindgraph Version: 0.2-5 Severity: grave Tags: patch Hi,
When browsing http://localhost/cgi-bin/bindgraph.cgi I do not see any graphs, all I see is: DNS Statistics for [hostname] Last Hours Graph bindgraph image 0 Day Graph bindgraph image 1 Week Graph bindgraph image 2 Month Graph bindgraph image 3 Year Graph bindgraph image 4 bindgraph 0.2 by Marco Delaurenti and Marco d'Itri Digging deeper, I see the following error when generating the graphs causing no graphs to appear when accessing the graph URLS (eg. http://localhost/cgi-bin/bindgraph.cgi/bindgraph_1.png ): ERROR: RRDs::graph(/var/cache/bindgraph/,cgi-bin,bindgraph.cgi/bindgraph_1.png.tmp, ...): Garbage ': Thu Jan 24 15:10:00 2008 graph created on Thu Jan 24 15:12:35 2008\r' after command: COMMENT:last update: Thu Jan 24 15:10:00 2008 graph created on Thu Jan 24 15:12:35 2008\r After some searching with google, I determined that the error is caused by unescaped colons (:) in the COMMENT field. This behavior was changed in rrdtool 1.2.x -- previously this was not an error. So, attached is a patch to fix bindgraph.cgi to work with the rrdtool 1.2.x series. --Joe -- System Information: Debian Release: 4.0 APT prefers stable APT policy: (500, 'stable') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.4.27-2um Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Versions of packages bindgraph depends on: ii debconf [debconf-2.0] 1.5.11etch1 Debian configuration management sy ii libfile-tail-perl 0.98-5 File::Tail perl module ii librrds-perl 1.2.15-0.3 Time-series data storage and displ Versions of packages bindgraph recommends: ii bind9 1:9.3.4-2etch1 Internet Domain Name Server ii lighttpd [httpd] 1.4.13-4etch4 A fast webserver with minimal memo ii thttpd [httpd] 2.23beta1-5 tiny/turbo/throttling HTTP server -- debconf information excluded
--- /var/www/cgi-bin/bindgraph.cgi.orig 2008-01-24 14:55:11.000000000 +0000 +++ /var/www/cgi-bin/bindgraph.cgi 2008-01-24 15:01:21.000000000 +0000 @@ -93,6 +93,12 @@ sub graph($$$;$) { } } + # escape colons in COMMENT field (needed for rrdtool 1.2.x + my $update_time = localtime(last_update($rrd)); + $update_time =~ s/\:/\\:/g; + my $time_now = localtime(time); + $time_now =~ s/\:/\\:/g; + my ($text, $xs, $ys) = RRDs::graph( $file, '--imgformat', 'PNG', @@ -106,8 +112,8 @@ sub graph($$$;$) { @rrdef, @rrprint, 'COMMENT:\s', - 'COMMENT:last update: ' . localtime(last_update($rrd)) - . ' graph created on ' . localtime(time) . '\r', + 'COMMENT:last update\: ' . $update_time + . ' graph created on ' . $time_now . '\r', ); my $err = RRDs::error; die_fatal("RRDs::graph($file, ...): $err") if $err;