Hi I have a new Powershell check that is intended to check our windows cluster service for a Roles and the owner. Just to verify that it is running on the intended primary server.
I created a new plugin with:
New-IcingaForWindowsComponent -Name ‘ClusterPreferred’ -ComponentType ‘plugins’
I modifed and extended the plugin with a new check:
function Invoke-IcingaCheckClusterpreferred()
{
xxxxx
}
When we test it locally with:
it returns as expected:
PS C:\Users\XXXXXXX> Import-Module ‘C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-ClusterPreferred\icin
ga-powershell-ClusterPreferred.psm1’
PS C:\Users\XXXXXXX> Invoke-IcingaCheckClusterpreferred
[OK] FAKESERVER01: 0
| ‘default::ifw_clusterpreferred::FAKESERVER01’=;;
0
The export for the Director works:
PS C:\Users\XXXXXXX> Get-IcingaCheckCommandConfig -CheckName ‘Invoke-IcingaCheckClusterpreferred’ -OutDirectory ‘C:\te
mp’;
[Notice]: The following commands were exported:
[Notice]: - ‘Invoke-IcingaCheckClusterpreferred’
[Notice]: JSON export created in ‘C:\temp\PowerShell_CheckCommands_12-05-2023-14-08-4489.json’
[Warning]: By using this generated check command configuration you will require the Icinga PowerShell Framework 1.4.0 or
later to be installed on ALL monitored machines!
However…
Use-Icinga; Invoke-IcingaCheckClusterpreferred;
Fails with not found.
The new check within the director also fails (as expected as it fails with the manual import-module first)
Did I miss a step in the documentation on including it in the path?
the psd1 was updated to include the invoke:
FunctionsToExport = @(
‘Import-IcingaPowerShellComponentClusterpreferred’
‘Invoke-IcingaCheckClusterpreferred’
)
Which I assume is working, as I would expect Get-IcingaCheckCommandConfig to fail otherwise.
I have another 8 Powershell plugins ready, but somehow I feel I must have skipped or missed a step on why the framework is not grabbing them,
Thanks for any hints/tips
D