diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/oxidized/config.rb | 1 | ||||
-rw-r--r-- | lib/oxidized/node/stats.rb | 5 |
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/oxidized/config.rb b/lib/oxidized/config.rb index 36d9d73..115e035 100644 --- a/lib/oxidized/config.rb +++ b/lib/oxidized/config.rb @@ -35,6 +35,7 @@ module Oxidized asetus.default.models = {} # model level configuration asetus.default.pid = File.join(Oxidized::Config::Root, 'pid') + asetus.default.stats.history_size = 10 asetus.default.input.default = 'ssh, telnet' asetus.default.input.debug = false # or String for session log file asetus.default.input.ssh.secure = false # complain about changed certs diff --git a/lib/oxidized/node/stats.rb b/lib/oxidized/node/stats.rb index e50f799..6ea8985 100644 --- a/lib/oxidized/node/stats.rb +++ b/lib/oxidized/node/stats.rb @@ -13,7 +13,7 @@ module Oxidized :time => job.time, } @stats[job.status] ||= [] - @stats[job.status].shift if @stats[job.status].size > MAX_STAT + @stats[job.status].shift if @stats[job.status].size > @history_size @stats[job.status].push stat @stats[:counter][job.status] += 1 end @@ -48,7 +48,8 @@ module Oxidized private def initialize - @mtimes = Array.new(MAX_STAT, "unknown") + @history_size = Oxidized.config.stats.history_size? || MAX_STAT + @mtimes = Array.new(@history_size, "unknown") @stats = {} @stats[:counter] = Hash.new 0 end |