district09 / check_ms_iis_application_pool

:four_leaf_clover: Check MS IIS Application Pool :four_leaf_clover:
https://outsideit.net/monitoring-iis-application-pools/
13 stars 8 forks source link

No cpu info for 1 application pool #7

Open Tontonitch opened 6 years ago

Tontonitch commented 6 years ago

Hello,

On a IIS server, amount 8 application pool there is 1 without CPU usage reported: image.

I checked with the last version of the plugin, v1.05.170922, same behavior.

Please tell me if I can provide any information to figure out what the issue/problem is.

BR, Yannick

Tontonitch commented 6 years ago

Debug:

Windows PowerShell
Copyright (C) 2014 Microsoft Corporation. All rights reserved.

PS C:\Windows\system32> C:\PROGRA~1\ICINGA2\sbin\custom_plugins\check_ms_iis_application_pool.ps1 -A webapi
OK: Application Pool "webapi" with 1 Applications. {CPU:  %}{Memory: 0 MB} | 'pool_cpu'=%;;;0;100 'pool_memory'=0MB;;;0;
 'app_count'=1
PS C:\Windows\system32> C:\PROGRA~1\ICINGA2\sbin\custom_plugins\check_ms_iis_application_pool.ps1 -A webapi
VERBOSE: Importing cmdlet 'Add-WebConfiguration'.
VERBOSE: Importing cmdlet 'Add-WebConfigurationLock'.
VERBOSE: Importing cmdlet 'Add-WebConfigurationProperty'.
VERBOSE: Importing cmdlet 'Backup-WebConfiguration'.
VERBOSE: Importing cmdlet 'Clear-WebCentralCertProvider'.
VERBOSE: Importing cmdlet 'Clear-WebConfiguration'.
VERBOSE: Importing cmdlet 'Clear-WebRequestTracingSetting'.
VERBOSE: Importing cmdlet 'Clear-WebRequestTracingSettings'.
VERBOSE: Importing cmdlet 'ConvertTo-WebApplication'.
VERBOSE: Importing cmdlet 'Disable-WebCentralCertProvider'.
VERBOSE: Importing cmdlet 'Disable-WebGlobalModule'.
VERBOSE: Importing cmdlet 'Disable-WebRequestTracing'.
VERBOSE: Importing cmdlet 'Enable-WebCentralCertProvider'.
VERBOSE: Importing cmdlet 'Enable-WebGlobalModule'.
VERBOSE: Importing cmdlet 'Enable-WebRequestTracing'.
VERBOSE: Importing cmdlet 'Get-WebAppDomain'.
VERBOSE: Importing cmdlet 'Get-WebApplication'.
VERBOSE: Importing cmdlet 'Get-WebAppPoolState'.
VERBOSE: Importing cmdlet 'Get-WebBinding'.
VERBOSE: Importing cmdlet 'Get-WebCentralCertProvider'.
VERBOSE: Importing cmdlet 'Get-WebConfigFile'.
VERBOSE: Importing cmdlet 'Get-WebConfiguration'.
VERBOSE: Importing cmdlet 'Get-WebConfigurationBackup'.
VERBOSE: Importing cmdlet 'Get-WebConfigurationLocation'.
VERBOSE: Importing cmdlet 'Get-WebConfigurationLock'.
VERBOSE: Importing cmdlet 'Get-WebConfigurationProperty'.
VERBOSE: Importing cmdlet 'Get-WebFilePath'.
VERBOSE: Importing cmdlet 'Get-WebGlobalModule'.
VERBOSE: Importing cmdlet 'Get-WebHandler'.
VERBOSE: Importing cmdlet 'Get-WebItemState'.
VERBOSE: Importing cmdlet 'Get-WebManagedModule'.
VERBOSE: Importing cmdlet 'Get-WebRequest'.
VERBOSE: Importing cmdlet 'Get-Website'.
VERBOSE: Importing cmdlet 'Get-WebsiteState'.
VERBOSE: Importing cmdlet 'Get-WebURL'.
VERBOSE: Importing cmdlet 'Get-WebVirtualDirectory'.
VERBOSE: Importing cmdlet 'New-WebApplication'.
VERBOSE: Importing cmdlet 'New-WebAppPool'.
VERBOSE: Importing cmdlet 'New-WebBinding'.
VERBOSE: Importing cmdlet 'New-WebFtpSite'.
VERBOSE: Importing cmdlet 'New-WebGlobalModule'.
VERBOSE: Importing cmdlet 'New-WebHandler'.
VERBOSE: Importing cmdlet 'New-WebManagedModule'.
VERBOSE: Importing cmdlet 'New-Website'.
VERBOSE: Importing cmdlet 'New-WebVirtualDirectory'.
VERBOSE: Importing cmdlet 'Remove-WebApplication'.
VERBOSE: Importing cmdlet 'Remove-WebAppPool'.
VERBOSE: Importing cmdlet 'Remove-WebBinding'.
VERBOSE: Importing cmdlet 'Remove-WebConfigurationBackup'.
VERBOSE: Importing cmdlet 'Remove-WebConfigurationLocation'.
VERBOSE: Importing cmdlet 'Remove-WebConfigurationLock'.
VERBOSE: Importing cmdlet 'Remove-WebConfigurationProperty'.
VERBOSE: Importing cmdlet 'Remove-WebGlobalModule'.
VERBOSE: Importing cmdlet 'Remove-WebHandler'.
VERBOSE: Importing cmdlet 'Remove-WebManagedModule'.
VERBOSE: Importing cmdlet 'Remove-Website'.
VERBOSE: Importing cmdlet 'Remove-WebVirtualDirectory'.
VERBOSE: Importing cmdlet 'Rename-WebConfigurationLocation'.
VERBOSE: Importing cmdlet 'Restart-WebAppPool'.
VERBOSE: Importing cmdlet 'Restart-WebItem'.
VERBOSE: Importing cmdlet 'Restore-WebConfiguration'.
VERBOSE: Importing cmdlet 'Select-WebConfiguration'.
VERBOSE: Importing cmdlet 'Set-WebBinding'.
VERBOSE: Importing cmdlet 'Set-WebCentralCertProvider'.
VERBOSE: Importing cmdlet 'Set-WebCentralCertProviderCredential'.
VERBOSE: Importing cmdlet 'Set-WebConfiguration'.
VERBOSE: Importing cmdlet 'Set-WebConfigurationProperty'.
VERBOSE: Importing cmdlet 'Set-WebGlobalModule'.
VERBOSE: Importing cmdlet 'Set-WebHandler'.
VERBOSE: Importing cmdlet 'Set-WebManagedModule'.
VERBOSE: Importing cmdlet 'Start-WebAppPool'.
VERBOSE: Importing cmdlet 'Start-WebCommitDelay'.
VERBOSE: Importing cmdlet 'Start-WebItem'.
VERBOSE: Importing cmdlet 'Start-Website'.
VERBOSE: Importing cmdlet 'Stop-WebAppPool'.
VERBOSE: Importing cmdlet 'Stop-WebCommitDelay'.
VERBOSE: Importing cmdlet 'Stop-WebItem'.
VERBOSE: Importing cmdlet 'Stop-Website'.
VERBOSE: Importing function 'IIS:'.
VERBOSE: 2018-04-11 12:02:51,495: check_ms_iis_application_pool.ps1: Info: Application pool webapi process id: 15276
1688 Percent CPU:
VERBOSE: 2018-04-11 12:02:51,510: check_ms_iis_application_pool.ps1: Info: Application pool webapi process id: 15276
1688 Private Memory: 0
OK: Application Pool "webapi" with 1 Applications. {CPU:  %}{Memory: 0 MB} | 'pool_cpu'=%;;;0;100 'pool_memory'=0MB;;;0;
 'app_count'=1
PS C:\Windows\system32>
Tontonitch commented 6 years ago

So 2 proecsses:

image image

Seems to be related to the fact that there are 2 processes. -> cpu is wrong (no value) -> memory is wrong (not 0)

Tontonitch commented 6 years ago

I guess line 392 is not correct with multiple processes / pid, so there should be a loop and stat retrieval for each processes and a sum of that (I guess).