Skip to main content

A library for implementing Choria External Discovery in Python

Project description



py-choria-discovery contains a collection of tools for writing Choria External Discovery plugins in Python.


pip install py-choria-discovery

This library requires a version of Choria with external discovery support (0.19.1+).

Implementing Discovery plugins

The bare minimum steps to implement a python discovery plugin are:

  • Create a python file without a .py extension
from choria_external.dispatcher import dispatch
from choria_discovery import Discovery

class MyDiscovery(Discovery):

    def discover(self):
        filtered_nodes = []
        # Retrieve your list of all available nodes
        #nodes = get_nodes()
        # Apply the filters in self.request.collective and self.request.filter
        #filtered_nodes = apply_filters()
        # Return the set of node names which match the filters
        self.reply.nodes = filtered_nodes

if __name__ == '__main__':


See examples/static for a basic implementation of the node filtering and response.



Provides a base class for implementing External Discovery plugins

Public methods:

  • discover Returns a boolean value to indicate whether the agent should be activated on this host. By default returns True and the agent is always activated. Subclasses may choose to override this method and deactivate themselves under appropriate conditions such as missing pre-requisites.

Instance variables:

  • logger Contains a python logger which can be used to send log information back to choria (debug and info are sent to stdout, which is only displayed in verbose mode; warnings and errors are sent to stderr which are displayed always). The logger is set to use the choria.plugin_name hierarchy. By default all other logging is disabled to prevent pollution of the reply. This is done by setting the log level on the root logger to 100. You can re-enable logging by adjusting the log-level on either the root logger or a specific child if required.
  • config Contains a dict-like object which can be used to read configuration settings from a choria plugin configuration file (/etc/puppetlabs/mcollective/plugin.d/agentname.cfg by default).

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py-choria-discovery-0.1.1.tar.gz (4.3 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page