Friday, April 8, 2011

how to pass arguments for check_db in nagios

File Download
Shell Script wrapper
Compiled DbCheck Class
DbCheck java source code
JSAP java command line parser

Remote oracle database check using JDBC drivers. Supports custom SQL queries and regular expression match. Provides similar funcationality as sitescope Db monitor.

This plugin can check almost every aspect of oracle database, written in java for portability.

Compiled with JDK 1.5.0_06

Uses JSAP command line parser

to compile : copy JSAP-2.0a.jar in a directory, expand JSAP-2.0a.jar in the same directory using command jar xvf JSAP-2.0a.jar

Use : javac -cp .:com/martiansoftware/jsap/JSAP.*

this should generate DbCheck.class file

Setup Nagios Environment:

Copy DbCheck.class, check_db to /usr/local/nagios/libexec
create /usr/local/nagios/libexec/lib directory
Copy JSAP-2.0a.jar, classes12.jar (Take from $ORACLE_HOME/jdbc/lib), sql files to /usr/local/nagios/libexec/lib directory

Nagios plugin to check output of a sql query, matched with a regular expression. Currently supports numeric data checks only.

Print help message


Hostname/ip address of database server.


Listener port, default is 1521. (default: 1521)


Oracle database SID.


Oracle database user to connect.


Oracle database user password.


Full path of sql file to be executed.


PERL style Regular Expression to match in SQL output. Check value must
be enclosed between (), should match only one field and must be enclosed
between single quotes. Example 'SYSTEM.*,.*,(.*)'


Warning value for matched expression. Normally warning < critical value.
If your check want to alert when result < warning , set critical less
than warning


Critical value for matched expression. Should be more than Warning
1. If not check behaviour is reversed, see warning help text above.


Label for matched regex value i.e FieldName.
Usage: DbCheck --help -H -p -s -l -x -f -r -w -c -L 


No comments:

Post a Comment