Application Pool monitoring.

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
claker1
Posts: 1
Joined: Fri Jul 27, 2012 10:53 am

Application Pool monitoring.

Post by claker1 »

Good afternoon,

Can Hostmon monitor Application Pools within IIS for an up/down status?

Thanks,
Chris
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

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/mfra ... ts.htm#wmi
ChrisVinck
Posts: 3
Joined: Sun May 31, 2015 4:25 pm

Post by ChrisVinck »

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/mfra ... ts.htm#wmi
oakyuz
Posts: 74
Joined: Thu Feb 08, 2007 5:48 am

Post by oakyuz »

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".
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

You may may use Shell Script test method with custom made script.
E.g.
JS Script may look like the following:

Code: Select all

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
Post Reply