OP5 Monitor has an open architecture. You can extend the standard functionality by adding custom plugins from the Naemon community or developed by your own organisation.
The sections below explain how to create and install custom plugins. ITRS does not provide any support for custom plugins.
Custom plugins in OP5 Monitor rely on the use of Naemon macros. For more information, see Macros in Manage commands.
The following procedure explains how to write a simple shell script to run as a plugin. You can use it as a basis for creating more complex custom plugins of your own.
To create a custom plugin:
- Log on to the OP5 Monitor server, using SSH.
- Add your custom plugin to directory
/opt/plugins/customand make it executable. In the following example, we are adding a new file called
- You can now edit your plugin file to add some checking logic. In the following example, we add code to print a value:
- You can now execute the file to test it:
cd /opt/plugins/custom touch check_local_helloworld chmod 755 check_local_helloworld
#!/bin/sh echo 'WARNING: Hello, world!' exit 1
$ ./check_local_helloworld WARNING: Hello, world! $ echo $? 1
Success: You have created your custom plugin. The next step is to install it in OP5 Monitor.
You install a custom plugin by creating a new command for it and adding the command to a service configuration.
To install a custom plugin:
- In the OP5 Monitor interface, click Manage > Configure > Commands.
- Enter the details of the new command. For the plugin created in Create a custom plugin, the parameters are as follows:
- Add the command to a service configuration. For guidance, see Configure a service in Manage hosts and services. You can now see it in the service list views:
command_name: check_local_helloworld command_line: $USER1$/custom/check_local_helloworld
For guidance on creating commands, see Create and update commands in Manage commands.
Creating a custom Docker image on top of the image provided for the OP5 Monitor Slim Poller is the recommended way to install custom plugins on the Slim Poller. It is a flexible approach which enables plugin dependencies to be installed as well.
To create a custom Docker image, you need to define a new Dockerfile. This new image must be based on the
naemon-core image. After you define the base image in the Dockerfile, you can install the plugin and dependencies as required.
The example Dockerfile below installs plugin
# Run as root while installing
# Make sure the custom plugins path exists
RUN mkdir -p $PLUGIN_PATH
# Install dependencies
RUN yum install -y ruby rubygems rubygem-json
# install git
RUN yum install -y git
# Checkout the sourcecode from git
RUN git clone https://github.com/xorpaul/check_puppetdb.git
RUN cp ./check_puppetdb/check_puppetdb.rb $PLUGIN_PATH
RUN rm -rf ./check_puppetdb/
# Change back to correct monitor user
You can find more information on Dockerfiles at docs.docker.com.
After you define your new custom Docker image, build the image using the following command:
docker build -f <path/to/dockerfile>
Depending on how you deploy the Slim Poller, you might need to upload or push the image to your environment, or you can upload it to hub.docker.com.
After you make the new image available in your environment, change your deployment files to use this new image instead of the
naemon-core image. For more information on Slim Poller deployment files, see Deployment examples in Scale up your monitoring environment.
The following example creates a plugin to print the OP5 Monitor storage path:
# Create a function to print the storage path
grep ^storagepath /etc/op5-backup/main.conf |tail -1 |sed 's/^[^"]*"//g' | sed 's/"$//g'
# Put the storage path in an environmental variable
# Test if the storagepath exists and is a directory
if [[ ! -d "$STORAGEPATH" ]]; then
# Print a warning message for the web gui
echo "op5-backup is not properly configured for local operation"
# Exit with status Warning (exit code 1)
# If the script reaches this point then the test passed
# Print an OK message
echo $STORAGEPATH exists
# Exit with status OK
For more information on custom plugins, see Naemon - Plugin API documentation.