View previous topic :: View next topic |
Author |
Message |
claker1
Joined: 27 Jul 2012 Posts: 1
|
Posted: Fri Jul 27, 2012 11:11 am Post subject: Application Pool monitoring. |
|
|
Good afternoon,
Can Hostmon monitor Application Pools within IIS for an up/down status?
Thanks,
Chris |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Fri Jul 27, 2012 11:22 am Post subject: |
|
|
HostMonitor doesn't have special test methods for IIS monitoring.
However, IIS provides WMI interface for application pool monitoring.
You may try to use "WMI" test method to check IIS Application pools state.
E.g. you may use WMI test method with query like the following:
select AppPoolState from IIsApplicationPoolSetting WHERE Name="W3SVC/AppPools/MSExchangeOWAAppPool"
AppPoolState may return one of the following 4 states:
1 - The application pool is starting
2 - The application pool has started
3 - The application pool is stopping
4 - The application pool has stopped
Please note: "Root\MicrosoftIISv2" WMI name space should be used for WMI query, specified above.
Please check the manual or visit our web site for more information at:
http://www.ks-soft.net/hostmon.eng/mframe.htm#tests.htm#wmi |
|
Back to top |
|
|
ChrisVinck
Joined: 31 May 2015 Posts: 3
|
Posted: Sun Jun 21, 2015 10:38 am Post subject: |
|
|
Hey,
I want to get the state of application pools under IIS 7.0
That's not under root\MicrosoftIISv2, but under root\WebAdministration.
Unfortunately, the state is not a property but a method (GetState with parameter ReturnValue).
How can I get this value through a WMI query/test?
KS-Soft Europe wrote: | HostMonitor doesn't have special test methods for IIS monitoring.
However, IIS provides WMI interface for application pool monitoring.
You may try to use "WMI" test method to check IIS Application pools state.
E.g. you may use WMI test method with query like the following:
select AppPoolState from IIsApplicationPoolSetting WHERE Name="W3SVC/AppPools/MSExchangeOWAAppPool"
AppPoolState may return one of the following 4 states:
1 - The application pool is starting
2 - The application pool has started
3 - The application pool is stopping
4 - The application pool has stopped
Please note: "Root\MicrosoftIISv2" WMI name space should be used for WMI query, specified above.
Please check the manual or visit our web site for more information at:
http://www.ks-soft.net/hostmon.eng/mframe.htm#tests.htm#wmi |
|
|
Back to top |
|
|
oakyuz
Joined: 08 Feb 2007 Posts: 74
|
Posted: Mon Jun 22, 2015 12:09 am Post subject: |
|
|
Hi
We are using HM v9.90.
You may use the following WMI query for IIS 7.x application pools:
select AutoStart from ApplicationPool where Name='Pool_Name'
and the alert status is "if AutoStart Contains False". |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Mon Jun 22, 2015 8:15 am Post subject: |
|
|
You may may use Shell Script test method with custom made script.
E.g.
JS Script may look like the following:
Code: | statusUnknown = "scriptRes:Unknown:";
statusOk = "scriptRes:Ok:";
statusBad = "scriptRes:Bad:";
objArgs = WScript.Arguments;
if (objArgs.length==4) {
appPoolName = objArgs(0);
strComputer = objArgs(1);
strUser = objArgs(2);
strPsw = objArgs(3);
} else if (objArgs.length==1) {
appPoolName = objArgs(0);
strComputer = ".";
strUser = "";
strPsw = "";
} else {
WScript.StdOut.Write(statusUnknown + "Required 1 or 4 parameters: <AppPoolName> [<IP/hostname> <Login Username> <Login Password>]");
WScript.Quit;
}
try {
var objSWbemLocator = new ActiveXObject("WbemScripting.SWbemLocator");
var objWMI = objSWbemLocator.ConnectServer(strComputer, "Root\\WebAdministration", strUser, strPsw);
var wbemAuthenticationLevelPktPrivacy=6;
objWMI.Security_.AuthenticationLevel=wbemAuthenticationLevelPktPrivacy;
} catch(e) {
WScript.StdOut.Write(statusUnknown + e.message);
WScript.Quit;
}
var appPoolState = 0;
try {
var Obj = objWMI.Get("ApplicationPool.Name='"+appPoolName+"'");
var appPoolState = Obj.GetState();
} catch(e) {
WScript.StdOut.Write(statusUnknown + e.message);
WScript.Quit;
}
var apStatus = statusUnknown;
var apStatusText = "UNKNOWN";
switch (appPoolState) {
case 0:
apStatusText = "STARTING";
apStatus = statusBad;
break;
case 1:
apStatusText = "STARTED";
apStatus = statusOk;
break;
case 2:
apStatusText = "STOPPING";
apStatus = statusBad;
break;
case 3:
apStatusText = "STOPPED";
apStatus = statusBad;
break;
}
WScript.StdOut.Write(apStatus + apStatusText);
|
Start cmd: cmd /c cscript /B /E:JScript %Script% %Params%
Script requires 1 or 4 parameters: <AppPoolName> [<IP/hostname> <Login Username> <Login Password>]
E.g.:
MyAppPool1
or
MyAppPool1 IISHOST1 User1 MyPassword |
|
Back to top |
|
|
|