Can I monitor application pool state in IIS?

I've got a particular app pool that occasionally crashes on me.  Any way I can automate monitoring it with FireScope?

  • Your best approach would probably be via powershell, using something like the script below:


    Param(
    [Parameter(Mandatory=$true,HelpMessage="Application pool name to check")][string]$AppPoolName
    )

    #region loadAssembly

    [Reflection.Assembly]::LoadWithPartialName('Microsoft.Web.Administration')

    #endregion loadAssembly

    $sm = [Microsoft.Web.Administration.ServerManager]::OpenRemote("localhost")
    $apppools = $sm.ApplicationPools["$AppPoolName"]
    $status = $apppools.state
    Write-Host $status

    You'd call this via Host Run, sending a parameter of the Application Pool name, such as "DefaultAppPool".  Possible return values are 1=starting, 2=started, 3=stopping, 4=stopped.

    Event Definitions could be as simple as looking for a return value of 4.You could also use Remote Command in notifications to execute C:\Windows\System32\Inetsrv\appcmd recycle  apppool /apppool.name:DefaultAppPool (replacing DefaultAppPool with the name of the pool that is stopped) to attempt automated remediation, with an additional notification going to admins to verify that the site is fixed.

    Hope that helps