This commit is contained in:
root
2020-04-18 20:30:53 +02:00
parent eb8851d472
commit 03189601ce
82 changed files with 1351 additions and 0 deletions

21
htdocs/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);

46
htdocs/cgi-bin/graph.pl Executable file
View File

@ -0,0 +1,46 @@
#!/usr/bin/perl
use strict;
use warnings;
use RRDs;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $TMPLpath = "/var/www/mrtg/tmpl";
my $cgi = new CGI;
my $graph = $cgi->param('graph') || $ARGV[0];
$|++;
print $cgi->header(-type => "image/png") unless($ARGV[0]);
if($graph) {
if(open(RRD,"<$TMPLpath/$graph.tmpl")) {
my @rrd = <RRD>;
close(RRD);
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;
if($ARGV[0]) {
foreach (@rrd) {
print $_ . "\n";
}
# exit;
}
RRDs::graph("-",@opts) or die(RRDs::error);
}
}