Hey dude , one of your servers is broken .Part-1

For engineers who manage IIS clusters one of the main challenges is how to keep content in sync across the farm . One broken server in a farm can cause a broken user experience  as when request bounce back between machines they may land on a machine that does not have the content , kicking them over to custom errors or old content. We get at least couple of requests every week on this, when it is high priority business website time is key to isolate the broken machine and remove from rotation.  One of the way to troubleshoot this is by pulling the url from all the machines and either look the response code or content length returned. They should be consistent , if you find a machine with a different content length or a error( > 400) status code you isolated the issue. This is how I do it .

1) Launch power shell from a windows 2008 ( with IIS7 powershell module installed ) or windows 2008 r2 machine

Add-pssnapin WebAdministration (Windows 2008)

or

import-module webadministration (Windows 2008 r2 )

2) Get the server names from a text file and pipe it to the get-weburl cmdlet .

To look at content lengh if the issue is about out dated content showing up intermittently on server farm

Get-Content c:\temp\servers.txt | % {$_;get-weburl -Url https://$_/my/sites/foo.aspx -ResponseHeaders| %{($_.headers).'Content-Length'}}

WEB01
20134
WEB02
20134
WEB03
20134
WEB04
20134
WEB05
20134
WEB06
20134

WEB07
20051 (Broken)

To find a machine which throws 404 or 500 in cluster .

Get-Content c:\temp\servers.txt | % {$_;get-weburl -Url https://$_/my/sites/foo.aspx -ResponseHeaders| select responseuri, staus, description

ResponseUri Status Description
----------- ------ -----------
https://WEB01/my/sites/foo.aspx ProtocolError URL Rewrite Module Error. (Broken) https://WEB02/my/sites/foo.aspx OK OK
https://WEB05/my/sites/foo.aspx OK OK
https://WEB06/my/sites/foo.aspx OK OK
https://WEB07/my/sites/foo.aspx OK OK
https://WEB08/my/sites/foo.aspx OK OK
https://WEB21/my/sites/foo.aspx OK OK
https://WEB22/my/sites/foo.aspx OK OK
https://WEB23/my/sites/foo.aspx OK OK
https://WEB24/my/sites/foo.aspx OK OK
https://WEB25/my/sites/foo.aspx OK OK
https://WEB26/my/sites/foo.aspx OK OK
https://WEB27/my/sites/foo.aspx OK OK
https://WEB28/my/sites/foo.aspx OK OK
https://WEB41/my/sites/foo.aspx OK OK
https://WEB42/my/sites/foo.aspx OK OK
https://WEB43/my/sites/foo.aspx OK OK

OK is a 200.

Well this works great if your server has one website , what if you are doing shared hosting business with multiple sites on the same server, that is when we travel back in time to meet IIS 6 resource kit tool tinyget. That will be covered in the next post.