| 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
| meta | [R] | |
| timeout | [R] |
# File plugins/mcollective/agent/discovery.rb, line 9
9: def initialize
10: config = Config.instance.pluginconf
11:
12: @timeout = 5
13: @timeout = config["discovery.timeout"].to_i if config.include?("discovery.timeout")
14:
15: @meta = {:license => "Apache License, Version 2",
16: :author => "R.I.Pienaar <rip@devco.net>",
17: :timeout => @timeout}
18: end
# File plugins/mcollective/agent/discovery.rb, line 20
20: def handlemsg(msg, stomp)
21: reply = "unknown request"
22:
23: case msg[:body]
24: when "inventory"
25: reply = inventory
26:
27: when /echo (.+)/
28: reply = $1
29:
30: when "ping"
31: reply = "pong"
32:
33: when /^get_fact (.+)/
34: reply = Facts[$1]
35:
36: else
37: reply = "Unknown Request: #{msg[:body]}"
38: end
39:
40: reply
41: end
# File plugins/mcollective/agent/discovery.rb, line 43
43: def help
44: "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"
45: end