In this guide, I will show you a quick and easy way to get open source syslog monitoring using Opsview.
You are here
What are Active Checks and Monitoring Plugins?
Active Checks are performed by Monitoring Plugins and are the most common and popular way of monitoring hosts.
Monitoring plugins can be written in any language, from bash and C to Perl and Python. For a detailed look at writing Monitoring Plugins, go to this guide.
In essence, a monitoring plugin is a translator that resides between Opsview and the item we wish to monitor. The plugin speaks both languages; It knows how to speak to Opsview's language, and it knows how to talk to the Host in the Host's language:
For example, if Opsview wants to talk to a Windows Host it will need to know how to 'talk Windows'. This is where a plugin comes in. Opsview simply asks the question, 'Hey, go and find out how full the C: drive is'. The Plugin goes to the Windows Host, asks the question, gets the answer, and converts it into a format that Opsview understands and can process for alerts, graphs and more.
Most monitoring plugins require input in order to run. For example, the Windows C: service check above will likely require the username and password to authenticate, but also the name of the drive that needs to be monitored. These pieces of information are known as arguments. Arguments provide the plugin with the information required to run correctly. Each plugin generally comes with a help file, visible within Opsview via 'Show plugin help', which explains what options are needed, what options are available, and how to set them.
Common options, also known as 'flags', are:
- -H: After this flag, enter the Host address, e.g. '-H 192.168.0.1' to run the plugin against 192.168.0.1.
- -w: The warning flag. If monitoring a number, e.g. a temperature, the warning flag is followed by a number that if exceeded will result in the service check changing to a WARNING status. e.g. '-w 55' means if the temperature is above 55, then set to WARNING (unless the temperature exceeds the CRITICAL level, as set below, then the Service Check will change to a CRITICAL state).
- -c: The critical flag. The number immediately following this option tells Opsview to change the state of the Service Check to CRITICAL if the value is above this number, e.g. '-c 75'.
A plugin-based service check comprises two component parts:
For example, the Service Check below returns the number of users connected to an Oracle database:
check_oracle_health --connect=$HOSTADDRESS$ --user=%ORACREDENTIALS:1% --password=%ORACREDENTIALS:2% --name=system --mode=connected-users
'check_oracle_health' is the plugin, and the remainder of the line are the arguments needed by the plugin in order to successfully log in and retrieve the number of users. (Items wrapped in $ symbols are known as Macros, and items wrapped in % symbols are known as Variables; both are covered in What are variables and how do they work?)
Administering Plugins in Opsview
Plugins can be added or removed via either the UI or the command line.
Importing a Plugin
Monitoring plugins are stored within
/opt/opsview/monitoringscripts/plugins/ on Opsview Collector servers. There are two ways in which you can add a new plugin to Opsview.
NOTE: the plugin must start with
check_ to be successfully imported.
A monitoring plugin can be imported from the Monitoring Plugins page within the Opsview user interface, this can be found via 'Configuration > Monitoring Plugins'
Once loaded, you will be presented with a view similar to the one below, listing all of your currently installed Monitoring Plugins. To import a Monitoring Plugin, click on the Import button:
The second way in which you can upload your Monitoring Plugin is via the command line. It is simply a case of copying the plugin to the
/opt/opsview/monitoringscripts/plugins/ folder and setting the appropriate permissions.
If you are already using Opsview, more detail on monitoring plugins can be found on our Knowledge Center.