Plugins : Adding your first plugin to op5 Monitor In this section we will create a very simple plugin. We will write it as a bash script in a ssh connection to the op5 Monitor server.
This plugin will not actually be very useful but we will use it to describe the steps needed when you start to add other, more useful, plugins.
Creating the plugin
To create a simple example plugin as a bash script
1 cd /opt/plugins/custom
touch helloworld
chmod 755 helloworld
2 Open up the script with your favorite text editor and type in the following example plugin:
#!/bin/sh
echo 'WARNING: Hello world!'
exit 1
3 Save and exit your editor
4 Execute it from the terminal:
5 ./helloworld
WARNING: Hello world!
echo $?
1
The script prints the status output (WARNING: Hello world!).
echo $? prints the return code of the last executed command.
Configuring op5 Monitor to use the plugin
To configure op5 Monitor to use the plugin
1 Go to Configure and choose Commands.
2 Add a new command with:
command_name: check_local_helloworld
command_line: $USER1$/custom/helloworld
3 Click Apply and then Save.
Now you may use your check command with a service as described in
Services on page 69