Page 2 of 5
Re: IIS App Pool monitoring
Posted: Fri Dec 27, 2019 1:00 pm
by ssax
I don't see that namespace listed in the output, it won't work if it doesn't have access to the things it needs. Are you sure that's an IIS server with app pools on it?
Did you follow this guide?
Code: Select all
https://outsideit.net/monitoring-iis-application-pools/
What does this output?
Re: IIS App Pool monitoring
Posted: Fri Dec 27, 2019 1:06 pm
by rferebee
Can you clarify what you mean when you say, "it won't work if it doesn't have access to the things it needs." What's it? What things?
I'm sure. See screen shot of the Application Pool list.
Also, here's the output when I run:
C:\Windows\system32\inetsrv\appcmd list apppool
Code: Select all
PS C:\> C:\Windows\system32\inetsrv\appcmd list apppool
APPPOOL "DefaultAppPool" (MgdVersion:v2.0,MgdMode:Integrated,state:Started)
APPPOOL "Classic .NET AppPool" (MgdVersion:v2.0,MgdMode:Classic,state:Started)
APPPOOL "WebServices" (MgdVersion:v2.0,MgdMode:Integrated,state:Started)
APPPOOL "CASH" (MgdVersion:v4.0,MgdMode:Integrated,state:Started)
APPPOOL "Collateral" (MgdVersion:v4.0,MgdMode:Integrated,state:Started)
APPPOOL "Email" (MgdVersion:v4.0,MgdMode:Integrated,state:Started)
APPPOOL "LGIP" (MgdVersion:v4.0,MgdMode:Integrated,state:Started)
APPPOOL "Millennium" (MgdVersion:v4.0,MgdMode:Integrated,state:Started)
APPPOOL "Passwords" (MgdVersion:v4.0,MgdMode:Integrated,state:Started)
APPPOOL "Prepaid" (MgdVersion:v4.0,MgdMode:Integrated,state:Started)
APPPOOL "UPSearch" (MgdVersion:v2.0,MgdMode:Integrated,state:Started)
APPPOOL "FinancialFitness" (MgdVersion:v4.0,MgdMode:Integrated,state:Started)
APPPOOL "ASP.NET v4.0" (MgdVersion:v4.0,MgdMode:Integrated,state:Started)
APPPOOL "ASP.NET v4.0 Classic" (MgdVersion:v4.0,MgdMode:Classic,state:Started)
APPPOOL "wsSSTrackerMT" (MgdVersion:v4.0,MgdMode:Integrated,state:Started)
I haven't done a lot of work with PowerShell in my career up to this point, sorry for any ignorant questions.
Here's the output from that PS command you provided:
Code: Select all
PS C:\> Get-ChildItem -Path IIS:\AppPools
Get-ChildItem : Cannot find drive. A drive with the name 'IIS' does not exist.
At line:1 char:14
+ Get-ChildItem <<<< -Path IIS:\AppPools
+ CategoryInfo : ObjectNotFound: (IIS:String) [Get-ChildItem], DriveNotFoundException
+ FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
Re: IIS App Pool monitoring
Posted: Fri Dec 27, 2019 1:11 pm
by rferebee
It looks like the AppPools directory is located here: C:\inetpub\temp\appPools
I did not configure this host, so it's possible the setup is non-standard.
Re: IIS App Pool monitoring
Posted: Fri Dec 27, 2019 1:26 pm
by ssax
Re: IIS App Pool monitoring
Posted: Fri Dec 27, 2019 1:28 pm
by ssax
Does this work?
Or this plugin?
Code: Select all
https://github.com/juangranados/nagios-plugins/blob/master/check_iis.ps1
Re: IIS App Pool monitoring
Posted: Fri Dec 27, 2019 1:44 pm
by rferebee
Get-IISAppPool returns an error...
Code: Select all
PS C:\> Get-IISAppPool
The term 'Get-IISAppPool' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:15
+ Get-IISAppPool <<<<
+ CategoryInfo : ObjectNotFound: (Get-IISAppPool:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The check_iis.ps1 script does this:
Code: Select all
PS C:\Program Files\NSClient++\scripts> powershell ./check_iis.ps1
The term 'Get-WebsiteState' is not recognized as the name of a cmdlet, function, script file, or operable program. Chec
k the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Program Files\NSClient++\scripts\check_iis.ps1:37 char:37
+ $WebsitesRunning = (Get-WebsiteState <<<< | Where-Object { ($_.value -eq "Started") }).Count
+ CategoryInfo : ObjectNotFound: (Get-WebsiteState:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The term 'Get-WebAppPoolState' is not recognized as the name of a cmdlet, function, script file, or operable program. C
heck the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Program Files\NSClient++\scripts\check_iis.ps1:38 char:40
+ $AppPoolsRunning = (Get-WebAppPoolState <<<< | Where-Object { ($_.value -eq "Started") }).Count
+ CategoryInfo : ObjectNotFound: (Get-WebAppPoolState:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The term 'Get-WebsiteState' is not recognized as the name of a cmdlet, function, script file, or operable program. Chec
k the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Program Files\NSClient++\scripts\check_iis.ps1:39 char:35
+ $WebsitesTotal = (Get-WebsiteState <<<< ).Count
+ CategoryInfo : ObjectNotFound: (Get-WebsiteState:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The term 'Get-WebAppPoolState' is not recognized as the name of a cmdlet, function, script file, or operable program. C
heck the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Program Files\NSClient++\scripts\check_iis.ps1:40 char:37
+ $AppPoolTotal = (Get-WebAppPoolState <<<< ).Count
+ CategoryInfo : ObjectNotFound: (Get-WebAppPoolState:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The term 'Get-WebsiteState' is not recognized as the name of a cmdlet, function, script file, or operable program. Chec
k the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Program Files\NSClient++\scripts\check_iis.ps1:80 char:36
+ $StoppedWebsites = Get-WebsiteState <<<< | Where-Object { ($_.value -ne "Started") } | % { return @{($_.itemxpath -s
plit ("'"))[1]="$($_.value)" } } | % getEnumerator
+ CategoryInfo : ObjectNotFound: (Get-WebsiteState:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The term 'Get-WebAppPoolState' is not recognized as the name of a cmdlet, function, script file, or operable program. C
heck the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Program Files\NSClient++\scripts\check_iis.ps1:85 char:39
+ $StoppedAppPools = Get-WebAppPoolState <<<< | Where-Object { ($_.value -ne "Started") } | % { return @{($_.itemxpath
-split ("'"))[1]="$($_.value)" } } | % getEnumerator
+ CategoryInfo : ObjectNotFound: (Get-WebAppPoolState:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
OK: All Websites and AppPools Running. C:\Users\ferebeer\Desktop\check_iis_output.txt| WebsitesRunning=;0;0;0; AppPools
Running=;0;0;0;
Re: IIS App Pool monitoring
Posted: Fri Dec 27, 2019 1:48 pm
by ssax
Just to make sure, you're running that powershell script and those commands I requested in powershell admin section on the IIS server, correct?
What version of windows? (be specific)
Do you need to install the powershell snap-in?
Code: Select all
https://www.microsoft.com/en-us/download/details.aspx?id=15488
Re: IIS App Pool monitoring
Posted: Fri Dec 27, 2019 1:58 pm
by rferebee
I'm sorry, I don't know. I thought I could run all this from just an elevated Powershell console.
Is there a specific IIS Powershell console I should be using? The link you provided?
Re: IIS App Pool monitoring
Posted: Fri Dec 27, 2019 2:31 pm
by mbellerue
Try this Powershell command, get-windowsfeature | findstr IIS On Server 2016, the IIS Powershell module is installed and automatically loaded when IIS is installed. In Server 2008 we may have to install it manually.
Edit:
Also, no worries on not being experienced with Powershell. We all work in IT. There are areas where we're strong, and areas where we're not. We'll get this figured out.
Re: IIS App Pool monitoring
Posted: Fri Dec 27, 2019 2:58 pm
by rferebee
It's saying the Get-WindowsFeature is not recognized as the name of a cmdlet, function, etc...
I should answer your previous question and tell you that I'm on a Server 2008 R2 box running IIS 7.5.
I'll it appears all of the site data for IIS is stored on a drive other than C: the directories are here: E:\WebServices