Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

check_sharepoint.pl

Rating
10 votes
Favoured:
2
Current Version
1.2
Compatible With
  • Nagios 2.x
  • Nagios 3.x
  • Nagios XI
License
GPL
Hits
108506
Files:
FileDescription
check_sharepoint.plPlugin
LICENSE.txtLicense
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
check_sharepoint.pl
Perl script for functional checking of SharePoint sites.

Similar to check_http but with ntlm support. Will also handle form logons for sites published via ISA/TMG servers.
- Works with both integrated NTML and forms based authentication.
- returns site page load times (with perfmon output).
- warning and/or critical thresholds can be set for site load times.
- semi-informative failure messages (auth failure, insufficient site permissions, 401's, etc)
- ability to check for a specific string on a page

**Note**
- Perl module WWW::Curl::Easy is required.
- libcurl must have ntlm enabled for integrated authentication site checks to work. ('curl-config --features' will show you if you have it)
- This will probably work on Nagios XI but it hasn't been tested yet

Tested with Sharepoint 2007 & 2010

**v1.2 changes**
- added verbose output
- some bug fixes

-------------------------------------------------------------------

check_sharepoint.pl v1.2
Copyright (c) 2012 PCS-IT Services B.V. (www.pcs-it.nl)

Usage: check_sharepoint.pl -H -u -p
-w [warn time] -c [crit time] -t [timeout]
-s [search string] -l [path] -v -form -http

Nagios script for checking of SharePoint web services

Options:
-H Address or hostname of SharePoint site (required)
-u Username (required)
-p Password (required)
-w Warning threshold in seconds
-c Critical threshold in seconds
-t Connection timeout in seconds (default is 60 seconds)
-s Search for custom string on page
-l Specific location or path instead of site root
-v Verbose. HTTP headers in output. 2x (-v -v) includes HTML. 3x both
-form Use forms based authentication (default is ntlm)
-http Connect via standard http (default is https)

Examples:
Check site behind a TMG server using forms based authentication with warning and critital times
check_sharepoint.pl -H portal.hostname.com -u username -p password -form -w 5 -c 10

Check site with integtrated authentication at a specific location within the site
check_sharepoint.pl -H portal.hostname.com -u username -p password -l '/Sites/Wiki%20Pages/default.aspx'

Check site with integtrated authentication that contins the string 'random string'
check_sharepoint.pl -H portal.hostname.com -u username -p password -s 'random string'

Notes:
- If you use special characters in your usernames and/or passwords, authentication will
have a better chance of working if you enclose them in quotes.
- If a URL path is included using the -l option it is must be encoded (e.g. - /Wiki%20Pages/default.aspx)
- Connections are always assumed to be https unless the -http option is used
- Forms authentication is always assumed to be via a ISA/TMG server.
- libcurl must have NTML listed in its features in order for integrated (NTML) authentication
to work. Runing 'curl-config --features' will show if this is present.
Reviews (9)
byEOSjp, February 1, 2021
Replace the line:
my $curl_features = `curl-config --features`;

With:
my $curl_features = `curl -V`;
Great script, but NTLM problem caused by perlcurl?
I tried to use this script for another website but got AUTHENTICATION FAILED. Using tcpdump showed Basic Authentication. changing the line
$curl->setopt(CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
into
$curl->setopt(CURLOPT_HTTPAUTH, 8);
solved this problem. It seems that the constant CURLAUTH_NTLM has the value 0 in my case instead of 8. On another system with perl-WWW-Curl-4.15-12.el7.x86_64 instead of perl-WWW-Curl-4.09-4.el6.i686 the value of CURLAUTH_NTLM = 8 so the root casus must be in perl-WWW-Curl-4.09-4.el6.i686
Script works fine now
I use it for Sharepoint 2010 and 2013. It is easy to implement and with a small modification you can use it for every ntlm website. The only thing you have to take care is about WWW:Curl::Easy. In RHEL there is a bug that you get 401... Use it from CPAN and it will work as it should.
bysiggi, February 17, 2015
Needs to update for Sharepoint 2013 it seems.. I have everything correct for the setup however getting

CRITICAL: Authentication failed for account

# curl-config --features
SSL
IPv6
libz
NTLM
NTLM_WB

Any ideas? if this should be ok with SharePoint 2013
bypvdputte, August 27, 2014
Works fine, only caveat: would not work with libwww-curl-perl 4.12 in Debian Squeeze (kept getting 401 unauthorized). Installing 4.15 from squeeze-backports fixed it.
This script has a bug where it doesn't do ntlm auth correctly. I was able to fix it by replacing the lines that set CURLOPT_USERNAME and CURLOPT_PASSWORD with:

$curl->setopt(CURLOPT_USERPWD,$username . ':' . $password);
I have also the 401 Unauthorized error when I run the check.
It use curl and WWW::Curl::easy .
When I run the curl command , I have first a 401 error , then I have the HTTP/1.1 200 Ok message , so the connection looks ok but the check_sharepoint.pl check take only the 401 as result.

If someone can help thanks,
Script looks great, just what I'm looking for but it always returns a 401 Unauthorized error...

Definitely correct credentials and infact a very basic NTLM script here check_http_ntlm.pl works perfectly but lacks any performance data.

Would appreciate any help...!
bydceola, November 13, 2012
This plugin works very well. I'm currently using it to monitor all of my SharePoint site collections as well as our MS CRM site. It works great for any page that requires NTLM authentication.

I've actually been wondering if there is a way to 'convert' this script to a windows friendly exe, in order to run it from a few client side systems through nsclient++. I've tried a few things myself but it kept coming back to not being able to get CURL installed on windows...