JNRPE Plugins
As of version 0.7.2, the plugin package is composed of five plugins:
The EXEC Plugin
The EXEC plugin is very simple. It's use is to run external (executable) plugins and return it's value to the caller (both the exit code and the output string). The main use of this plugin is to execute already existing non-java NAGIOS plugin.
Supported parameters are: * -e/--executable: The full path to the command to execute * -a/--args: The arguments to pass to the executable
Usage example
The following example shows how to monitor the disk usage using the native 'check_disk' plugin.
Configuration (using XML configuration style) :
<command name="CHECK_DISK" plugin_name="EXEC">
<arg name="executable" value="/path/to/check_disk" />
<arg name="args" value="-w $ARG1$ -c $ARG2$ $ARG3$" />
</command>
Configuration (using INI configuration style) :
CHECK_DISK : exec --executable /path/to/check_disk --args "-w $ARG1$ -c $ARG2$ $ARG3$ "
Invocation
check_nrpe -n -H {JNRPE_SERVER_IP} -c CHECK_DISK -a '10!20!/'
Of course, you must replace {JNRPE_SERVER_IP} with the IP address of your JNRPE server. $ARG1$ will be replaced by 10, $ARG2$ will be replaced by 20 and $ARG3$ will be replaced by '/'
The CHECK_JMX plugin
It's a plugin that allows the execution of JMX queries. Supported parameters are:
- -U/--url: JMX URL, for example: 'service:jmx:rmi:///jndi/rmi://localhost:1616/jmxrmi'
- -O/--object: Object name to be checked, for example, 'java.lang:type=Memory'
- -A/--attribute: Attribute of the object to be checked, for example, 'NonHeapMemoryUsage'
- -K/--attributeKey: Attribute key for -A attribute compound data, for example, 'used'
- -I/--infoattribute: Attribute of the object containing information for text output
- -J/--infokey: Attribute key for -I attribute compound data, for example, 'used'
- -w/--warning: Warning range
- -c/--critical: Critical range
- -u/--username: monitorRole jmx username
- -p/--password: monitorRole jmx password
Usage Example
The following example shows how to monitor the memory usage of a JBOSS application server.
Configuration (using XML configuration style) :
<command name="CHECK_JBOSS_JMX" plugin_name="CHECK_JMX">
<arg name="url" value="$ARG1$" />
<arg name="object" value="$ARG2$" />
<arg name="attribute" value="$ARG3$" />
<arg name="warning" value="$ARG4$" />
<arg name="critical" value="$ARG5$" />
</command>
Configuration (using INI configuration style) :
CHECK_JBOSS_JMX : CHECK_JMX --url $ARG1$ --object $ARG2$ --attribute $ARG3$ --warning $ARG4$ --critical $ARG5$
Of course, you must replace MY_JBOSS_SERVER_IP with the IP address of your JBOSS server. Any of the parameters could be hardcoded inside the JNRPE configuration.
The CHECK_ORACLE plugin
With this plugin, you can perform various checks agains an Oracle database without the need of installing the oracle client software: you only have to download the appropriate JDBC driver from the oracle site (a jar file) and put it in the same directory as this plugin (if you prefer, you can put such jar inside the lib/ext directory of your JRE installation).
Follows the list of checks this plugin supports:
- is Alive: checks if you can reach the database
- tablespace: checks how much tablespace space is available
- cache: checks the cache hit rate
Supported parameters are
- --alive: Tells the plugin to check if the database is reachable. This parameter needs the following arguments too:
- -u/--username: The Oracle username
- -p/--password: The Oracle password
- --db: The Oracle SID/SERVICE_ID
- --server: The database server IP address
- --tablespace <tablespace name> : Instructs the plugin to check how much tablespace space is available. This parameter needs the following arguments too:
- -u/--username: The Oracle username
- -p/--password: The Oracle password
- --db: The Oracle SID/SERVICE_ID
- --server: The database server IP address
- --cache: Tells the plugin to check the cache hit rate. This parameter also needs:
- -u/--username: The Oracle username
- -p/--password: The Oracle password
- --db: The Oracle SID/SERVICE_ID
- --server:The database server IP address
- -w/--warning: The warning range
- -c/--critical: The critical range
Usage Example
The following example, shows how to check that an Oracle database is alive.
Configuration (using XML configuration style) :
<command name="check_oracle_alive" plugin_name="CHECK_ORACLE">
<arg name="alive" />
<arg name="username" value="$ARG1$" />
<arg name="password" value="$ARG2$" />
<arg name="db" value="$ARG3$" />
<arg name="server" value="$ARG4$" />
</command>
Configuration (using INI configuration style) :
check_oracle_alive : CHECK_ORACLE --alive --username $ARG1$ --password $ARG2$ --db $ARG3$ --server $ARG4$
The CHECK_FILE plugin
This plugin is able to perform simple checks against files :
- Checks that a file exists (-f parameter )
- Checks that a file do not exists (-F parameter )
- Checks if file age falls inside a range
- Checks if file size falls inside a range
- Checks that a file contains a string
- Checks that a file do not contain a string
Supported parameters are :
- --file/-f [FILENAME]: Tells the plugin to return a critical status if the file FILENAME do not exists (do not use with --FILE)
- --FILE/-F [FILENAME]: Tells the plugin to return a critical status if the file FILENAME exists (do not use with --file)
- --critical/-c [AGE-RANGE]: Tells the plugin to return a critical status if the file age (in seconds) falls inside the AGE-RANGE range. Do not use with --sizecritical.
Example ranges :
300: - Critical status if file is older than 300 seconds
:300 - Critical status if the file is younger that 301 seconds.
50:200 - Critical status if file age is between 50 and 200 seconds.
Requires the following parameter:
- --warning/-w : same as --critical/-c, but returns a WARNING status. Do not use with -W.
Requires the following parameters :
- --sizecritical/-C [SIZE-RANGE]: Tells the plugin to return a critical status if the file size falls inside the SIZE-RANGE range.
Do not use with --critical.
Requires the following parameters :
- --sizewarning/-W: same as sizecritical/-C, but returns a WARNING status. Do not use with -w.
Requires the following parameters :
- --contains/-O [STRING,WARNINGRANGE,CRITICALRANGE]: Checks how many time STRING is found inside the file, than returns WARNING, OK or ERROR, according to the WARNINGRANGE and CRITICALRANGE.
Requires the following parameters :
- --notcontains/-N [STRING]: Tells the plugin to return a critical status if the file contains the string [STRING].
Requires the following parameters:
The CHECK_DISK plugin
This plugin monitors the free disk space on a specified disk.
Supported parameters are :
- --path/-p [path]: Tells the plugin what filesystem to monitor. On windows this will be in form of 'C:' , 'D:', etc., while on unix this will be a directory.
- --warning/-w [RANGE]: Instructs the plugin to return a warning state if the percent of free space falls inside the specified RANGE
- --critical/-c [RANGE]: Instructs the plugin to return a critical state if the percent of free space falls inside the specified RANGE
Example ranges :
10: - More free space than 10%
:30 - Less free space than 30%
15:20 - Free space between 15% and 20%.
The TEST plugin
A very simple plugin. It always return an OK state and the message you pass in with the -t/--text parameter.
Supported parameters are:
- -t/--text: The text to return