Website monitoring verifying NTLM Auth

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
gm_rajkumar
Posts: 187
Joined: Tue Feb 28, 2012 7:08 am
Location: CA, USA

Website monitoring verifying NTLM Auth

Post by gm_rajkumar »

I have downloaded this below plugin http://exchange.nagios.org/directory/Pl ... lm/details to monitor my Intranet site like https://mynet.test.com/site/Home.aspx.

I just wanted to know how to monitor this site using NTLM auth, added to this parameter to execute this command.

It returns below message::

./check_http_ntlm: line 1: HTTP/1.1 No such file or directory
./check_http_ntlm: line 2: Server:: command not found
./check_http_ntlm: line 3: SPRequestGuid:: command not found
./check_http_ntlm: line 4: WWW-Authenticate :: command not found
./check_http_ntlm: line 5: MicrosoftSharePointTeamServices:: command not found
./check_http_ntlm: line 6: Date:: command not found
like this..

please check and revert on this.

Regards,
Raj.
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: Website monitoring verifying NTLM Auth

Post by nscott »

Can you post the exact command you're running to use that plugin?
Nicholas Scott
Former Nagios employee
gm_rajkumar
Posts: 187
Joined: Tue Feb 28, 2012 7:08 am
Location: CA, USA

Re: Website monitoring verifying NTLM Auth

Post by gm_rajkumar »

I tried with below command:

# ./check_http_ntlm mynet.test.com testuser:abc@123n
./check_http_ntlm: line 1: HTTP/1.1 No such file or directory
./check_http_ntlm: line 2: Server:: command not found
./check_http_ntlm: line 3: SPRequestGuid:: command not found
./check_http_ntlm: line 4: WWW-Authenticate :: command not found
./check_http_ntlm: line 5: MicrosoftSharePointTeamServices:: command not found
./check_http_ntlm: line 6: Date:: command not found

it returns the above message. please let me know where exactly to check on this.

This is the exact source code of the plugin.


#!/bin/bash
PROG=/usr/bin/curl
HOST=$1
USER=$2
PASSWORD=$3
FILE=/tmp/check_http_ntlm
HALT=200

$PROG -s -S --ntlm -D $FILE -u $USER:$PASSWORD $HOST > /dev/null

STATUS=`grep -w 200 $FILE | awk '{ print $0 }'`

grep -q -w $HALT $FILE
if [ $? -eq 0 ]
then
echo "$STATUS|ntlm=0;1;0;0"
else echo "Unable to login!|ntlm=1;1;0;0"
exit 2
fi


Regards,
Raj
yancy
Posts: 523
Joined: Thu Oct 06, 2011 10:12 am

Re: Website monitoring verifying NTLM Auth

Post by yancy »

gm_rajkumar,

make sure your not running this from /tmp, because it looks like it will overwrite itself

also, The script takes arguments $1 $2 $3

where $1 = host
$2 = user
$3 = password

so it should look like:

/check_http_ntlm mynet.test.com testuser abc@123n

(note no colon between user and password)
gm_rajkumar
Posts: 187
Joined: Tue Feb 28, 2012 7:08 am
Location: CA, USA

Re: Website monitoring verifying NTLM Auth

Post by gm_rajkumar »

Further tested to execute this command, i have got below results. I think command is running fine, issue with the Script (Plugin).

[root@monitoring libexec]# /usr/bin/curl -s -S --ntlm -D /usr/local/nagios/libexec/check_http_ntlm -u testuser:abc@123n mynet.test.com
<head><title>Document Moved</title></head>
<body><h1>Object Moved</h1>This document may be found <a HREF="http://mynet.test.com/SitePages/Home.as ... </a></body>[root@monitoring libexec]#



I tried with the command however im getting below issue. kindly let me know what needs to be checked further on this.

libexec]# ./check_http_ntlm mynet.test.com testuser abc@123n
./check_http_ntlm: line 1: HTTP/1.1: No such file or directory
./check_http_ntlm: line 2: Server:: command not found
./check_http_ntlm: line 3: SPRequestGuid:: command not found
./check_http_ntlm: line 4: WWW-Authenticate:: command not found
./check_http_ntlm: line 5: X-Powered-By:: command not found
./check_http_ntlm: line 6: MicrosoftSharePointTeamServices:: command not found
./check_http_ntlm: line 7: Date:: command not found
./check_http_ntlm: line 8: Content-Length:: command not found
: command not foundline 9:
./check_http_ntlm: line 10: HTTP/1.1: No such file or directory
./check_http_ntlm: line 11: Content-Type:: command not found
./check_http_ntlm: line 12: Location:: command not found
./check_http_ntlm: line 13: Server:: command not found
./check_http_ntlm: line 14: SPRequestGuid:: command not found
./check_http_ntlm: line 15: Set-Cookie:: command not found
./check_http_ntlm: line 16: X-SharePointHealthScore:: command not found
./check_http_ntlm: line 17: Persistent-Auth:: command not found
./check_http_ntlm: line 18: X-Powered-By:: command not found
./check_http_ntlm: line 19: MicrosoftSharePointTeamServices:: command not found
./check_http_ntlm: line 20: Date:: command not found
./check_http_ntlm: line 21: Content-Length:: command not found
: command not foundline 22:


Regards,
Raj.
yancy
Posts: 523
Joined: Thu Oct 06, 2011 10:12 am

Re: Website monitoring verifying NTLM Auth

Post by yancy »

Raj,

Can you check if your curl supports NTLM using "curl -V"

for example:

curl -V

curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.13.1.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz

-Yancy
gm_rajkumar
Posts: 187
Joined: Tue Feb 28, 2012 7:08 am
Location: CA, USA

Re: Website monitoring verifying NTLM Auth

Post by gm_rajkumar »

Please find the results, let me know if you need further on this.

# curl -V
curl 7.15.5 (i386-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
Protocols: tftp ftp telnet dict ldap http file https ftps
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz

Regards,
Raj.
yancy
Posts: 523
Joined: Thu Oct 06, 2011 10:12 am

Re: Website monitoring verifying NTLM Auth

Post by yancy »

Raj,

What happends when you do run check_http_ntlm with no arguments.

./check_http_ntlm
curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information
Unable to login!|ntlm=1;1;0;0


-Yancy
gm_rajkumar
Posts: 187
Joined: Tue Feb 28, 2012 7:08 am
Location: CA, USA

Re: Website monitoring verifying NTLM Auth

Post by gm_rajkumar »

You're right:

]# ./check_http_ntlm
curl: no URL specified!
curl: try 'curl --help' for more information
Unable to login!|ntlm=1;1;0;0

I deleted the plugin and updated with new one, now im getting below message.

]# ./check_http_ntlm mynet.test.com testuser abc@123n
Unable to login!|ntlm=1;1;0;0

Let me know if any thing else needs to check.
Regards
Raj.
yancy
Posts: 523
Joined: Thu Oct 06, 2011 10:12 am

Re: Website monitoring verifying NTLM Auth

Post by yancy »

try this:

Code: Select all

 curl -s -S --ntlm -D /tmp/curlTest -u testuser:abc@123n http://mynet.test.com/SitePages/Home.aspx 
then, check the result:

Code: Select all

 cat /tmp/curlTest 
Locked