From: Florian Forster Date: Wed, 26 Aug 2009 11:46:36 +0000 (+0200) Subject: collection3: Add the possibility to scale generic graphs. X-Git-Tag: collectd-4.6.5~14 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=571806f201f21a10f6f700a4adf57480fafe5d54;p=collectd.git collection3: Add the possibility to scale generic graphs. --- diff --git a/contrib/collection3/etc/collection.conf b/contrib/collection3/etc/collection.conf index 86cb3aa1..f4c7f5d6 100644 --- a/contrib/collection3/etc/collection.conf +++ b/contrib/collection3/etc/collection.conf @@ -501,6 +501,14 @@ GraphWidth 400 RRDVerticalLabel "°Celsius" RRDFormat "%4.1lf°C" + + DataSources value + DSName "value Time" + RRDTitle "Time {instance}" + RRDVerticalLabel "Seconds" + RRDFormat "%6.2lf %ss" + Scale 0.001 + DataSources users DSName users Users diff --git a/contrib/collection3/lib/Collectd/Graph/Type.pm b/contrib/collection3/lib/Collectd/Graph/Type.pm index 1fb60afe..01c2417c 100644 --- a/contrib/collection3/lib/Collectd/Graph/Type.pm +++ b/contrib/collection3/lib/Collectd/Graph/Type.pm @@ -349,10 +349,24 @@ sub getRRDArgs $f =~ s#:#\\:#g; $ds_name =~ s#:#\\:#g; - push (@ret, - "DEF:min${i}=${f}:${ds_name}:MIN", - "DEF:avg${i}=${f}:${ds_name}:AVERAGE", - "DEF:max${i}=${f}:${ds_name}:MAX"); + if (exists ($obj->{'scale'})) + { + my $scale = 0.0 + $obj->{'scale'}; + push (@ret, + "DEF:min${i}_raw=${f}:${ds_name}:MIN", + "DEF:avg${i}_raw=${f}:${ds_name}:AVERAGE", + "DEF:max${i}_raw=${f}:${ds_name}:MAX", + "CDEF:max${i}=max${i}_raw,$scale,*", + "CDEF:avg${i}=avg${i}_raw,$scale,*", + "CDEF:min${i}=min${i}_raw,$scale,*"); + } + else + { + push (@ret, + "DEF:min${i}=${f}:${ds_name}:MIN", + "DEF:avg${i}=${f}:${ds_name}:AVERAGE", + "DEF:max${i}=${f}:${ds_name}:MAX"); + } } if (@$ds == 1)