summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xplugins-scripts/check_oracle.sh49
1 files changed, 34 insertions, 15 deletions
diff --git a/plugins-scripts/check_oracle.sh b/plugins-scripts/check_oracle.sh
index d2a84fe7..7e2f6f99 100755
--- a/plugins-scripts/check_oracle.sh
+++ b/plugins-scripts/check_oracle.sh
@@ -36,6 +36,7 @@ print_usage() {
36 echo "Usage:" 36 echo "Usage:"
37 echo " $PROGNAME --tns <Oracle Sid or Hostname/IP address>" 37 echo " $PROGNAME --tns <Oracle Sid or Hostname/IP address>"
38 echo " $PROGNAME --db <ORACLE_SID>" 38 echo " $PROGNAME --db <ORACLE_SID>"
39 echo " $PROGNAME --login <ORACLE_SID>"
39 echo " $PROGNAME --oranames <Hostname>" 40 echo " $PROGNAME --oranames <Hostname>"
40 echo " $PROGNAME --help" 41 echo " $PROGNAME --help"
41 echo " $PROGNAME --version" 42 echo " $PROGNAME --version"
@@ -53,6 +54,8 @@ print_help() {
53 echo "--db=SID" 54 echo "--db=SID"
54 echo " Check local database (search /bin/ps for PMON process and check" 55 echo " Check local database (search /bin/ps for PMON process and check"
55 echo " filesystem for sgadefORACLE_SID.dbf" 56 echo " filesystem for sgadefORACLE_SID.dbf"
57 echo "--login=SID"
58 echo " Attempt a dummy login and alert if not ORA-01017: invalid username/password"
56 echo "--oranames=Hostname" 59 echo "--oranames=Hostname"
57 echo " Check remote Oracle Names server" 60 echo " Check remote Oracle Names server"
58 echo "--help" 61 echo "--help"
@@ -81,6 +84,26 @@ case "$1" in
81 ;; 84 ;;
82esac 85esac
83 86
87# Information options
88case "$cmd" in
89--help)
90 print_help
91 exit $STATE_OK
92 ;;
93-h)
94 print_help
95 exit $STATE_OK
96 ;;
97--version)
98 print_revision $PLUGIN $REVISION
99 exit $STATE_OK
100 ;;
101-V)
102 print_revision $PLUGIN $REVISION
103 exit $STATE_OK
104 ;;
105esac
106
84# Hunt down a reasonable ORACLE_HOME 107# Hunt down a reasonable ORACLE_HOME
85if [ -z "$ORACLE_HOME" ] ; then 108if [ -z "$ORACLE_HOME" ] ; then
86 # Adjust to taste 109 # Adjust to taste
@@ -156,21 +179,17 @@ case "$cmd" in
156 exit $STATE_CRITICAL 179 exit $STATE_CRITICAL
157 fi 180 fi
158 ;; 181 ;;
159--help) 182--login)
160 print_help 183 loginchk=`sqlplus dummy/user@$2 < /dev/null`
161 exit $STATE_OK 184 loginchk2=` echo $loginchk | grep -c ORA-01017`
162 ;; 185 if [ ${loginchk2} -eq 1 ] ; then
163-h) 186 echo "OK - dummy login connected"
164 print_help 187 exit $STATE_OK
165 exit $STATE_OK 188 else
166 ;; 189 loginchk3=` echo "$loginchk" | grep "ORA-" | head -1`
167--version) 190 echo "CRITICAL - $loginchk3"
168 print_revision $PLUGIN $REVISION 191 exit $STATE_CRITICAL
169 exit $STATE_OK 192 fi
170 ;;
171-V)
172 print_revision $PLUGIN $REVISION
173 exit $STATE_OK
174 ;; 193 ;;
175*) 194*)
176 print_usage 195 print_usage