NCPA Plugin Error Received
Posted: Mon Jul 08, 2019 3:12 pm
Hello,
I'm getting an error message in Nagios XI when executing a custom plugin I wrote within NCPA. The plugin/powershell script works fine when run locally on the server. The intent of the script is to scan for any IIS App Pools that are in a stopped state. Any assistance would be greatly appreciated. Below is the script/plugin:
Import-Module WebAdministration
$ok = 0
$warning = 1
$critical = 2
$ErrorThreshold = 1
$AppPoolStatus = Get-ChildItem IIS:\AppPools | where {$_.state -eq "Stopped"}
$StoppedAppPools = $AppPoolStatus.count
if ($StoppedAppPools -ge $ErrorThreshold){
Write-Host Critical: $StoppedAppPools Application Pools in a stopped state
exit $critical
}
Else {
Write-Host OK: All Application Pools are running
exit $ok
}
Below is the error message:
Get-ChildItem : Cannot retrieve the dynamic parameters for the cmdlet.
Retrieving the COM class factory for component with CLSID
{688EEEE5-6A7E-422F-B2E1-6AF00DC944A6} failed due to the following error:
80040154 Class not registered (Exception from HRESULT: 0x80040154
(REGDB_E_CLASSNOTREG)).
At C:\\Program Files (x86)\\Nagios\\NCPA\\plugins\\check_iis_app_pools.ps1:8 char:18
+ $AppPoolStatus = Get-ChildItem IIS:\\AppPools
I'm getting an error message in Nagios XI when executing a custom plugin I wrote within NCPA. The plugin/powershell script works fine when run locally on the server. The intent of the script is to scan for any IIS App Pools that are in a stopped state. Any assistance would be greatly appreciated. Below is the script/plugin:
Import-Module WebAdministration
$ok = 0
$warning = 1
$critical = 2
$ErrorThreshold = 1
$AppPoolStatus = Get-ChildItem IIS:\AppPools | where {$_.state -eq "Stopped"}
$StoppedAppPools = $AppPoolStatus.count
if ($StoppedAppPools -ge $ErrorThreshold){
Write-Host Critical: $StoppedAppPools Application Pools in a stopped state
exit $critical
}
Else {
Write-Host OK: All Application Pools are running
exit $ok
}
Below is the error message:
Get-ChildItem : Cannot retrieve the dynamic parameters for the cmdlet.
Retrieving the COM class factory for component with CLSID
{688EEEE5-6A7E-422F-B2E1-6AF00DC944A6} failed due to the following error:
80040154 Class not registered (Exception from HRESULT: 0x80040154
(REGDB_E_CLASSNOTREG)).
At C:\\Program Files (x86)\\Nagios\\NCPA\\plugins\\check_iis_app_pools.ps1:8 char:18
+ $AppPoolStatus = Get-ChildItem IIS:\\AppPools