The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

MongoDB Registration Agent

A plugin to store data from the RegistrationMetaData plugin in an instance of MongoDB as documents per node.

The intention is to put all the node data in a easily reusable place for web UI’s or Puppet masters to be able to access a cached snapshot of your data

A prototype system exist that lets you query this data from Puppet, the code is on GitHub and I have a Blog Post that shows how it is used.

Short comings

  • It has no way to know when a node is not around anymore, so you need to delete old data yourself. Will make scripts available that does this based on last seen time.

Installation

You need to have the following installed:

Configuration

plugin.registration.mongohost = localhost
plugin.registration.mongodb = puppet
plugin.registration.collection = nodes
plugin.registration.criticalage = 3600

With this setup you should start seeing documents show up in your mongo instance, you can verify like this:

$ mongo
> use puppet
switched to db puppet
> db.nodes.find().count()
47
> db.nodes.find({"fqdn": "your.box.net"})
{ "_id" : ObjectId("4c3f7fb0dc3ecb087d000049"), "agentlist" : [
<snip>

Discovery

As of version 2.1.0 of MCollective discovery is pluggable, the GitHub repo for this registration receiver includes a discovery plugin that supports class, fact, identity and agent filters with full sub collective support.

Copy the discovery/* files into your client libdir and you should see them listed in the output from mco plugin doc:

% mco plugin doc
.
.
.
Discovery Methods:
  flatfile        Flatfile based discovery for node identities
  mc              MCollective Broadcast based discovery
  mongo           MongoDB based discovery for databases built using registration

The discovery plugin takes the same configuration options as above to locate the mongodb instance and you can set it to be the default discovery method in your client.cfg:

default_discovery_method = mongo

With this in place mcollective will default to discovering against this data:

% mco rpc rpcutil ping -W country=fr
Discovering hosts using the mongo method .... 9
.
.

You can revert to the old method of discovery by passing in —dm mc to the client or by using any -S filter.

It understands the criticalage configuration option and will not discover nodes that have not checked in for at least that long