Icinga / icinga-powershell-hyperv

A collection of Hyper-V plugins for the Icinga Powershell Framework
GNU General Public License v2.0
5 stars 0 forks source link

Getting errors while creating a Basket #62

Closed wp-perc closed 1 year ago

wp-perc commented 1 year ago

Hi all,

I am trying to export the command definitions for HyperV Plugins, but I am continuously getting the following error for every plugin:

Get-Help : Get-Help could not find Invoke-IcingaCheckHyperVHealth in a help file in this session. To download updated help topics type: "Update-Help". To get help
online, search for the help topic in the TechNet library at https:/go.microsoft.com/fwlink/?LinkID=107116.
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:20396 char:29
+         $Data            = (Get-Help $check)
+                             ~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException
    + FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand

The Basket is fulkly generated and seems usable, but a red line is not a good thing... Maybe I am missing something, but:

The command I am using to force the basket generation with HyperV Plugins is:

Get-IcingaCheckCommandConfig -OutDirectory c:\temp -CheckName @("Invoke-IcingaCheckHyperVHealth", " Invoke-IcingaCheckHyperVOverCommitment", " Invoke-IcingaCheckHyperVSnapshot", " Invoke-IcingaCheckHyperVVirtualSwitches", " Invoke-IcingaCheckHyperVVMHealth", " Invoke-IcingaCheckHyperVVMM")

Here the complete output:

PS C:\Users\pb00269> Get-IcingaCheckCommandConfig -OutDirectory c:\temp -CheckName @("Invoke-IcingaCheckHyperVHealth", " Invoke-IcingaCheckHyperVOverCommitment", " Invoke-IcingaCheckHyperVSnapshot", " Invoke-IcingaCheckHyperVVirtualSwitches", " Invoke-IcingaCheckHyperVVMHealth", " Invoke-IcingaCheckHyperVVMM")
Get-Help : Get-Help could not find Invoke-IcingaCheckHyperVHealth in a help file in this session. To download updated help topics type: "Update-Help". To get help
online, search for the help topic in the TechNet library at https:/go.microsoft.com/fwlink/?LinkID=107116.
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:20175 char:29
+         $Data            = (Get-Help $check);
+                             ~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException
    + FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand

Get-Command : The term 'Invoke-IcingaCheckHyperVHealth' 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 C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:20176 char:29
+         $ParameterList   = (Get-Command -Name $check).Parameters;
+                             ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Invoke-IcingaCheckHyperVHealth:String) [Get-Command], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand

Get-Help : Get-Help could not find  Invoke-IcingaCheckHyperVOverCommitment in a help file in this session. To download updated help topics type: "Update-Help". To
get help online, search for the help topic in the TechNet library at https:/go.microsoft.com/fwlink/?LinkID=107116.
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:20175 char:29
+         $Data            = (Get-Help $check);
+                             ~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException
    + FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand

Get-Command : The term ' Invoke-IcingaCheckHyperVOverCommitment' 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 C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:20176 char:29
+         $ParameterList   = (Get-Command -Name $check).Parameters;
+                             ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: ( Invoke-IcingaCheckHyperVOverCommitment:String) [Get-Command], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand

Get-Help : Get-Help could not find  Invoke-IcingaCheckHyperVSnapshot in a help file in this session. To download updated help topics type: "Update-Help". To get
help online, search for the help topic in the TechNet library at https:/go.microsoft.com/fwlink/?LinkID=107116.
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:20175 char:29
+         $Data            = (Get-Help $check);
+                             ~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException
    + FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand

Get-Command : The term ' Invoke-IcingaCheckHyperVSnapshot' 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 C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:20176 char:29
+         $ParameterList   = (Get-Command -Name $check).Parameters;
+                             ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: ( Invoke-IcingaCheckHyperVSnapshot:String) [Get-Command], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand

Get-Help : Get-Help could not find  Invoke-IcingaCheckHyperVVirtualSwitches in a help file in this session. To download updated help topics type: "Update-Help". To
get help online, search for the help topic in the TechNet library at https:/go.microsoft.com/fwlink/?LinkID=107116.
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:20175 char:29
+         $Data            = (Get-Help $check);
+                             ~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException
    + FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand

Get-Command : The term ' Invoke-IcingaCheckHyperVVirtualSwitches' 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 C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:20176 char:29
+         $ParameterList   = (Get-Command -Name $check).Parameters;
+                             ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: ( Invoke-IcingaCheckHyperVVirtualSwitches:String) [Get-Command], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand

Get-Help : Get-Help could not find  Invoke-IcingaCheckHyperVVMHealth in a help file in this session. To download updated help topics type: "Update-Help". To get
help online, search for the help topic in the TechNet library at https:/go.microsoft.com/fwlink/?LinkID=107116.
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:20175 char:29
+         $Data            = (Get-Help $check);
+                             ~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException
    + FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand

