[monitoring-plugins] check_oracle: --tns bad string matching

Jan Wagner git at monitoring-plugins.org
Sun Jul 20 23:20:07 CEST 2014


 Module: monitoring-plugins
 Branch: maint
 Commit: d8b81e9ef3947a36e2647f4e54a63e3b259b103b
 Author: Jan Wagner <waja at cyconet.org>
   Date: Tue Oct  1 14:59:35 2013 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=d8b81e9

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 and #1191)

---

 THANKS.in                       | 1 +
 plugins-scripts/check_oracle.sh | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/THANKS.in b/THANKS.in
index 883387e..0c2dc84 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -323,3 +323,4 @@ Eric J. Mislivec
 Jean-Claude Computing
 Andy Brist
 Mikael Falkvidd
+Frederic Krueger
diff --git a/plugins-scripts/check_oracle.sh b/plugins-scripts/check_oracle.sh
index ceac95d..1873a3c 100755
--- a/plugins-scripts/check_oracle.sh
+++ b/plugins-scripts/check_oracle.sh
@@ -137,7 +137,7 @@ case "$cmd" in
     tnschk=` tnsping $2`
     tnschk2=` echo  $tnschk | grep -c OK`
     if [ ${tnschk2} -eq 1 ] ; then 
-	tnschk3=` echo $tnschk | sed -e 's/.*(//' -e 's/).*//'`
+	tnschk3=${tnschk##*(}; tnschk3=${tnschk3%)*}
 	echo "OK - reply time ${tnschk3} from $2"
 	exit $STATE_OK
     else



More information about the Commits mailing list