From b2a29995ab822f173127aed4225dc343e54cd26d Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Sun, 3 Aug 2014 14:45:55 +0200 Subject: [PATCH] check_oracle: Fix --tns bad string matching - Adding 10_check_oracle_tns_bad_string.dpatch --- debian/patches/00list | 1 + .../10_check_oracle_tns_bad_string.dpatch | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 debian/patches/10_check_oracle_tns_bad_string.dpatch diff --git a/debian/patches/00list b/debian/patches/00list index 35b85ec..c41ae2e 100644 --- a/debian/patches/00list +++ b/debian/patches/00list @@ -1,2 +1,3 @@ 02_check_icmp_links.dpatch # commited upstream +10_check_oracle_tns_bad_string.dpatch diff --git a/debian/patches/10_check_oracle_tns_bad_string.dpatch b/debian/patches/10_check_oracle_tns_bad_string.dpatch new file mode 100644 index 0000000..559fb73 --- /dev/null +++ b/debian/patches/10_check_oracle_tns_bad_string.dpatch @@ -0,0 +1,35 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 02_10_check_oracle_tns_bad_string.dpatch by Jan Wagner +## +## DP: Create symlinks for check_icmp to provide default values for some situations + +From: Frederic Krueger +Subject: Fix 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 ;)). + +Origin: upstream, https://github.com/monitoring-plugins/monitoring-plugins/pull/1191.patch +Bug: https://github.com/monitoring-plugins/monitoring-plugins/issues/1015 + +@DPATCH@ +--- +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 +-- +2.0.3 +