#85639 - 2002-05-08 03:22 PM
HELP with Microsoft IIS/Proxy
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
For the past several months, we have been using a product called SuperScout with Microsoft Proxy 2.0 to monitor web access by our users. Unfortunately, the SuperScout program seems to cause proxy/IIS to generate Dr. Watson errors on rare occasion. So, I have devised a script that uses BLAT to send an email to me or a co-worker when the proxy service stops. I do this by polling the Dr. Watson log size. Ideally, SurfControl would fix their product, but this hasn't happened, yet.
What I would like to do is to automatically restart the web proxy and default web service whenever these errors occur. This way, I don't have to run back to the server every time the proxy errors out. I have looked into the adsutil.vbs script, and I have a little understanding, but I'm not sure it is adequate. Generally, I right click on web proxy, then start, then I right click on default web server, then start (in iis.msc). This is all that is necessary. I would assume there is a way to do this via kixtart.
Any help you can give me would be greatly appreciated!!!
Brian
|
Top
|
|
|
|
#85640 - 2002-05-08 03:54 PM
Re: HELP with Microsoft IIS/Proxy
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I would think that you should monitor the service and not necessarily the DrWatson log file. Here is some code to that should point you in the right direction. Let me now if I missed your intended target. code:
;Status of service. The values can be found in the following list: Status Constant ;ADS_SERVICE_STOPPED 0x00000001 ;ADS_SERVICE_START_PENDING 0x00000002 ;ADS_SERVICE_STOP_PENDING 0x00000003 ;ADS_SERVICE_RUNNING 0x00000004 ;ADS_SERVICE_CONTINUE_PENDING 0x00000005 ;ADS_SERVICE_PAUSE_PENDING 0x00000006 ;ADS_SERVICE_PAUSED 0x00000007 ;ADS_SERVICE_ERROR 0x00000008
$computer = GetObject("WinNT://@wksta,computer") ? @serror $service = $computer.GetObject("Service", "Clipsrv") ? @serror $rc = $service.Status ? "Status=$rc" If $service.Status <> 4 $service.Start EndIf get $_ If $service.Status <> 1 $service.Stop EndIf $rc = $service.Status ? "Status=$rc"
[ 08 May 2002, 15:55: Message edited by: Howard Bullock ]
|
Top
|
|
|
|
#85641 - 2002-05-08 04:04 PM
Re: HELP with Microsoft IIS/Proxy
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
Maybe I SHOULD monitor the service, but I'm not sure it will help me that much. I still have to clear the Dr. Watson error that appears. The error has always been the same. (We've logged something like 30 of these errors on each of 3 proxy servers.) Does the "ADS_SERVICE_ERROR" get set when Dr. Watson is called? I will also need to close the Dr. Watson error that has popped up... Let me tool around with this a bit..
Brian
|
Top
|
|
|
|
#85645 - 2002-05-08 04:35 PM
Re: HELP with Microsoft IIS/Proxy
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
Disabling Dr. Watson isn't an option at this point. We are still waiting on the company to resolve the problems with their software, so we need a log of errors. Howard's solution works fine except that as the service is starting I get the return code of 8... so I will have to put a delay in there... might just be easier to use "net start"...
Brian
|
Top
|
|
|
|
#85646 - 2002-05-08 05:27 PM
Re: HELP with Microsoft IIS/Proxy
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
Howard:
I'm using WinNT 4.0. The script you posted only works on Windows 2000. I couldn't get the line
$service=$computer.GetObject("Service","ClipSrv") to work. It gives me an error.
Brian
|
Top
|
|
|
|
#85647 - 2002-05-08 05:38 PM
Re: HELP with Microsoft IIS/Proxy
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Do you have ADSI installed on your NT4 computer? I would assume that much but had to ask.
"ClipSrv" is a W2K service name and only included as an example. You would have to substitute the correct service (short names) "W3SVC" etc.
Here are the services our Proxy2 server use.
:Down net stop w3svc net stop msftpsvc net stop iisadmin /y
set process="inetinfo" call :Killprocess
net stop mailalrt net stop mspadmin
set process="DRWTSN32" call :Killprocess
set LogText=Proxy Service has been stopped. call :Log goto End
:Up net start mspadmin net start mailalrt net start iisadmin net start msftpsvc net start w3svc
|
Top
|
|
|
|
#85648 - 2002-05-08 05:43 PM
Re: HELP with Microsoft IIS/Proxy
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
We use HP Openview to monitor the INETinfo process in order to determine if proxy is up or not.
|
Top
|
|
|
|
#85649 - 2002-05-08 06:06 PM
Re: HELP with Microsoft IIS/Proxy
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
I don't know if we have ADSI installed. We don't have any win2k servers, yet, so this may be a worthless pursuit until then. I don't have a great understanding of how all this stuff relies on ADSI. Interestingly, though, the adsutil.vbs script seems to enumerate objects just fine... maybe I'll just go ahead an use it... or stick with net start and net stop.
Brian
|
Top
|
|
|
|
#85650 - 2002-05-08 08:36 PM
Re: HELP with Microsoft IIS/Proxy
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
Ok.. now that it comes right down to it, what I really need is a script that allows me to reactivate the filter w3proxy on Windows NT4 Server. The path should be:
IIS://computername/W3SVC/1/Filters/w3proxy
or something similar. I noticed that there is no way to run a "net start w3proxy"... because it comes back with the message that the service doesn't exist. I can start the w3svc, but for some reason it doesn't reload the w3proxy. I'm not sure it makes a difference if I do a "net stop w3svc" then a "net start w3svc"... Can anyone help?
Brian
|
Top
|
|
|
|
#85651 - 2002-05-08 09:37 PM
Re: HELP with Microsoft IIS/Proxy
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Please revisit the list of services above. I think you want "iisadmin".
The message above details the stops and starts for shutting down and starting up our MSproxy 2.0 services.
|
Top
|
|
|
|
#85652 - 2002-05-08 09:48 PM
Re: HELP with Microsoft IIS/Proxy
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
I think you're right, Howard.. upon further review.. I think I was being too nitpicky and trying to make it to "neat". Stopping the IISADMIN and W3SVC then restarting them should do the trick. ISAPI filters are loaded when the IISADMIN service is loaded. Yes, there has to be some way reload ISAPI filters outside of restarting IISADMIN, but Microsoft has not been so kind as to document how (in so far as I've looked -- MSDN, etc). So.. I've settled on the method:
code:
shell '%comspec% /c net stop W3SVC' shell '%comspec% /c net stop IISADMIN' shell '%comspec% /c net start IISADMIN' shell '%comspec% /c net start W3SVC'
Ah well.. I guess i'll have to live with 30 seconds downtime instead of 10 or 15..
Brian
|
Top
|
|
|
|
#85653 - 2002-05-08 09:55 PM
Re: HELP with Microsoft IIS/Proxy
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Since you posted this in the COM forum, I think that you should install ADSI and use the code provided above instead of that nasty "SHELL net stuff". [ 08 May 2002, 21:55: Message edited by: Howard Bullock ]
|
Top
|
|
|
|
#85654 - 2002-05-08 09:59 PM
Re: HELP with Microsoft IIS/Proxy
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
Yeah.. well, I wanted a COM solution.. none has been forthcoming.. IIS has ADSI capabilities whether NT does or not.
Brian
|
Top
|
|
|
|
#85655 - 2002-05-08 10:13 PM
Re: HELP with Microsoft IIS/Proxy
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Try this. If it does not work because ADSI is not there, you can DL it from the link in my previous post. code:
$computer = GetObject("WinNT://@wksta,computer") $service1 = $computer.GetObject("Service", "iisadmin") $service2 = $computer.GetObject("Service", "w3svc") $service2.Stop $service1.Stop $service1.Start $service2.Start
|
Top
|
|
|
|
#85656 - 2002-05-13 03:51 PM
Re: HELP with Microsoft IIS/Proxy
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
Well, unfortunately, simply stopping and starting the services does NOT reactivate proxy properly after a crash. So, I'm still looking for a solution that simply turns on the proxy the same as the IIS.msc allows you to do it by right clicking on the service and clicking start. Other methods cause errors in the event log...
Brian
|
Top
|
|
|
|
#85657 - 2002-06-20 09:51 AM
Re: HELP with Microsoft IIS/Proxy
|
robbocop
Fresh Scripter
Registered: 2002-02-18
Posts: 5
Loc: Rome Italy
|
I need a help. I have to check on several wks if there are some IIS webserver. Do you think that using Com looking for the iisadmin service is right. Thanks for your help
|
Top
|
|
|
|
#85658 - 2002-06-20 03:37 PM
Re: HELP with Microsoft IIS/Proxy
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
Do you want to see if IIS is installed or if it is running a webserver or what specifically? COM is a great way to do this.
Brian
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 507 anonymous users online.
|
|
|