Module: check_mk
Branch: master
Commit: a8a1a21d3d3322e768d70923ea1d06ed37f1b819
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a8a1a21d3d3322…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Mon Aug 10 15:13:02 2015 +0200
#1279 check_curl (treasures): Added NTLM support
---
.werks/1279 | 9 +++++++++
ChangeLog | 1 +
doc/treasures/check_curl | 15 +++++++++++----
3 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/.werks/1279 b/.werks/1279
new file mode 100644
index 0000000..96daed3
--- /dev/null
+++ b/.werks/1279
@@ -0,0 +1,9 @@
+Title: check_curl (treasures): Added NTLM support
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i3
+Date: 1439212036
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 747bcd9..a53f217 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -41,6 +41,7 @@
* 2523 ipmi: new wato rule to set ignored sensors and activate/deactivate
summarizing
* 1277 check_ldap: It is now possible to specify a alternative Hostname...
* 1278 mssql_blocked_sessions: New Check to show blocked MSSQL Sessions
+ * 1279 check_curl (treasures): Added NTLM support
* 2315 FIX: windows agent: BOM replacement, fixed incorrect byte offset...
* 2316 FIX: windows agent: fix garbled output of cached agent plugins...
* 2358 FIX: check_mk_agent.solaris: more correct computation of zfs used space...
diff --git a/doc/treasures/check_curl b/doc/treasures/check_curl
index d0b5125..bdf6946 100755
--- a/doc/treasures/check_curl
+++ b/doc/treasures/check_curl
@@ -113,12 +113,20 @@ else
PROXYOPTIONS=
fi
+if [ "$1" = -NTLM ]
+then
+ NTLM=" --ntlm --negotiate -u $2 "
+ shift
+ shift
+else
+ NTLM=
+fi
URL=$1
PURL=$(echo $URL | awk -F "/" '{print $1"//"$3}')
if [ -z "$URL" ]
then
- echo "Usage: [-P PROXYUSER:PROXYPASS PROXYURL] URL [SEARCHTEXT]"
+ echo "Usage: [-P PROXYUSER:PROXYPASS PROXYURL] [-NTLM NTLM_USER:NTLM_PASSWORD]
URL [SEARCHTEXT]"
exit 3
fi
@@ -127,11 +135,10 @@ CONTENT=$2
# CURL="curl -A """Mozilla/4.0 (compatible; MSIE
6.0;)""" --silent --fail --insecure $PROXYOPTIONS $URL"
# CURL="curl -A Mozilla/4.0 (compatible; MSIE 6.0;) --silent --fail --insecure
$PROXYOPTIONS $URL"
# CURL="curl --silent --fail --insecure $PROXYOPTIONS $URL"
-
if [ "$CONTENT" ]
then
# if $CURL 2>&1 | fgrep -q "$CONTENT"
- if curl -A "Mozilla/4.0 (compatible; MSIE 6.0;)" --silent --fail --insecure
$PROXYOPTIONS $URL 2>&1 | fgrep -q "$CONTENT"
+ if curl $NTLM -A "Mozilla/4.0 (compatible; MSIE 6.0;)" --silent --fail
--insecure $PROXYOPTIONS $URL 2>&1 | fgrep -q "$CONTENT"
then
echo "OK - $PURL found '$CONTENT' in answer"
exit 0
@@ -149,7 +156,7 @@ then
fi
else
# OUTPUT=$($CURL >/dev/null 2>&1 | head -n 1 ; exit ${PIPESTATUS[0]})
- OUTPUT=$(curl -A "Mozilla/4.0 (compatible; MSIE 6.0;)" --silent --fail
--insecure $PROXYOPTIONS $URL >/dev/null 2>&1 | head -n 1 ; exit
${PIPESTATUS[0]})
+ OUTPUT=$(curl $NTLM -A "Mozilla/4.0 (compatible; MSIE 6.0;)" --silent
--fail --insecure $PROXYOPTIONS $URL >/dev/null 2>&1 | head -n 1 ; exit
${PIPESTATUS[0]})
exitcode=$?
if [ "$exitcode" = 0 ]
then