Modifying an agent

How to add custom plugins into an Opsview Monitor agent on a monitored device

Modifying the ITRS Infrastructure Agent

The ITRS Infrastructure Agent is the recommended monitoring agent to use. It comes with a set of default plugins to be able to monitor many aspects of your devices, and also supports adding custom plugins.
See Infrastructure Agent Configuration for details, and then follow the instructions below in the Opsview Monitor UI (assuming a new agent command check_example was added).

UI configuration

  1. Add a new Servicecheck with the following configuration:
Name: Custom Check
Plugin: `check_nrpe`
Parameters: `-H $HOSTADDRESS$ -c check_example -a '<plugin arguements>'`
  1. Now add this Servicecheck to the Host you wish to monitor and Apply Changes to bring the configuration into use.

Opsview Agent Linux: Adding a custom plugin (deprecated)

🚧

Opsview Agent Deprecation

The Opsview Agent and the steps below are now deprecated, and we instead recommend use of the ITRS Infrastructure Agent.

Please follow the instructions above for the most up-to-date information.

  1. Log in to the Linux host that will run the plugin.
  2. Place the plugin in the /opt/opsview/agent/plugins_local directory. You may need to create this directory if it doesn't already exist.
mkdir /opt/opsview/agent/plugins_local
chown root:opsview /opt/opsview/agent/plugins_local
chmod 750 /opt/opsview/agent/plugins_local

mv custom_script.pl /opt/opsview/agent/plugins_local
  1. Make sure the script is executable by the opsview user
chmod +rx /opt/opsview/agent/plugins_local/custom_script.pl
  1. Test the plugin works as expected and there are no missing supplimentary files (note: always change to the root directory to ensure relative paths are not assumed within the plugin) - the -h option should be included in all plugins to provide help output
su - opsview
cd /
/opt/opsview/agent/plugins_local/custom_script.pl -h
  1. Edit the file /opt/opsview/agent/etc/nrpe_local/custom.cfg (you may need to create it if it does not exist), adding a line like the below.
# command[check_name_of_check]=/path/to/script $ARG1$
# replace 'name_of_check' with the name you want to use to refer to the script
# replace /path/to/script with the full path to the script
# The '$ARG1$' is important as this takes any arguments provided by Opsview and passes
#   them directly to the plugin being called. Without this, the arguments configured in
#   Opsview will be ignored.

# e.g.
command[check_custom]=/opt/opsview/agent/plugins_local/custom_script.pl $ARG1$

πŸ“˜

/opt/opsview/agent/etc/nrpe_local

Any files in this directory with the .cfg suffix will be read by Opsview. We use custom.cfg as an example.

  1. Restart the Opsview agent
systemctl restart opsview-agent

From your Opsview Monitor Orchestrator or Collector server you should now be able to use your custom servicecheck with the -c flag of the check_nrpe plugin. For example:

/opt/opsview/monitoringscripts/plugins/check_nrpe -H 192.168.19.170 -c check_custom

# replace 'check_custom' with the name you specified in custom.cfg - command[check_custom]...