Check URL with authentication


#1

Hi all,

I’d like to monitor a Sharepoint 2010 site with Windows Authentication. I’ve tried the following command without success:

./check_http -H 1.1.1.1 -s TextToFind -u MySharepointSite/EN/Pages/Homepage.aspx -a user:pass

I always get “Unauthorized” output. The user and pass are valid and have read privileges on the site.

What am I doing wrong?

Is there another way / plugin for doing this?

Thanks in advance


#2

Hi,

I’ve managed to test my Sharepoint site using a powershell script from NRPE. Here’s the codo I’m using, maybe it helps someone:

$webClient = new-object System.Net.WebClient
$webClient.Headers.Add("user-agent", "PowerShell Script")
$webClient.UseDefaultCredentials = $true
   $output = ""

   $startTime = get-date
   $output = $webClient.DownloadString("http://mysharepointsite.com")
   $endTime = get-date

   if ($output -like "*test*") {
           "Success`t`t" + $startTime.DateTime + "`t`t" + ($endTime - $startTime).TotalSeconds + " seconds"; Exit 0
   } else {
            "Fail`t`t" + $startTime.DateTime + "`t`t" + ($endTime - $startTime).TotalSeconds + " seconds"; Exit 2
   }

#3

If you can’t figure out a method that works for you then you could resort to using Selenium. If you haven’t heard of it, it is a website check automaton tool which creates a new browser session, goes to the site and does whatever you tell it to do.

With a little work you could set it up and have it check anything you want. I have found that it is the best tool for doing site checks because it allows for in depth checking to make sure the users are able to see and use everything they are supposed to.

If you need any help setting up selenium to work with nagios let me know, I may be able to help.

EDIT: I want to add, selenium tends to be a bit of a system hog since it opens a new browser session with each instance so I wouldn’t recommend running it on prod systems or on slow boxes. It can be set up to run remotely.