Code

collection3: Add the possibility to scale generic graphs.
authorFlorian Forster <octo@huhu.verplant.org>
Wed, 26 Aug 2009 11:46:36 +0000 (13:46 +0200)
committerFlorian Forster <octo@huhu.verplant.org>
Wed, 26 Aug 2009 11:46:36 +0000 (13:46 +0200)
contrib/collection3/etc/collection.conf
contrib/collection3/lib/Collectd/Graph/Type.pm

index 86cb3aa1944b5623707ccaa35c90a903590f8172..f4c7f5d6e6f261ea1db8d4104e3c3710a37831a8 100644 (file)
@@ -501,6 +501,14 @@ GraphWidth 400
   RRDVerticalLabel "°Celsius"
   RRDFormat "%4.1lf°C"
 </Type>
+<Type total_time_in_ms>
+  DataSources value
+  DSName "value Time"
+  RRDTitle "Time {instance}"
+  RRDVerticalLabel "Seconds"
+  RRDFormat "%6.2lf %ss"
+  Scale 0.001
+</Type>
 <Type users>
   DataSources users
   DSName users Users
index 1fb60afeecdd31a36b2eb4f1faefcaaad08ba149..01c2417c39db7bab0e5a74fbd6f91b4724e7c60a 100644 (file)
@@ -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)