Installing Plugins¶
MCollective has a number of different types of plugins. These can be agents, security systems, fact sources, connectors and others. Plugins all live in your libdir as configured in server.cfg and client.cfg. The examples below all use a libdir as per RedHat, but you should adjust it for your config and operating systems.
Agents¶
An agent can be made up of the following types of files
- The agent ruby code – $libdir/mcollective/agent
- A DDL file – $libdir/mcollective/agent
- A client script – /usr/sbin and $libdir/mcollective/application
- Utility classes – $libdir/mcollective/util
An example is the package agent, it has:
- agent/package.rb – the agent, this goes on all your nodes, it contains the logic that gets executed by your actions
- agent/package.ddl – the DDL file, this goes on your client machines, it has validation and configuration data for the agents
- application/package.rb – the specific client application, this goes on your client machines.
- sbin/mc-package – the specific client script, this goes on your client machines. Only use this if there is no application
Simply copy these files to the correct locations and restart the mcollectived processes once you’ve installed a new agent.
Verification¶
To verify that an agent is correctly installed you can do the following. (Verifying other types of plugins can be harder, I suggest looking in the debug logs)
Check the node, see the list of agents:
% mco inventory some.node
Inventory for some.node:
Server Statistics:
Version: 0.4.10
Start Time: Mon Nov 29 16:38:28 +0000 2010
Config File: /etc/mcollective/server.cfg
Process ID: 5387
Total Messages: 10196
Messages Passed Filters: 7108
Messages Filtered: 3088
Replies Sent: 7107
Total Processor Time: 25.95 seconds
System Time: 7.0 seconds
Agents:
cassandrabackup discovery echo
filemgr nrpe package
process puppetd rpchelper
rpctest rpcutil service
You can now look at the details of all the agents on the node:
% mco rpc rpcutil agent_inventory -I some.node
Determining the amount of hosts matching filter for 2 seconds .... 1
* [ ============================================================> ] 1 / 1
some.node:
Agents:
[{:url=>"http://marionette-collective.org/",
:version=>"1.0",
:name=>"Utilities and Helpers for SimpleRPC Agents",
:agent=>"rpcutil",
:description=> "General helpful actions that expose stats and internals to SimpleRPC clients",
:author=>"R.I.Pienaar ",
:timeout=>3,
:license=>"Apache License, Version 2.0"}]
Finished processing 1 / 1 hosts in 100.70 ms
On the client if you installed a DDL file you can look at the help for an agent:
% mco help rpcutil
Utilities and Helpers for SimpleRPC Agents
==========================================
General helpful actions that expose stats and internals to SimpleRPC clients
Author: R.I.Pienaar
Version: 1.0
License: Apache License, Version 2.0
Timeout: 3
Home Page: http://marionette-collective.org/
ACTIONS:
========
agent_inventory, daemon_stats, get_config_item, get_fact, inventory
agent_inventory action:
-----------------------
Inventory of all agents on the server
INPUT:
OUTPUT:
agents:
Description: List of agents on the server
Display As: Agents
If you start the daemon in Debug mode you should also see a bunch of lines like:
D, [2010-11-30T21:33:33.144290 #5753] DEBUG -- : 5753 pluginmanager.rb:83:in `loadclass': Loading MCollective::Agent::Service from mcollective/agent/service.rb D, [2010-11-30T21:33:33.144786 #5753] DEBUG -- : 5753 pluginmanager.rb:36:in `<<': Registering plugin service_agent with class MCollective::Agent::Service D, [2010-11-30T21:33:33.144928 #5753] DEBUG -- : 5753 stomp.rb:150:in `subscribe': Subscribing to /topic/mcollective.service.command
And finally you can find all nodes that are running your agent:
% mco find -A someagent host1.example.com host2.example.com host3.example.com