2 # +------------------------------------------------------------------+
3 # | ____ _ _ __ __ _ __ |
4 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
5 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
6 # | | |___| | | | __/ (__| < | | | | . \ |
7 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
10 # +------------------------------------------------------------------+
12 # This file is part of Check_MK.
13 # The official homepage is at http://mathias-kettner.de/check_mk.
15 # check_mk is free software; you can redistribute it and/or modify it
16 # under the terms of the GNU General Public License as published by
17 # the Free Software Foundation in version 2. check_mk is distributed
18 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
19 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
20 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
21 # tails. You should have received a copy of the GNU General Public
22 # License along with GNU Make; see the file COPYING. If not, write
23 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
24 # Boston, MA 02110-1301 USA.
26 # Developed by Thorsten Bruhns from OPITZ CONSULTING Deutschland GmbH
30 ocrcfgfile
=/etc
/oracle
/ocr.loc
31 olrcfgfile
=/etc
/oracle
/olr.loc
32 resourcefilter
="^NAME=|^TYPE=|^STATE=|^TARGET=|^ENABLED="
34 # .--Functions-----------------------------------------------------------.
36 # | | ___| _ _ __ ___| |_(_) ___ _ __ ___ |
37 # | | |_ | | | | '_ \ / __| __| |/ _ \| '_ \/ __| |
38 # | | _|| |_| | | | | (__| |_| | (_) | | | \__ \ |
39 # | |_| \__,_|_| |_|\___|\__|_|\___/|_| |_|___/ |
41 # +----------------------------------------------------------------------+
43 # '----------------------------------------------------------------------'
45 function set_has_env
(){
46 test -f ${ocrcfgfile} ||
exit 0
47 local_has_type
=$
(cat $ocrcfgfile |
grep "^local_only=" | cut
-d"=" -f2 |
tr '[:lower:]' '[:upper:]')
48 local_has_type
=${local_has_type:-"FALSE"}
50 if [ -f ${olrcfgfile} ] ; then
51 has_ORACLE_HOME
=$
(cat $olrcfgfile |
grep "^crs_home=" | cut
-d"=" -f2)
53 # There is no olr.cfg in 10.2 and 11.1
54 # we try to get the ORA_CRS_HOME from /etc/init.d/init.cssd
56 INITCSSD
=/etc
/init.d
/init.cssd
57 if [ ! -f ${INITCSSD} ] ; then
60 has_ORACLE_HOME
=$
(grep "^ORA_CRS_HOME=" ${INITCSSD} | cut
-d"=" -f2-)
64 CRSCTL
=${has_ORACLE_HOME}/bin
/crsctl
65 OLSNODES
=${has_ORACLE_HOME}/bin
/olsnodes
66 CRS_STAT
=${has_ORACLE_HOME}/bin
/crs_stat
69 function printhasdata
() {
70 ps
-e |
grep cssd.bin
> /dev
/null ||
exit 0
72 echo "<<<oracle_crs_version:sep(124)>>>"
73 $CRSCTL query has releaseversion
75 echo "<<<oracle_crs_res>>>"
76 $CRSCTL stat res
-f |
grep -E $resourcefilter
79 function printcrsdata
() {
80 ps
-e |
grep -e ohasd.bin
-e crsd.bin
> /dev
/null ||
exit 0
82 echo "<<<oracle_crs_version:sep(124)>>>"
83 crs_version
=$
($CRSCTL query crs releaseversion
)
86 echo "<<<oracle_crs_voting>>>"
87 $CRSCTL query css votedisk |
grep "^ [0-9]"
89 ps
-e |
grep crsd.bin
> /dev
/null ||
exit 0
90 echo "<<<oracle_crs_res:sep(124)>>>"
91 OLS_NODENAME
=$
($OLSNODES -l)
93 echo "nodename|"$OLS_NODENAME
95 crs_version_short
=$
(echo $crs_version | cut
-d"[" -f2- | cut
-d"." -f-2 |
sed 's/\.//')
96 if [ $
(($crs_version_short)) -ge 112 ] ; then
97 $CRSCTL stat res
-v -n $OLS_NODENAME -init |
grep -E $resourcefilter |
sed "s/^/csslocal\|/"
98 for nodelist
in $
($OLSNODES)
100 $CRSCTL stat res
-v -n $nodelist |
grep -E $resourcefilter |
sed "s/^/$nodelist\|/"
103 $CRS_STAT -f -c $OLS_NODENAME |
grep -E $resourcefilter |
sed "s/^/$OLS_NODENAME\|/"
107 # .--Main----------------------------------------------------------------.
109 # | | \/ | __ _(_)_ __ |
110 # | | |\/| |/ _` | | '_ \ |
111 # | | | | | (_| | | | | | |
112 # | |_| |_|\__,_|_|_| |_| |
114 # +----------------------------------------------------------------------+
116 # '----------------------------------------------------------------------'
119 echo "<<<oracle_crs_res>>>"
120 echo "<<<oracle_crs_version>>>"
121 echo "<<<oracle_crs_votedisk>>>"
122 if [ $local_has_type = 'FALSE' ] ; then