summaryrefslogtreecommitdiffstats
path: root/plugins-scripts/check_oracle.sh
diff options
context:
space:
mode:
authorBrian De Wolf <git@bldewolf.com>2013-01-16 01:03:03 (GMT)
committerHolger Weiss <holger@zedat.fu-berlin.de>2013-03-25 22:25:08 (GMT)
commitb57dc1b3a0b7e43739c60f3f317416b0f3aa793c (patch)
treeba3b36dd3682610926778199df7932de3e5322e1 /plugins-scripts/check_oracle.sh
parente0eb2ebca37dc5d809979e2372b4cb95e7696b8b (diff)
downloadmonitoring-plugins-b57dc1b3a0b7e43739c60f3f317416b0f3aa793c.tar.gz
Add option to perform real login in check_oracle
The Oracle plugin has no option for testing for a successful login. The closest option to this is --login, which uses a fixed set of credentials and expects to receive the logon failure error code. This patch adds an option called --connect. This option takes a full SID and returns success if it doesn't detect any error codes. With this, we can check that a database is allowing logins from valid credentials (and avoid filling up DB logs with failed authentications).
Diffstat (limited to 'plugins-scripts/check_oracle.sh')
-rwxr-xr-xplugins-scripts/check_oracle.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/plugins-scripts/check_oracle.sh b/plugins-scripts/check_oracle.sh
index 664795e..2a8ab21 100755
--- a/plugins-scripts/check_oracle.sh
+++ b/plugins-scripts/check_oracle.sh
@@ -18,6 +18,7 @@ print_usage() {
18 echo " $PROGNAME --tns <Oracle Sid or Hostname/IP address>" 18 echo " $PROGNAME --tns <Oracle Sid or Hostname/IP address>"
19 echo " $PROGNAME --db <ORACLE_SID>" 19 echo " $PROGNAME --db <ORACLE_SID>"
20 echo " $PROGNAME --login <ORACLE_SID>" 20 echo " $PROGNAME --login <ORACLE_SID>"
21 echo " $PROGNAME --connect <ORACLE_SID>"
21 echo " $PROGNAME --cache <ORACLE_SID> <USER> <PASS> <CRITICAL> <WARNING>" 22 echo " $PROGNAME --cache <ORACLE_SID> <USER> <PASS> <CRITICAL> <WARNING>"
22 echo " $PROGNAME --tablespace <ORACLE_SID> <USER> <PASS> <TABLESPACE> <CRITICAL> <WARNING>" 23 echo " $PROGNAME --tablespace <ORACLE_SID> <USER> <PASS> <TABLESPACE> <CRITICAL> <WARNING>"
23 echo " $PROGNAME --oranames <Hostname>" 24 echo " $PROGNAME --oranames <Hostname>"
@@ -39,6 +40,8 @@ print_help() {
39 echo " filesystem for sgadefORACLE_SID.dbf" 40 echo " filesystem for sgadefORACLE_SID.dbf"
40 echo "--login SID" 41 echo "--login SID"
41 echo " Attempt a dummy login and alert if not ORA-01017: invalid username/password" 42 echo " Attempt a dummy login and alert if not ORA-01017: invalid username/password"
43 echo "--connect SID"
44 echo " Attempt a login and alert if an ORA- error is returned"
42 echo "--cache" 45 echo "--cache"
43 echo " Check local database for library and buffer cache hit ratios" 46 echo " Check local database for library and buffer cache hit ratios"
44 echo " ---> Requires Oracle user/password and SID specified." 47 echo " ---> Requires Oracle user/password and SID specified."
@@ -187,6 +190,18 @@ case "$cmd" in
187 exit $STATE_CRITICAL 190 exit $STATE_CRITICAL
188 fi 191 fi
189 ;; 192 ;;
193--connect)
194 connectchk=`sqlplus $2 < /dev/null`
195 connectchk2=` echo $connectchk | grep -c ORA-`
196 if [ ${connectchk2} -eq 0 ] ; then
197 echo "OK - login successful"
198 exit $STATE_OK
199 else
200 connectchk3=` echo "$connectchk" | grep "ORA-" | head -1`
201 echo "CRITICAL - $connectchk3"
202 exit $STATE_CRITICAL
203 fi
204 ;;
190--cache) 205--cache)
191 if [ ${5} -gt ${6} ] ; then 206 if [ ${5} -gt ${6} ] ; then
192 echo "UNKNOWN - Warning level is less then Crit" 207 echo "UNKNOWN - Warning level is less then Crit"