I’m trying to develop my own powershell plugin using the framework.
I’ve written a function successfully and it is doing what I want. I now want to publish that component onto a local windows server and I’m receiving the error the module customicinga is not containing any plugins.
I’m trying to mimic the plugins provided by Icinga, ie MSSQL, where you have multiple plugins/functions for one module.
I’ve created the skeleton using New-IcingaForWindowsComponent.
I don’t really understand the purpose of the function that gets created in the custom-powershell-customicinga.psm1, and where I should put my function(s). Should I put them all under the root custom-powershell-customicinga.psm1 file? Should I put them in the plugins folder? (I’ve tried that it doesn’t seem to work).
---------- ------- ---- ----------------
Manifest 1.0.0 icinga-powershell-customicinga
Script 1.13.2 icinga-powershell-framework {Get-IcingaFrameworkCodeCacheFile, Send-IcingaWebAuthMessage, Get-IcingaWindowsInformation, Add-IcingaWmiPermissions...}
Manifest 1.5.0 icinga-powershell-mssql {Import-IcingaPowerShellComponentMSSQL, Invoke-IcingaCheckMSSQLBackupStatus, Invoke-IcingaCheckMSSQLHealth, Invoke-IcingaCheckMSSQLPerfCounter...}
Manifest 1.13.0 icinga-powershell-plugins {Import-IcingaPowerShellComponentPlugins, Invoke-IcingaCheckPartitionSpace, Invoke-IcingaCheckUsedPartitionSpace, Invoke-IcingaCheckScheduledTask...}
lrk
March 17, 2025, 5:33am
2
Have you executed this command?
Publish-IcingaForWindowsComponent -Name 'customicinga'
Hi Irk,
Yes I have. That’s when I receive the error.
lrk
March 17, 2025, 6:58am
4
the plugin should be located under the plugin directory. File extension .psm1
with the following structure
<#
.SYNOPSIS
Checks ...
.DESCRIPTION
Checks ...
.PARAMETER Warning
Warning ...
.PARAMETER Critical
Critical ...
.EXAMPLE
Example
#>
function Invoke-IcingaCheckTestCheck
{
param(
$Warning = $null,
$Critical = $null
)
$RandomNumber = Get-Random -Minimum 1 -Maximum 10;
$IcingaCheck = New-IcingaCheck -Name 'Test' -Value $RandomNumber
$IcingaCheck.WarnOutOfRange($Warning).CritOutOfRange($Critical) | Out-Null;
return (New-IcingaCheckResult -Check $IcingaCheck -Compile);
}
So under plugin is a file called Invoke-IcingaCheckWhatever.psm1 with my function?
And the root psd1 file can be left with no changes, that includes the default blank function name under NestedModules?
And the root psm1 file can be left with the default blank function that gets created?
lrk
March 17, 2025, 7:41am
6
So under plugin is a file called Invoke-IcingaCheckWhatever.psm1 with my function?
it should look like this
icinga-poweshell-custommodule\plugins \Invoke-IcingaCheckWhatever.psm1
function Invoke-IcingaCheckWhatever
And the root psd1 file can be left with no changes, that includes the default blank function name under NestedModules?
this should look like this, where FunctionsToExport is filled by the publish command from above
@{
ModuleVersion = '1.0.0'
GUID = ''
Author = ''
CompanyName = ''
Copyright = '(c) 2025 | GPL v2.0'
Description = ''
PowerShellVersion = '4.0'
RequiredModules = @(
@{ ModuleName = 'icinga-powershell-framework'; ModuleVersion = '1.7.0'; }
)
NestedModules = @(
'.\compiled\icinga-powershell-custommodule.ifw_compilation.psm1'
)
FunctionsToExport = @(
'Invoke-IcingaCheckWhatever',
)
CmdletsToExport = @(
)
VariablesToExport = @(
)
AliasesToExport = @(
)
PrivateData = @{
PSData = @{
Tags = @( 'custommodule' )
LicenseUri = ''
ProjectUri = ''
ReleaseNotes = ''
};
Version = 'v1.0.0'
Name = 'Windows custommodule';
Type = 'plugins';
Function = '';
Endpoint = '';
}
HelpInfoURI = ''
}
And the root psm1 file can be left with the default blank function that gets created?
yes just like that
function Import-IcingaPowerShellComponentcustommodule()
{
}
Thanks for the clarification. Will give it a go tomorrow when I’m back in front of a computer.
That works Irk. Thank you for the help. Appreciate it.