소스 검색

check_oracle: --tns bad string matching

check_oracle in the 1.4.15 release doesn't correctly parse the output gotten
from at least Oracle 11 (with german locales). I guess it's probably more.
Also it completely needlessly uses sed where basic bash string parsing actually
does more than suffice (and does not run into possible problems with locales
like sed ;)).
--
Just turning attached patch of github issue #1015 into a push request.
(Closes #1015)
Jan Wagner 12 년 전
부모
커밋
7abfcacdfe
2개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 0
      THANKS.in
  2. 1 1
      plugins-scripts/check_oracle.sh

+ 1 - 0
THANKS.in

@@ -315,3 +315,4 @@ Julius Kriukas
 Andy Brist
 Andy Brist
 Spenser Reinhardt
 Spenser Reinhardt
 Sam Kottler
 Sam Kottler
+Frederic Krueger

+ 1 - 1
plugins-scripts/check_oracle.sh

@@ -136,7 +136,7 @@ case "$cmd" in
     tnschk=` tnsping $2`
     tnschk=` tnsping $2`
     tnschk2=` echo  $tnschk | grep -c OK`
     tnschk2=` echo  $tnschk | grep -c OK`
     if [ ${tnschk2} -eq 1 ] ; then 
     if [ ${tnschk2} -eq 1 ] ; then 
-	tnschk3=` echo $tnschk | sed -e 's/.*(//' -e 's/).*//'`
+	tnschk3=${tnschk##*(}; tnschk3=${tnschk3%)*}
 	echo "OK - reply time ${tnschk3} from $2"
 	echo "OK - reply time ${tnschk3} from $2"
 	exit $STATE_OK
 	exit $STATE_OK
     else
     else