class MCollective::Agent::Discovery

Discovery agent for The Marionette Collective

Released under the Apache License, Version 2

Attributes

meta[R]
timeout[R]

Public Class Methods

new() click to toggle source
# File plugins/mcollective/agent/discovery.rb, line 9
def initialize
    config = Config.instance.pluginconf

    @timeout = 5
    @timeout = config["discovery.timeout"].to_i if config.include?("discovery.timeout")

    @meta = {:license => "Apache License, Version 2",
             :author => "R.I.Pienaar <rip@devco.net>",
             :timeout => @timeout}
end

Public Instance Methods

handlemsg(msg, stomp) click to toggle source
# File plugins/mcollective/agent/discovery.rb, line 20
def handlemsg(msg, stomp)
    reply = "unknown request"

    case msg[:body]
        when "inventory"
            reply = inventory

        when %recho (.+)/
            reply = $1

        when "ping"
            reply = "pong"

        when %r^get_fact (.+)/
            reply = Facts[$1]

        else
            reply = "Unknown Request: #{msg[:body]}"
    end

    reply
end
help() click to toggle source
# File plugins/mcollective/agent/discovery.rb, line 43
            def help
                "                Discovery Agent
                ===============

                Agent to facilitate discovery of machines and data about machines.

                Accepted Messages
                -----------------

                inventory     - returns a hash with various bits of information like
                                list of agents, threads, etc

                ping          - simply responds with 'pong'
                get_fact fact - replies with the value of a facter fact
"
            end