Class: MCollective::RunnerStats

### Home Classes Methods

### In Files

- lib/mcollective/runnerstats.rb

### Parent

Object

### Methods

- ::new
- #filtered
- #passed
- #received
- #sent
- #to_hash
- #ttlexpired
- #unvalidated
- #validated

### Files

- COPYING
- README
- Rakefile
- PLACEHOLDER
- PLACEHOLDER

### Class/Module Index

Quicksearch

- MCollective
- MCollective::Agent
- MCollective::Agents
- MCollective::Aggregate
- MCollective::Aggregate::Base
- MCollective::Aggregate::Result
- MCollective::Aggregate::Result::Base
- MCollective::Aggregate::Result::CollectionResult
- MCollective::Aggregate::Result::NumericResult
- MCollective::Application
- MCollective::Applications
- MCollective::Client
- MCollective::Config
- MCollective::Connector
- MCollective::Connector::Base
- MCollective::DDL
- MCollective::DDLValidationError
- MCollective::Data
- MCollective::Data::Base
- MCollective::Data::Result
- MCollective::Discovery
- MCollective::Facts
- MCollective::Facts::Base
- MCollective::Generators
- MCollective::Generators::AgentGenerator
- MCollective::Generators::Base
- MCollective::Generators::DataGenerator
- MCollective::InvalidRPCData
- MCollective::Log
- MCollective::Logger
- MCollective::Logger::Base
- MCollective::Logger::Console_logger
- MCollective::Logger::File_logger
- MCollective::Logger::Syslog_logger
- MCollective::Matcher
- MCollective::Matcher::Parser
- MCollective::Matcher::Scanner
- MCollective::Message
- MCollective::MissingRPCData
- MCollective::MsgDoesNotMatchRequestID
- MCollective::MsgTTLExpired
- MCollective::NotTargettedAtUs
- MCollective::Optionparser
- MCollective::PluginManager
- MCollective::PluginPackager
- MCollective::PluginPackager::AgentDefinition
- MCollective::PluginPackager::StandardDefinition
- MCollective::RPC
- MCollective::RPC::ActionRunner
- MCollective::RPC::Agent
- MCollective::RPC::Audit
- MCollective::RPC::Client
- MCollective::RPC::Helpers
- MCollective::RPC::Progress
- MCollective::RPC::Reply
- MCollective::RPC::Request
- MCollective::RPC::Result
- MCollective::RPC::Stats
- MCollective::RPCAborted
- MCollective::RPCError
- MCollective::Registration
- MCollective::Registration::Base
- MCollective::Runner
- MCollective::RunnerStats
- MCollective::SSL
- MCollective::Security
- MCollective::Security::Base
- MCollective::SecurityValidationFailed
- MCollective::Shell
- MCollective::UnixDaemon
- MCollective::UnknownRPCAction
- MCollective::UnknownRPCError
- MCollective::Util
- MCollective::WindowsDaemon
- Array
- Dir
- Object
- String
- Symbol

No matching classes.

# MCollective::RunnerStats

Class to store stats about the mcollectived, it should live in the PluginManager so that agents etc can get hold of it and return the stats to callers

### Public Instance Methods

filtered() click to toggle source

Records a message that didnt pass the filters

    # File lib/mcollective/runnerstats.rb, line 31
    def filtered
      Log.debug("Incrementing filtered stat")
      @filtered += 1
    end

passed() click to toggle source

Records a message that passed the filters

    # File lib/mcollective/runnerstats.rb, line 25
    def passed
      Log.debug("Incrementing passed stat")
      @passed += 1
    end

received() click to toggle source

Records receipt of a message

    # File lib/mcollective/runnerstats.rb, line 48
    def received
      Log.debug("Incrementing total stat")
      @total += 1
    end

sent() click to toggle source

Records sending a message

    # File lib/mcollective/runnerstats.rb, line 54
    def sent
      @mutex.synchronize do
        Log.debug("Incrementing replies stat")
        @replies += 1
      end
    end

to_hash() click to toggle source

Returns a hash with all stats

    # File lib/mcollective/runnerstats.rb, line 62
    def to_hash
      stats = {:validated => @validated,
        :unvalidated => @unvalidated,
        :passed => @passed,
        :filtered => @filtered,
        :starttime => @starttime,
        :total => @total,
        :ttlexpired => @ttlexpired,
        :replies => @replies}

      reply = {:stats => stats,
        :threads => [],
        :pid => Process.pid,
        :times => {} }

      ::Process.times.each_pair{|k,v|
        k = k.to_sym
        reply[:times][k] = v
      }

      Thread.list.each do |t|
        reply[:threads] << "#{t.inspect}"
      end

      reply[:agents] = Agents.agentlist
      reply
    end

ttlexpired() click to toggle source

Records a message that failed TTL checks

    # File lib/mcollective/runnerstats.rb, line 19
    def ttlexpired
      Log.debug("Incrementing ttl expired stat")
      @ttlexpired += 1
    end

unvalidated() click to toggle source

    # File lib/mcollective/runnerstats.rb, line 42
    def unvalidated
      Log.debug("Incrementing unvalidated stat")
      @unvalidated += 1
    end

validated() click to toggle source

Records a message that validated ok

    # File lib/mcollective/runnerstats.rb, line 37
    def validated
      Log.debug("Incrementing validated stat")
      @validated += 1
    end

### Public Class Methods

new() click to toggle source

    # File lib/mcollective/runnerstats.rb, line 5
    def initialize
      @starttime = Time.now.to_i
      @validated = 0
      @unvalidated = 0
      @filtered = 0
      @passed = 0
      @total = 0
      @replies = 0
      @ttlexpired = 0

      @mutex = Mutex.new
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.