From d2c9ef9b5b2eec765905d52628c1552d47543009 Mon Sep 17 00:00:00 2001 From: LordHepipud Date: Thu, 6 Dec 2018 18:21:55 +0100 Subject: [PATCH] Change New-Icinga-Setup Cmdlet to Install-Icinga Fixes #3 to follow PS guidelines for Cmdlets --- core/include/Enums.ps1 | 2 +- core/init.ps1 | 2 +- doc/02-Installation.md | 2 +- icinga-module-windows.psd1 | 2 +- icinga-module-windows.psm1 | 16 ++++++++-------- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/include/Enums.ps1 b/core/include/Enums.ps1 index 7da2b31..d97bdab 100644 --- a/core/include/Enums.ps1 +++ b/core/include/Enums.ps1 @@ -37,7 +37,7 @@ }; [hashtable]$ServiceStatus = @{ - 'NotInstalled' = 'The Icinga service for this module is not installed. Please run New-Icinga-Setup to install the service.'; + 'NotInstalled' = 'The Icinga service for this module is not installed. Please run Install-Icinga to install the service.'; 'Running' = 'The Icinga service is running.'; 'Stopped' = 'The Icinga service is not running.'; 'Starting' = 'The Icinga service is about to start.'; diff --git a/core/init.ps1 b/core/init.ps1 index c5f4842..323b3e7 100644 --- a/core/init.ps1 +++ b/core/init.ps1 @@ -15,7 +15,7 @@ Set-Variable -Name Icinga2 -Option Constant -Value @{ 'Restart-Icinga-Service', 'New-Icinga-Service', 'Remove-Icinga-Service', - 'New-Icinga-Setup', + 'Install-Icinga', 'Get-Icinga-Setup', 'Start-Icinga-Daemon', 'Stop-Icinga-Daemon', diff --git a/doc/02-Installation.md b/doc/02-Installation.md index 2a437b3..020e33f 100644 --- a/doc/02-Installation.md +++ b/doc/02-Installation.md @@ -35,7 +35,7 @@ Configure the module Once the module is installed, you will want to run the initial setup. Therefor you will simply have to type in the command ```powershell - New-Icinga-Setup + Install-Icinga ``` This will create the base configuration of the module including the setup of directories and required files within the **PowerShell Module Directory**. diff --git a/icinga-module-windows.psd1 b/icinga-module-windows.psd1 index 13f3166..513bdcd 100644 --- a/icinga-module-windows.psd1 +++ b/icinga-module-windows.psd1 @@ -25,7 +25,7 @@ Description = 'Icinga 2 Windows Agent Module, which allows to entirely monitor t PowerShellVersion = '3.0' # Aus diesem Modul zu exportierende Funktionen. Um optimale Leistung zu erzielen, verwenden Sie keine Platzhalter und löschen den Eintrag nicht. Verwenden Sie ein leeres Array, wenn keine zu exportierenden Funktionen vorhanden sind. -FunctionsToExport = @( 'Start-Icinga-Checker', 'Stop-Icinga-Checker', 'Get-Icinga-Lib', 'Get-Icinga-Object', 'Get-Icinga-Service', 'Start-Icinga-Service', 'Stop-Icinga-Service', 'Restart-Icinga-Service', 'New-Icinga-Service', 'Remove-Icinga-Service', 'Get-Icinga-Setup', 'New-Icinga-Setup', 'Start-Icinga-Daemon', 'Stop-Icinga-Daemon', 'Icinga-Client', 'Get-Icinga-Command', 'New-Icinga-Monitoring', 'Get-Icinga-Counter', 'Get-Icinga-Config', 'Set-Icinga-Config', 'Remove-Icinga-Config', 'New-Icinga-Config' ) +FunctionsToExport = @( 'Start-Icinga-Checker', 'Stop-Icinga-Checker', 'Get-Icinga-Lib', 'Get-Icinga-Object', 'Get-Icinga-Service', 'Start-Icinga-Service', 'Stop-Icinga-Service', 'Restart-Icinga-Service', 'New-Icinga-Service', 'Remove-Icinga-Service', 'Get-Icinga-Setup', 'Install-Icinga', 'Start-Icinga-Daemon', 'Stop-Icinga-Daemon', 'Icinga-Client', 'Get-Icinga-Command', 'New-Icinga-Monitoring', 'Get-Icinga-Counter', 'Get-Icinga-Config', 'Set-Icinga-Config', 'Remove-Icinga-Config', 'New-Icinga-Config' ) # Aus diesem Modul zu exportierende Cmdlets. Um optimale Leistung zu erzielen, verwenden Sie keine Plat'zhalter und löschen den Eintrag nicht. Verwenden Sie ein leeres Array, wenn keine zu exportierenden Cmdlets vorhanden sind. CmdletsToExport = @() diff --git a/icinga-module-windows.psm1 b/icinga-module-windows.psm1 index d99e1ed..4595ba1 100644 --- a/icinga-module-windows.psm1 +++ b/icinga-module-windows.psm1 @@ -4,12 +4,12 @@ .DESCRIPTION More Information on https://github.com/LordHepipud/icinga-module-windows .EXAMPLE - New-Icinga-Setup + Install-Icinga .NOTES #> -function New-Icinga-Setup() +function Install-Icinga() { [string]$command = Get-Icinga-Command('setup'); return &$command; @@ -65,7 +65,7 @@ function Start-Icinga-Daemon if ((Get-Icinga-Setup) -eq $FALSE) { $Icinga2.Log.Write( $Icinga2.Enums.LogState.Warning, - 'The agent seems to be not configured on this system. Please run "New-Icinga-Setup" and try again.' + 'The agent seems to be not configured on this system. Please run "Install-Icinga" and try again.' ); return; } @@ -82,7 +82,7 @@ function Stop-Icinga-Daemon() if ((Get-Icinga-Setup) -eq $FALSE) { $Icinga2.Log.Write( $Icinga2.Enums.LogState.Warning, - 'The agent seems to be not configured on this system. Please run "New-Icinga-Setup" and try again.' + 'The agent seems to be not configured on this system. Please run "Install-Icinga" and try again.' ); return; } @@ -100,7 +100,7 @@ function Start-Icinga-Checker if ((Get-Icinga-Setup) -eq $FALSE) { $Icinga2.Log.Write( $Icinga2.Enums.LogState.Warning, - 'The agent seems to be not configured on this system. Please run "New-Icinga-Setup" and try again.' + 'The agent seems to be not configured on this system. Please run "Install-Icinga" and try again.' ); return; } @@ -117,7 +117,7 @@ function Stop-Icinga-Checker if ((Get-Icinga-Setup) -eq $FALSE) { $Icinga2.Log.Write( $Icinga2.Enums.LogState.Warning, - 'The agent seems to be not configured on this system. Please run "New-Icinga-Setup" and try again.' + 'The agent seems to be not configured on this system. Please run "Install-Icinga" and try again.' ); return; } @@ -156,7 +156,7 @@ function New-Icinga-Monitoring() if ((Get-Icinga-Setup) -eq $FALSE) { $Icinga2.Log.Write( $Icinga2.Enums.LogState.Warning, - 'The agent seems to be not configured on this system. Please run "New-Icinga-Setup" and try again.' + 'The agent seems to be not configured on this system. Please run "Install-Icinga" and try again.' ); return; } @@ -197,7 +197,7 @@ function Get-Icinga-Counter() if ((Get-Icinga-Setup) -eq $FALSE) { $Icinga2.Log.Write( $Icinga2.Enums.LogState.Warning, - 'The agent seems to be not configured on this system. Please run "New-Icinga-Setup" and try again.' + 'The agent seems to be not configured on this system. Please run "Install-Icinga" and try again.' ); return; }