Class MCollective::Agent::Discovery
In: plugins/mcollective/agent/discovery.rb
Parent: Object

Discovery agent for The Marionette Collective

Released under the Apache License, Version 2

Methods

handlemsg   help   new  

Attributes

meta  [R] 
timeout  [R] 

Public Class methods

[Source]

    # File plugins/mcollective/agent/discovery.rb, line 9
 9:             def initialize
10:                 @timeout = Config.instance.pluginconf["discovery.timeout"].to_i || 5
11: 
12:                 @meta = {:license => "Apache License, Version 2",
13:                          :author => "R.I.Pienaar <rip@devco.net>"}
14:             end

Public Instance methods

[Source]

    # File plugins/mcollective/agent/discovery.rb, line 16
16:             def handlemsg(msg, stomp)
17:                 reply = "unknown request"
18: 
19:                 case msg[:body]
20:                     when "inventory"
21:                         reply = inventory
22: 
23:                     when /echo (.+)/
24:                         reply = $1
25: 
26:                     when "ping"
27:                         reply = "pong"
28: 
29:                     when /^get_fact (.+)/
30:                         reply = Facts[$1]
31: 
32:                     else
33:                         reply = "Unknown Request: #{msg[:body]}"
34:                 end
35: 
36:                 reply
37:             end

[Source]

    # File plugins/mcollective/agent/discovery.rb, line 39
39:             def help
40:                 "Discovery Agent\n===============\n\nAgent to facilitate discovery of machines and data about machines.\n\nAccepted Messages\n-----------------\n\ninventory     - returns a hash with various bits of information like\nlist of agents, threads, etc\n\nping          - simply responds with 'pong'\nget_fact fact - replies with the value of a facter fact\n"
41:             end

[Validate]