This commit is contained in:
2016-02-10 12:53:09 +01:00
parent ed39ebe568
commit f5f7f8c017
71 changed files with 6213 additions and 53 deletions

21
cgi-bin/details.pl Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/perl
use strict;
use warnings;
use Template;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $cgi = new CGI;
my $var = {
GRAPH => $cgi->param('graph')
};
my $template = Template->new({
INCLUDE_PATH => '/var/www/mrtg/tmpl',
INTERPOLATE => 1,
});
$|++;
print $cgi->header();
$template->process('details.tmpl',$var);

View File

@ -16,9 +16,25 @@ print $cgi->header(-type => "image/png");# unless($ARGV[0]);
if($graph) {
if(open(RRD,"<$TMPLpath/$graph.tmpl")) {
my @opts = <RRD>;
my @rrd = <RRD>;
close(RRD);
chomp(@opts);
chomp(@rrd);
my @opts;
if($cgi->param('start')) {
push @opts,"--start=" . $cgi->param('start');
}
if($cgi->param('end')) {
push @opts,"--end=" . $cgi->param('end');
}
if($cgi->param('width')) {
push @opts,"-w ".$cgi->param('width');
}
if($cgi->param('height')) {
push @opts,"-h ".$cgi->param('height');
}
push @opts,@rrd;
RRDs::graph("-",@opts) or die(RRDs::error);
}
}