diff --git a/doc/source/tutorials/monitoring_with_your_custom_plugin.rst b/doc/source/tutorials/monitoring_with_your_custom_plugin.rst index 7c63afc..9ad986d 100644 --- a/doc/source/tutorials/monitoring_with_your_custom_plugin.rst +++ b/doc/source/tutorials/monitoring_with_your_custom_plugin.rst @@ -6,39 +6,19 @@ Monitoring with your custom plugin Surveil is compatible with Nagios plugins. It is trivial to write a custom plugin to monitor your applcation. In this guide, we will create a new plugin and configure a new Host that uses it in Surveil. -1. Test the check_example plugin -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +0. Install the plugin +~~~~~~~~~~~~~~~~~~~~~ -The first step to create a plugin is to successfully test the check_example plugin. This plugin -will serve as a base file to create your own plugin. +Surveil support Nagios plugins. For more information about Nagios plugins, please refer to the `Nagios plugin API documentation `_ for more information. -Create virtual environment and install requirements: :: +There are many plugins available on the web. For example, the `nagios-plugins `_ project contains many plugins written in C and the `monitoring-tools `_ project contains many plugins written in Python. - virtualenv env - source env/bin/activate - cd tools/docker/alignak_container/plugins/check-example - pip install -r requirements.txt +Surveil loads plugins from ``/usr/lib/monitoring/plugins/``. In this example, we will be installing a simple fake plugin written in Bash: :: -Install the check_example plugin: :: + echo -e '#!/bin/bash\necho "DISK $1 OK - free space: / 3326 MB (56%); | /=2643MB;5948;5958;0;5968"' | sudo tee /usr/lib/monitoring/plugins/custom/check_example + chmod +x /usr/lib/monitoring/plugins/custom/check_example - python setup.py develop - -Run the plugin: :: - - check_example - -The output should look like this: :: - - DISK OK - free space: / 3326 MB (56%); | /=2643MB;5948;5958;0;5968 - -2. Modify the plugin -~~~~~~~~~~~~~~~~~~~~ - -The next step is to modify the plugin to meet your needs. In order to do this, -please refer to the `Nagios plugin API documentation `_. - - -3. Create a host using this plugin +1. Create a host using this plugin ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Now that you are done developing your plugin, it is time to use it in Surveil. @@ -48,14 +28,14 @@ Creating a command Before you can use your plugin in a host/service configuration, you need to create an Alignak command: :: - surveil config-command-create --command_name check_example --command_line "check_example" + surveil config-command-create --command_name check_example --command_line '$CUSTOMPLUGINSDIR$/check_example $HOSTADDRESS$' Creating a host --------------- Create a host with the following command: :: - surveil config-host-create --host_name check_example_host --address savoirfairelinux.com + surveil config-host-create --host_name check_example_host --address savoirfairelinux.com --use generic-host Creating a Service ------------------