summaryrefslogtreecommitdiffstats
path: root/plugins-scripts/check_oracle.sh
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2003-01-29 05:10:49 (GMT)
committerTon Voon <tonvoon@users.sourceforge.net>2003-01-29 05:10:49 (GMT)
commit4755abc5915ce3e77304823928ee31f9c5ac498d (patch)
treedad456b9fc0de55d5053f1bbb82a49ad091b6607 /plugins-scripts/check_oracle.sh
parent455e7c1a52ea8ea7322f783d86569e59b84cf0a5 (diff)
downloadmonitoring-plugins-4755abc5915ce3e77304823928ee31f9c5ac498d.tar.gz
Added dummy login test (650970 - Ton Voon)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@263 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins-scripts/check_oracle.sh')
-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 d2a84fe..7e2f6f9 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