Updated mcollective.init according to OSCI-658
[packages/precise/mcollective.git] / plugins / mcollective / aggregate / sum.rb
diff --git a/plugins/mcollective/aggregate/sum.rb b/plugins/mcollective/aggregate/sum.rb
new file mode 100644 (file)
index 0000000..6c4cc90
--- /dev/null
@@ -0,0 +1,18 @@
+module MCollective
+  class Aggregate
+    class Sum<Base
+      def startup_hook
+        @result[:value] = 0
+        @result[:type] = :numeric
+
+        # Set default aggregate_function if it is undefined
+        @aggregate_format = "Sum of #{@result[:output]}: %f" unless @aggregate_format
+      end
+
+      # Determines the average of a set of numerical values
+      def process_result(value, reply)
+        @result[:value] += value
+      end
+    end
+  end
+end