-$UPSGRAPH::keep = (370*24*60*60)/$UPSGRAPH::step;
+$UPSGRAPH::stepsPerHour = (60 * 60) / $UPSGRAPH::step;
+$UPSGRAPH::keep = ($UPSGRAPH::daysCovered*24*60*60)/$UPSGRAPH::step;
+$UPSGRAPH::keepHours = ($UPSGRAPH::daysCovered*24*60*60)/$UPSGRAPH::stepsPerHour/$UPSGRAPH::step;
$UPSGRAPH::hosts = ();
do $ARGV[0] or die "can't read config: $!";
my $outdir = $UPSGRAPH::outdir;
my $step = $UPSGRAPH::step;
$UPSGRAPH::hosts = ();
do $ARGV[0] or die "can't read config: $!";
my $outdir = $UPSGRAPH::outdir;
my $step = $UPSGRAPH::step;
push @cmd, "DS:${field}:GAUGE:600:" .
$vars->{$field}->{'min'} . ":" .
push @cmd, "DS:${field}:GAUGE:600:" .
$vars->{$field}->{'min'} . ":" .
foreach my $var (@{$host->{'fields'}}) {
my @graphdef = ('-P', "--lazy", "-t", $hostname." - ".$vars->{$var}->{'name'}, "DEF:${var}=${rrdfile}.${var}:${var}:AVERAGE", "LINE1:${var}#FF0000");
foreach my $var (@{$host->{'fields'}}) {
my @graphdef = ('-P', "--lazy", "-t", $hostname." - ".$vars->{$var}->{'name'}, "DEF:${var}=${rrdfile}.${var}:${var}:AVERAGE", "LINE1:${var}#FF0000");
push @graphdef, "VDEF:cur=${var},LAST";
push @graphdef, 'GPRINT:cur:Current\\: <span foreground="#FF0000">%.2lf</span>\\r';
push @graphdef, "VDEF:cur=${var},LAST";
push @graphdef, 'GPRINT:cur:Current\\: <span foreground="#FF0000">%.2lf</span>\\r';
print HTML "<a href=\"${hostname}.${var}.html\"><img src=\"${hostname}.${var}.png\" width=\"${width}\" height=\"${height}\" border=\"0\"></a><br>\n";
open (HTML2, ">${outdir}/${hostname}.${var}.html.new");
print HTML "<a href=\"${hostname}.${var}.html\"><img src=\"${hostname}.${var}.png\" width=\"${width}\" height=\"${height}\" border=\"0\"></a><br>\n";
open (HTML2, ">${outdir}/${hostname}.${var}.html.new");
- print HTML2 '<html><head><meta http-equiv="refresh" content="60"/><meta http-equiv="cache-control" content="no-cache"/><meta http-equiv="pragma" content="no-cache"/><meta http_equiv="expires" content="Sat, 26 Jul 1997 05:00:00 GMT"/><title>' . $vars->{$var}->{'name'} . '</title></head>';
+ print HTML2 '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="refresh" content="60"/><meta http-equiv="cache-control" content="no-cache"/><meta http-equiv="pragma" content="no-cache"/><meta http_equiv="expires" content="Sat, 26 Jul 1997 05:00:00 GMT"/><title>' . $vars->{$var}->{'name'} . '</title></head>';
push @graphdef, "GPRINT:min:Minimum\\: %.2lf";
push @graphdef, "VDEF:avg=${var},AVERAGE";
push @graphdef, "GPRINT:avg:Average\\: %.2lf";
push @graphdef, "GPRINT:min:Minimum\\: %.2lf";
push @graphdef, "VDEF:avg=${var},AVERAGE";
push @graphdef, "GPRINT:avg:Average\\: %.2lf";
push @graphdef, "GPRINT:max:Maximum\\: %.2lf";
push @graphdef, "VDEF:cur=${var},LAST";
push @graphdef, "GPRINT:max:Maximum\\: %.2lf";
push @graphdef, "VDEF:cur=${var},LAST";
$mtime=(stat("${outdir}/${hostname}.${var}.week.png.work"))[9];
($averages, $width, $height) =
$mtime=(stat("${outdir}/${hostname}.${var}.week.png.work"))[9];
($averages, $width, $height) =
$mtime=(stat("${outdir}/${hostname}.${var}.year.png.work"))[9];
($averages, $width, $height) =
$mtime=(stat("${outdir}/${hostname}.${var}.year.png.work"))[9];
($averages, $width, $height) =