diff options
-rwxr-xr-x | plugins-scripts/check_oracle.sh | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/plugins-scripts/check_oracle.sh b/plugins-scripts/check_oracle.sh index 2ac01ba2..1a23eb93 100755 --- a/plugins-scripts/check_oracle.sh +++ b/plugins-scripts/check_oracle.sh | |||
@@ -158,7 +158,7 @@ case "$cmd" in | |||
158 | }' | 158 | }' |
159 | ;; | 159 | ;; |
160 | --db) | 160 | --db) |
161 | pmonchk=`ps -ef | grep -v grep | grep "^${2}$" | grep -c pmon` | 161 | pmonchk=`ps -ef | grep -v grep | grep ${2} | grep -c pmon` |
162 | if [ ${pmonchk} -ge 1 ] ; then | 162 | if [ ${pmonchk} -ge 1 ] ; then |
163 | echo "${2} OK - ${pmonchk} PMON process(es) running" | 163 | echo "${2} OK - ${pmonchk} PMON process(es) running" |
164 | exit $STATE_OK | 164 | exit $STATE_OK |
@@ -207,6 +207,7 @@ EOF` | |||
207 | fi | 207 | fi |
208 | 208 | ||
209 | buf_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'` | 209 | buf_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'` |
210 | buf_hrx=`echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}'` | ||
210 | result=`sqlplus -s ${3}/${4}@${2} << EOF | 211 | result=`sqlplus -s ${3}/${4}@${2} << EOF |
211 | set pagesize 0 | 212 | set pagesize 0 |
212 | set numf '9999999.99' | 213 | set numf '9999999.99' |
@@ -221,16 +222,17 @@ EOF` | |||
221 | fi | 222 | fi |
222 | 223 | ||
223 | lib_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'` | 224 | lib_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'` |
225 | lib_hrx=`echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}'` | ||
224 | 226 | ||
225 | if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then | 227 | if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then |
226 | echo "${2} CRITICAL - Cache Hit Rates: $lib_hr% Lib -- $buf_hr% Buff" | 228 | echo "${2} CRITICAL - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" |
227 | exit $STATE_CRITICAL | 229 | exit $STATE_CRITICAL |
228 | fi | 230 | fi |
229 | if [ $buf_hr -le ${6} -o $lib_hr -le ${6} ] ; then | 231 | if [ $buf_hr -le ${6} -o $lib_hr -le ${6} ] ; then |
230 | echo "${2} WARNING - Cache Hit Rates: $lib_hr% Lib -- $buf_hr% Buff" | 232 | echo "${2} WARNING - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" |
231 | exit $STATE_WARNING | 233 | exit $STATE_WARNING |
232 | fi | 234 | fi |
233 | echo "${2} OK - Cache Hit Rates: $lib_hr% Lib -- $buf_hr% Buff" | 235 | echo "${2} OK - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" |
234 | 236 | ||
235 | exit $STATE_OK | 237 | exit $STATE_OK |
236 | ;; | 238 | ;; |
@@ -260,19 +262,20 @@ EOF` | |||
260 | ts_free=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($1)}'` | 262 | ts_free=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($1)}'` |
261 | ts_total=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($2)}'` | 263 | ts_total=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($2)}'` |
262 | ts_pct=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}'` | 264 | ts_pct=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}'` |
265 | ts_pctx=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print $3}'` | ||
263 | if [ "$ts_free" -eq 0 -a "$ts_total" -eq 0 -a "$ts_pct" -eq 0 ] ; then | 266 | if [ "$ts_free" -eq 0 -a "$ts_total" -eq 0 -a "$ts_pct" -eq 0 ] ; then |
264 | echo "No data returned by Oracle - tablespace $5 not found?" | 267 | echo "No data returned by Oracle - tablespace $5 not found?" |
265 | exit $STATE_UNKNOWN | 268 | exit $STATE_UNKNOWN |
266 | fi | 269 | fi |
267 | if [ "$ts_pct" -ge ${6} ] ; then | 270 | if [ "$ts_pct" -ge ${6} ] ; then |
268 | echo "${2} : ${5} CRITICAL - $ts_pct% used [ $ts_free / $ts_total MB available ]" | 271 | echo "${2} : ${5} CRITICAL - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" |
269 | exit $STATE_CRITICAL | 272 | exit $STATE_CRITICAL |
270 | fi | 273 | fi |
271 | if [ "$ts_pct" -ge ${7} ] ; then | 274 | if [ "$ts_pct" -ge ${7} ] ; then |
272 | echo "${2} : ${5} WARNING - $ts_pct% used [ $ts_free / $ts_total MB available ]" | 275 | echo "${2} : ${5} WARNING - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" |
273 | exit $STATE_WARNING | 276 | exit $STATE_WARNING |
274 | fi | 277 | fi |
275 | echo "${2} : ${5} OK - $ts_pct% used [ $ts_free / $ts_total MB available ]" | 278 | echo "${2} : ${5} OK - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" |
276 | exit $STATE_OK | 279 | exit $STATE_OK |
277 | ;; | 280 | ;; |
278 | *) | 281 | *) |