ITRS Opsview Cloud Documentation

Modifying an agent

The Opsview Monitor agent comes with a set of default plugins to be able to monitor many aspects of your devices

Linux: Adding a custom plugin Copied

  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$

Note

Any files in the /opt/opsview/agent/etc/nrpe_local 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
  1. 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]...

UI configuration Copied

  1. Add a new Servicecheckwith the following configuration:
Name: Custom Check
Plugin: `check_nrpe`
Parameters: `-H $HOSTADDRESS$ -c check_customer -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 On-premises"] ["User Guide"]

Was this topic helpful?