summaryrefslogtreecommitdiffstats
path: root/web/attachments/39883-check_oracle.patch
blob: 1978e30c665b974c3b487ad512d2833195459f76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
*** check_oracle.original	Mon Dec  9 15:57:44 2002
--- check_oracle	Mon Dec  9 16:24:28 2002
***************
*** 36,41 ****
--- 36,42 ----
    echo "Usage:"
    echo "  $PROGNAME --tns <Oracle Sid or Hostname/IP address>"
    echo "  $PROGNAME --db <ORACLE_SID>"
+   echo "  $PROGNAME --login <ORACLE_SID>"
    echo "  $PROGNAME --oranames <Hostname>"
    echo "  $PROGNAME --help"
    echo "  $PROGNAME --version"
***************
*** 53,58 ****
--- 54,61 ----
    echo "--db=SID"
    echo "   Check local database (search /bin/ps for PMON process and check"
  	echo "   filesystem for sgadefORACLE_SID.dbf"
+   echo "--login=SID"
+   echo "   Attempt a dummy login and alert if not ORA-01017: invalid username/password"
    echo "--oranames=Hostname"
    echo "   Check remote Oracle Names server"
    echo "--help"
***************
*** 81,86 ****
--- 84,109 ----
      ;;
  esac
  
+ # Information options
+ case "$cmd" in
+ --help)
+ 		print_help
+     exit $STATE_OK
+     ;;
+ -h)
+ 		print_help
+     exit $STATE_OK
+     ;;
+ --version)
+ 		print_revision $PLUGIN $REVISION
+     exit $STATE_OK
+     ;;
+ -V)
+ 		print_revision $PLUGIN $REVISION
+     exit $STATE_OK
+     ;;
+ esac
+ 
  # Hunt down a reasonable ORACLE_HOME
  if [ -z "$ORACLE_HOME" ] ; then
  	# Adjust to taste
***************
*** 156,177 ****
  	exit $STATE_CRITICAL
      fi
      ;;
! --help)
! 		print_help
!     exit $STATE_OK
      ;;
- -h)
- 		print_help
-     exit $STATE_OK
-     ;;
- --version)
- 		print_revision $PLUGIN $REVISION
-     exit $STATE_OK
-     ;;
- -V)
- 		print_revision $PLUGIN $REVISION
-     exit $STATE_OK
-     ;;
  *)
      print_usage
  		exit $STATE_UNKNOWN
--- 179,196 ----
  	exit $STATE_CRITICAL
      fi
      ;;
! --login)
!     loginchk=`sqlplus dummy/user@$2 < /dev/null`
!     loginchk2=` echo  $loginchk | grep -c ORA-01017`
!     if [ ${loginchk2} -eq 1 ] ; then 
! 	echo "OK - dummy login connected"
! 	exit $STATE_OK
!     else
! 	loginchk3=` echo "$loginchk" | grep "ORA-" | head -1`
! 	echo "CRITICAL - $loginchk3"
! 	exit $STATE_CRITICAL
!     fi
      ;;
  *)
      print_usage
  		exit $STATE_UNKNOWN