Get-IcingaCheckCommandConfig: improve -IcingaConfig documentation

The old Cmdlet's documentation implied that just by passing the
-IcingaConfig switch, an Icinga 2 configuration would be generated.
However, the first two examples does not work as intended, as
-IcingaConfig only works together with the -OutDirectory parameter.

The documentation was updated to reflect as Get-IcingaCheckCommandConfig
behaves and how one can generate Icinga 2 configurations. In addition,
a note was added to the Cmdlet's API documentation to handle
expectations of the switch.
This commit is contained in:
Alvar Penning 2023-10-10 09:32:25 +02:00 committed by Lord Hepipud
parent 4a6a8ed99c
commit 3262530d13
2 changed files with 10 additions and 13 deletions

View file

@ -1,35 +1,31 @@
# Icinga Config Generator
To make the integration as easy as possible, the Framework is shipping with an Icinga 2 configuration generator. Each Check-Plugin available within the Framework is able to auto-generate a Icinga config which can be copied to your Icinga 2 hosts.
To make the integration as easy as possible, the Framework is shipping with an Icinga 2 configuration generator. Each Check-Plugin available within the Framework is able to auto-generate an Icinga config which can be copied to your Icinga 2 hosts.
## Generating Configuration
To automatically generate the Icinga configuration, open a PowerShell terminal and type in
```powershell
icinga
Use-Icinga
```
to load the Icinga PowerShell Framework.
to load the framework Cmdlets.
Now use the same commands as for the [Icinga Director Basket](01-Director-Baskets.md) but make sure to specify an `-OutDirectory` together with the `-IcingaConfig` switch. The `-IcingaConfig` switch only changes the generated output file format, not the returned resp. printed string. Thus, using `-IcingaConfig` without an `-OutDirectory` does not have an impact.
Afterwards use the command
```powershell
Get-IcingaCheckCommandConfig -IcingaConfig;
Get-IcingaCheckCommandConfig -OutDirectory 'C:\Users\myuser\Documents\' -IcingaConfig
```
to automatically generate the configuration for all found Check-Commands.
to automatically generate the configuration for all found Check-Commands in the given directory.
If you wish to specify specific commands only, you can filter them as well:
```powershell
Get-IcingaCheckCommandConfig -CheckName Invoke-IcingaCheckBiosSerial, Invoke-IcingaCheckCPU -IcingaConfig;
```
Last but not least you can output the Icinga configuration directly into a file. To do this, simply use the `OutDirectory` argument. You only require to specify a directory here, as the file including a timestamp is generated by the Cmdlet itself
```powershell
Get-IcingaCheckCommandConfig -OutDirectory 'C:\Users\myuser\Documents\'
Get-IcingaCheckCommandConfig -CheckName Invoke-IcingaCheckBiosSerial, Invoke-IcingaCheckCPU -OutDirectory 'C:\Users\myuser\Documents\' -IcingaConfig
```
Once the file is exported, you can copy the `.conf` files onto your Icinga 2 hosts to use them.

View file

@ -54,7 +54,8 @@
.PARAMETER IcingaConfig
Will switch the configuration generator to write plain Icinga 2 `.conf`
files instead of Icinga Director Basket `.json` files
files instead of Icinga Director Basket `.json` files.
Does only affect the written files, not the Cmdlet's String output.
.INPUTS
System.Array