Alignak Example Module
Alignak example module
This module is an example skeleton to build Alignak modules ...
Features and known issues
Modules can be attached to an Alignak daemon thanks to the daemon configuration file. The module defines, in its own properties which daemon it may be attached to and the module documentation will informe the user about this.
Rather than Shinken, a module cannot have sub-modules. This feature is not currently well tested and robust enough :) If you really need this feature get in touch with us to discuss the matter.
Alignak attributes a type to each module that is installed. The idea behind the module type is that it is possible to have several existing modules for the same feature. The current modules types:
- retention, for a module that saves and reloads livestate data between each system restart
- livestate, for a module that will register the current system state (hosts, services states, ...)
- configuration, for a module that will provide the monitored objects to the Alignak arbiter
- passive, for a module that will collect passive checks results (NSCA, ...)
- logs, for a module that will collect monitoring logs
- action, for a module that will execute some actions (acknownledge, downtime, ...)
- poller, for a module that will execute checks in a poller
Old Nagios parameters require that some external modules are installed for the corresponding features to be available. The Arbiter will alert if some features are activated and the corresponding modules are not available in the loaded monitoring configuration.
All Alignak modules are stored in their own repository in the `Alignak monitoring contrib`_ Github organization.
Repository directories and files example:
README.rst LICENCE AUTHORS requirements.txt setup.py version.py alignak_module_EXAMPLE/ etc/ arbiter/ modules/ mod-EXAMPLE.cfg __init__.py EXAMPLE.py
The content of the directory
alignak_checks_EXAMPLE/etc (including files and sub directories) will be copied to /usr/local/var/etc/alignak.
To build a new module EXAMPLE2:
create a new
alignak-module-EXAMPLE2repository which is a copy of this repository
- rename the
- edit the
- rename the
- remove this section Packaging
- search and replace
- complete the Documentation chapter
version.pyfile with all the package information
__module_type__will be used to complete the keywords in PyPI and as the sub-directory to store the pack's files
- the file docstring will be used as the package description in PyPI
setup.pyfile (not recommended)
setup.pyshould not be modified for most of the modules ... if necessary, do it with much care!
example.py contains all the possible methods that are to be used in the different daemon types. Remove unuseful functions and adapt the remaining ones to your needs. And that's it!
Then, to build and make your module available to the community, you must use the standard Python setuptools:
setup.py register -r pypito register the new package near PyPI
setup.py sdist -r pypito build the package
sudo pip install . -eto make the package installed locally (development mode)
sudo pip uninstall -v . -eto remove the development mode
sudo pip install . -vto make the package installed locally
sudo pip uninstall -v alignak_module_EXAMPLEto uninstall the package
When your package is ready and functional:
python setup.py sdist upload -r pypito upload the package to `PyPI repository`_.
Note: every time you upload a package to PyPI you will need to change the module version in the
Under this line, keep the content for the new built package. Remove the former Packaging section of this document.
The installation of this module will copy some configuration files in the Alignak default configuration directory (eg. /usr/local/etc/alignak). The copied files are located in the default sub-directory used for the modules (eg. arbiter/modules).
To install the module from PyPI:
sudo pip install alignak-module-example
From source files
To install the module from the source files (for developing purpose):
git clone https://github.com/Alignak-monitoring-contrib/alignak-module-example cd alignak-module-example sudo pip install . -e
Note: using `sudo python setup.py install` will not correctly manage the package configuration files! The recommended way is really to use `pip`;)
Once installed, this module has its own configuration file in the /usr/local/etc/alignak/arbiter/modules directory. The default configuration file is mod-example.cfg. This file is commented to help configure all the parameters.
To configure an Alignak daemon to use this module:
- edit your daemon configuration file
- add your module alias value (example) to the modules parameter of the daemon
To set up several instances of the same module:
- copy the default configuration to another file,
- update the module alias parameter (example_bis)
- edit your daemon configuration file
- add the new module_alias parameter value (example_bis) to the modules parameter of the daemon
Bugs, issues and contributing
Contributions to this project are welcome and encouraged ... issues in the project repository are the common way to raise an information.