This article is about the creation of a Centreon plugin. This plugin will be able to check the health of a web service. A SOAP check is already available natively provided by Centreon but this script doesn’t support any authentication such as client certificates or basic authentication.
- Monitor the service answer time
- Supports web service answer validity by request
- Monitor the web service availability
- Supports server-side certificates
- Supports client-side authentication certificates
- Supports basic authentication using a user and password
- Supports thresholds timing for warning and critical answer time
Prerequisites CentOS 6.X (Centreon ISO)
Some packages are needed for the futur check_soap plugin:
yum install python35u python35u-pip python35u-setuptools
python3.5 -m pip install requests
This plugin is using Python3 for some SSL certificates support.
You can find the check_soap plugin here, on github.
This file needs to be placed on your Centreon server in this folder:
After creating the check_soap file, don’t forget to set it as an executable file:
You can check your script by launching it:
The script should echo something like this:
[--srv-cert SRV_CERT] [--client-cert CLIENT_CERT]
[--basic-auth-password BASIC_AUTH_PASSWORD] --warning
WARNING --critical CRITICAL
[~] check_soap Centreon plugin
-h, --help show this help message and exit
--url URL url of the soap service
--data DATA xml data to post to the soap service
--success SUCCESS string to match in the service answer for a valide
--srv-cert SRV_CERT path to a CA_BUNDLE file or directory with
certificates of trusted CAs
local cert for client side certificate
specify a local cert key for client side certificate
specify a basic authentication user
specify a basic authentication password
--warning WARNING exec time in [ms] for warning threshold
--critical CRITICAL exec time in [ms] for critical threshold
You’re now ready to create a new Centreon command using the check_soap python script. To pass some variable to the python script such as the web service url or simply the data to post you can use Centreon’s macro because they may be optionals (on the oposite side, Centreon’s arguments are all required).
Here is the command to type in the « Command line » field:
When the new command is ready, feel free to create some new Centreon’s services.
The check command field should now be using the new created command « check_soap ». After selecting the right command, all the macros may appear under the command name. Fill the macros with the correct value for testing your web service.
Save the service, update the poller and you’re now ready to monitor some web services !