Get-Command : The term ' Invoke-IcingaCheckHyperVVMHealth' 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 C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:20176 char:29
+         $ParameterList   = (Get-Command -Name $check).Parameters;
+                             ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: ( Invoke-IcingaCheckHyperVVMHealth:String) [Get-Command], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand

Get-Help : Get-Help could not find  Invoke-IcingaCheckHyperVVMM in a help file in this session. To download updated help topics type: "Update-Help". To get help
online, search for the help topic in the TechNet library at https:/go.microsoft.com/fwlink/?LinkID=107116.
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:20175 char:29
+         $Data            = (Get-Help $check);
+                             ~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException
    + FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand

Get-Command : The term ' Invoke-IcingaCheckHyperVVMM' 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 C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:20176 char:29
+         $ParameterList   = (Get-Command -Name $check).Parameters;
+                             ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: ( Invoke-IcingaCheckHyperVVMM:String) [Get-Command], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand

Get-Help : Get-Help could not find Invoke-IcingaCheckHyperVHealth in a help file in this session. To download updated help topics type: "Update-Help". To get help
online, search for the help topic in the TechNet library at https:/go.microsoft.com/fwlink/?LinkID=107116.
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:20396 char:29
+         $Data            = (Get-Help $check)
+                             ~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException
    + FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand

Get-Help : Get-Help could not find  Invoke-IcingaCheckHyperVOverCommitment in a help file in this session. To download updated help topics type: "Update-Help". To
get help online, search for the help topic in the TechNet library at https:/go.microsoft.com/fwlink/?LinkID=107116.
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:20396 char:29
+         $Data            = (Get-Help $check)
+                             ~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException
    + FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand

Get-Help : Get-Help could not find  Invoke-IcingaCheckHyperVSnapshot in a help file in this session. To download updated help topics type: "Update-Help". To get
help online, search for the help topic in the TechNet library at https:/go.microsoft.com/fwlink/?LinkID=107116.
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:20396 char:29
+         $Data            = (Get-Help $check)
+                             ~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException
    + FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand

Get-Help : Get-Help could not find  Invoke-IcingaCheckHyperVVirtualSwitches in a help file in this session. To download updated help topics type: "Update-Help". To
get help online, search for the help topic in the TechNet library at https:/go.microsoft.com/fwlink/?LinkID=107116.
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:20396 char:29
+         $Data            = (Get-Help $check)
+                             ~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException
    + FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand

Get-Help : Get-Help could not find  Invoke-IcingaCheckHyperVVMHealth in a help file in this session. To download updated help topics type: "Update-Help". To get
help online, search for the help topic in the TechNet library at https:/go.microsoft.com/fwlink/?LinkID=107116.
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:20396 char:29
+         $Data            = (Get-Help $check)
+                             ~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException
    + FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand

Get-Help : Get-Help could not find  Invoke-IcingaCheckHyperVVMM in a help file in this session. To download updated help topics type: "Update-Help". To get help
online, search for the help topic in the TechNet library at https:/go.microsoft.com/fwlink/?LinkID=107116.
At C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:20396 char:29
+         $Data            = (Get-Help $check)
+                             ~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException
    + FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand

[Notice]: The following commands were exported:
[Notice]: - 'Invoke-IcingaCheckHyperVHealth'
[Notice]: - ' Invoke-IcingaCheckHyperVOverCommitment'
[Notice]: - ' Invoke-IcingaCheckHyperVSnapshot'
[Notice]: - ' Invoke-IcingaCheckHyperVVirtualSwitches'
[Notice]: - ' Invoke-IcingaCheckHyperVVMHealth'
[Notice]: - ' Invoke-IcingaCheckHyperVVMM'
[Notice]: JSON export created in 'c:\temp\PowerShell_CheckCommands_08-08-2022-18-04-8113.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!
PS C:\Users\pb00269>

Current system: Windows 10 with PS5.1.

wp-perc commented 1 year ago

Ok, I found the answer at my question: the issue is in the content of CheckName switch: a leading space in almost all commands.

So the issue is now different: why the basket has been created with the commands inside?

LordHepipud commented 1 year ago

Hello

Thanks for the issue. Are you using an Icinga Shell to generate the configuration? You will have to either make use of

icinga -Shell

or use

icinga {
Get-IcingaCheckCommandConfig -OutDirectory c:\temp -CheckName @("Invoke-IcingaCheckHyperVHealth", " Invoke-IcingaCheckHyperVOverCommitment", " Invoke-IcingaCheckHyperVSnapshot", " Invoke-IcingaCheckHyperVVirtualSwitches", " Invoke-IcingaCheckHyperVVMHealth", " Invoke-IcingaCheckHyperVVMM")
}

Otherwise the module components will not load inside the shell and therefor resulting in errors.

Is there a reason to compile the check commands yourself instead of using the ones shipped with each release and the master branch?