Revision a88cab50
Added by Hamish Coleman over 15 years ago
- ID a88cab50077d6edf454cc9896d327dc9e79cbc7b
| mrtg.cgi | ||
|---|---|---|
|
|
||
|
# TODO - check workdir and validate it here
|
||
|
|
||
|
my $filename;
|
||
|
# use precalculated filename if available
|
||
|
if (defined $target->{_imagefile}) {
|
||
|
$filename=$target->{_imagefile};
|
||
|
} else {
|
||
|
$filename=$testname;
|
||
|
}
|
||
|
|
||
|
# Default is GIF, unless a PNG file exists
|
||
|
$target->{_imagetype} = 'gif';
|
||
|
if ( -e "$testname-day.png" ) {
|
||
|
if ( -e "$filename-day.png" ) {
|
||
|
$target->{_imagetype} = "png";
|
||
|
}
|
||
|
|
||
|
# TODO - change the filename based on the displayed period
|
||
|
my $filename = $testname . "-day." . $target->{_imagetype};
|
||
|
$filename = $filename . "-day." . $target->{_imagetype};
|
||
|
|
||
|
my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size,
|
||
|
$atime,$mtime,$ctime,$blksize,$blocks)
|
||
| ... | ... | |
|
$ysize = $target->{ysize} ||"";
|
||
|
$xsize = $target->{xsize};
|
||
|
|
||
|
my $target_urlbase;
|
||
|
# use a precalculated url if defined
|
||
|
if (defined $target->{_url}) {
|
||
|
$target_urlbase=$target->{_url};
|
||
|
} else {
|
||
|
$target_urlbase=$target->{_target};
|
||
|
}
|
||
|
|
||
|
my $target_url;
|
||
|
if ($graph eq 'test') {
|
||
|
# FIXME - does not work with precalculated URL
|
||
|
$target_url = 'gnuplot1.cgi?'.
|
||
|
'log='.$target->{_target}.'.log';
|
||
|
'log='.$target_urlbase.'.log';
|
||
|
if (defined $target->{ylegend}) {
|
||
|
$target_url .= '&ylabel='.$target->{ylegend};
|
||
|
}
|
||
| ... | ... | |
|
$target_url .= '&lo='.$target->{legendo};
|
||
|
}
|
||
|
} else {
|
||
|
$target_url = $target->{_target}."-$graph.".$target->{_imagetype};
|
||
|
$target_url = $target_urlbase."-$graph.".$target->{_imagetype};
|
||
|
}
|
||
|
|
||
|
# TODO - use workpath and other info to point to other directories
|
||
|
print a({-href=>$target->{_target}.".html"},
|
||
|
print a({-href=>$target_urlbase.".html"},
|
||
|
img{
|
||
|
-src=>$target_url,
|
||
|
-height=>"$ysize",
|
||
Also available in: Unified diff
Allow overriding the calculated filenames and urls - this will allow a quick hack to add a munin datasource