From 0e74e3d8b878f134b1b4cd1f207c1765482a97e5 Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Wed, 21 Jul 2010 10:00:59 +0200 Subject: [PATCH] current value --- upsgraph.pl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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"; -- 2.39.5