-$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;
$vars->{$field}->{'max'};
push @cmd, "RRA:AVERAGE:0.5:1:${keep}";
$vars->{$field}->{'max'};
push @cmd, "RRA:AVERAGE:0.5:1:${keep}";
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 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>';
print HTML2 '<body bgcolor="#ffffff">';
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>';
print HTML2 '<body bgcolor="#ffffff">';
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";