diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/oxidized/node/stats.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/oxidized/node/stats.rb b/lib/oxidized/node/stats.rb index e37e07a..c20a91a 100644 --- a/lib/oxidized/node/stats.rb +++ b/lib/oxidized/node/stats.rb @@ -23,6 +23,18 @@ module Oxidized status ? @stats[status] : @stats end + def get_counter counter=nil + counter ? @stats[:counter][counter] : @stats[:counter] + end + + def successes + @stats[:counter][:success] + end + + def failures + @stats[:counter].reduce(0) { |m,h| h[0] == :success ? m : m+h[1] } + end + private def initialize |