Files
ports/dns/bindgraph/files/patch-bindgraph.cgi
T
2007-12-13 06:55:32 +00:00

41 lines
1.1 KiB
Perl

--- bindgraph.cgi.orig 2003-05-05 06:26:18.000000000 +0800
+++ bindgraph.cgi 2007-11-30 22:08:18.000000000 +0800
@@ -8,13 +8,14 @@
use RRDs;
use strict;
+use POSIX qw(uname);
my $VERSION = '0.1';
# hostname. will be printed in the HTML page
-my $hostname = 'hostname.example.net (please edit bindgraph.cgi)';
+my $hostname = (POSIX::uname())[1];
# path of the RRD database
-my $rrd = '/var/www/as112/rrd/bindgraph.rrd';
+my $rrd = '/var/db/bindgraph/bindgraph.rrd';
# temporary directory where the images will be saved
my $tmp_dir = '/tmp/bindgraph';
@@ -89,6 +90,10 @@
}
}
+ my $comment = 'last update: ' . localtime(last_update($rrd))
+ . ' graph created on ' . localtime(time) . '\r';
+ $comment =~ s|:|\\:|g unless $RRDs::VERSION < 1.199908;
+
my ($text, $xs, $ys) = RRDs::graph(
$file,
'--imgformat', 'PNG',
@@ -102,8 +107,7 @@
@rrdef,
@rrprint,
'COMMENT:\s',
- 'COMMENT:last update: ' . localtime(last_update($rrd))
- . ' graph created on ' . localtime(time) . '\r',
+ 'COMMENT:' . $comment,
);
my $err = RRDs::error;
die_fatal("RRDs::graph($file, ...): $err") if $err;