From: Michael Gernoth Date: Wed, 21 Jul 2010 08:00:59 +0000 (+0200) Subject: current value X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/upsgraph/commitdiff_plain/0e74e3d8b878f134b1b4cd1f207c1765482a97e5?hp=f004592ac75253abcb2e32548ddb995f10ff9cf2 current value --- diff --git a/upsgraph.pl b/upsgraph.pl index 1fbb452..100c52b 100755 --- a/upsgraph.pl +++ b/upsgraph.pl @@ -324,7 +324,10 @@ while(1) { } foreach my $var (@{$host->{'fields'}}) { - my @graphdef = ("--lazy", "-t", $hostname." - ".$vars->{$var}->{'name'}, "DEF:${var}=${rrdfile}.${var}:${var}:AVERAGE", "LINE1:${var}#FF0000"); + 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\\: %.2lf\\r'; my $mtime; $mtime=(stat("${outdir}/${hostname}.${var}.png.work"))[9]; @@ -333,6 +336,9 @@ while(1) { RRDs::graph("${outdir}/${hostname}.${var}.png.work", "-w", "720", @graphdef); + pop @graphdef; + pop @graphdef; + if (RRDs::error) { print "Error while graphing: " . RRDs::error . "\n"; } else { @@ -346,10 +352,9 @@ while(1) { print HTML "
\n"; open (HTML2, ">${outdir}/${hostname}.${var}.html.new"); - print HTML2 "" . $vars->{$var}->{'name'} . ""; + print HTML2 '' . $vars->{$var}->{'name'} . ''; print HTML2 ''; - push @graphdef, "VDEF:min=${var},MINIMUM"; push @graphdef, "GPRINT:min:Minimum\\: %.2lf";