/usr/share/mcollective/plugins/mcollective/agent/registration.rb is in mcollective-plugins-registration-monitor 0.0.0~git20120507.df2fa81-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | module MCollective
module Agent
class Registration
attr_reader :timeout, :meta
def initialize
@timeout = 1
@config = Config.instance
@meta = {:license => "GPLv2",
:author => "R.I.Pienaar <rip@devco.net>",
:url => "https://github.com/puppetlabs/mcollective-plugins"}
end
def handlemsg(msg, connection)
req = msg[:body]
if @config.pluginconf.include?("registration.directory")
dir = @config.pluginconf["registration.directory"]
else
dir = "/var/tmp/mcollective"
end
FileUtils.mkdir_p(dir) unless File.directory?(dir)
File.open("#{dir}/#{msg[:senderid]}", 'w') {|f| f.write(YAML.dump(req)) }
nil
end
def help
<<-EOH
Registration Agent
=============
A simple registration agent that writes out a file per sender every time the
sender checks in. The intention is to allow a simple means of detecting when
a node has fallen off the grid.
You can configure the directory where temp files get written using the
plugin.registration.directory option in the config file.
A simple nagios plugin is included to provide the monitoring..
EOH
end
end
end
end
# vi:tabstop=2:expandtab:ai:filetype=ruby
|