Chapter 14. Registration

Registration is a process where an agent on the server sends out a message on to the collective.registration.agent Topic every registerinterval period. The default registration agent AgentList sends out a list of the mcollective agents installed and running in mcollectived.

In a default installation every server publishes these registration messages, but nothing subscribes to them. I believe the original use was intended to simply keep the TCP connection alive in the presence of connection-tracking firewalls. Now that this is handled by the heartbeat support in STOMP 1.1 protocol, registration … well, it has found its own reason to live.

Many people have started doing useful things with the registration agent. Let’s show you how to build your own agent, and your own collector to grab that data and do something with it.

Registration Agent

If you were to look at the default registration agent in your libdir directory you’d be amazed at how simple it is.

$ cat /usr/libexec/mcollective/mcollective/registration/agentlist.rb
module MCollective
  module Registration
    # A registration plugin that simply sends in the list of agents we have
    class Agentlist<Base
      def body

Yeah, it is simple. The module should subclass MCollective::Registration::Base. Define a body method which returns anything you want, and that data is sent out to the collective.registration.agent topic for you. You can make the data as complex or as simple as meets your needs. ...

Get Learning MCollective now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.