6c4cc901cd3c8f862b0c2c44338ac0206e7fdf09
[packages/precise/mcollective.git] / plugins / mcollective / aggregate / sum.rb
1 module MCollective
2   class Aggregate
3     class Sum<Base
4       def startup_hook
5         @result[:value] = 0
6         @result[:type] = :numeric
7
8         # Set default aggregate_function if it is undefined
9         @aggregate_format = "Sum of #{@result[:output]}: %f" unless @aggregate_format
10       end
11
12       # Determines the average of a set of numerical values
13       def process_result(value, reply)
14         @result[:value] += value
15       end
16     end
17   end
18 end