Load the class specified in command line then instantiate and run it.

It will read command line first argument and instantiate the specified class with a dotted notation. It will also accept only the class name without any dot, in this case, a recursive search will be done from the directory given by plugin_base_class.plugins_basedir and will find the class with the right name and having the same plugin_type attribute value as plugin_base_class. the search is case insensitive on the class name. Once the plugin instance has been create, the run() method is executed. If you start your launcher without any parameters, it will show you all plugin classes it has discovered in plugin_base_class.plugins_basedir with their first line description.

Parameters:plugin_base_class (naghelp.ActivePlugin) – the base class from which all your active plugins are inherited. This class must redefine attributes plugins_basedir and plugin_type.

This function has to be used in a launcher script you may want to write to start a class as a Nagios plugin, here is a an example:

# change python interpreter if your are using virtualenv or buildout

from plugin_commons import MyProjectActivePlugin
from naghelp.launcher import launch

def main():

if __name__ == '__main__':

Then you can run your plugin class like that (faster):

/path/to/your/launcher my_project_plugins.myplugin.MyPlugin --name=myhost --user=nagiosuser --passwd=nagiospwd

or (slower):

/path/to/your/launcher myplugin --name=myhost --user=nagiosuser --passwd=nagiospwd
naghelp.launcher.usage(plugin_base_class, error='')

Prints launcher usage and display all available plugin classes