|
| 1 | +# Update Framework and Components |
| 2 | + |
| 3 | +Icinga for Windows ships with a bunch of Cmdlets, allowing users to manage the entire environment without much effort. This includes features to install entire components, but also allows to update them. |
| 4 | + |
| 5 | +## Updating Icinga PowerShell Framework |
| 6 | + |
| 7 | +To update the Framework it is not required to run the [installation process](..\02-Installation.md) again. The Framework ships with a native command for this and is recommended to use, as this allows you to keep your current configuration and cache files. The command is `Install-IcingaFrameworkUpdate`. |
| 8 | + |
| 9 | +### Interactive Update |
| 10 | + |
| 11 | +To start the interactive update with a wizard, asking you on how to update, simply type the command inside your Icinga shell or call `Use-Icinga` before. |
| 12 | + |
| 13 | +```powershell |
| 14 | +Install-IcingaFrameworkUpdate; |
| 15 | +``` |
| 16 | + |
| 17 | +Afterwards you will be asked a bunch of questions, which we explain in the following. |
| 18 | + |
| 19 | +```text |
| 20 | +Do you provide a custom repository for "Icinga Framework"? (y/N): |
| 21 | +``` |
| 22 | + |
| 23 | +Like any other component, you can type in y or n for this answer. The custom repository is defined as a `.zip` file you might have downloaded directly from GitHub for the Framework at placed it either on your Icinga webserver somewhere, or locally. If you type no, you can choose if you want to install the latest stable or snapshot. |
| 24 | + |
| 25 | +```text |
| 26 | +Which version of the "Icinga Framework" do you want to install? (release/snapshot) (Defaults: "release"): |
| 27 | +``` |
| 28 | + |
| 29 | +By default the command will connect to `https://github.com/Icinga/icinga-powershell-framework` and either fetch the latest stable release if you select `release` or the current master branch if you use `snapshot`. |
| 30 | +Lets assume we update our production environment and therefor using `release`. |
| 31 | + |
| 32 | +```powershell |
| 33 | +icinga> Install-IcingaFrameworkUpdate |
| 34 | +Do you provide a custom repository for "Icinga Framework"? (y/N): |
| 35 | +Which version of the "Icinga Framework" do you want to install? (release/snapshot) (Defaults: "release"): |
| 36 | +[Notice]: Downloading "Icinga Framework" into "C:\Users\Administrator\AppData\Local\Temp\tmp_icinga1262975608.d" |
| 37 | +[Notice]: Installing module into "C:\Users\Administrator\AppData\Local\Temp\tmp_icinga1262975608.d" |
| 38 | +[Notice]: Using content of folder "C:\Users\Administrator\AppData\Local\Temp\tmp_icinga1262975608.d\icinga-powershell-framework-1.4.1" for updates |
| 39 | +[Notice]: Stopping Icinga Agent service |
| 40 | +[Notice]: Stopping service "icinga2" |
| 41 | +[Notice]: Removing files from framework |
| 42 | +[Notice]: Copying new files to framework |
| 43 | +[Notice]: Unblocking Icinga PowerShell Files |
| 44 | +[Notice]: Cleaning temporary content |
| 45 | +[Notice]: Updating Framework cache file |
| 46 | +[Notice]: The code caching feature is currently not enabled. You can enable it with "Enable-IcingaFrameworkCodeCache" |
| 47 | +[Notice]: Framework update has been completed. Please start a new PowerShell instance now to complete the update |
| 48 | +[Passed]: Icinga Agent service is installed |
| 49 | +[Passed]: The specified user "NT Authority\NetworkService" is allowed to run as service |
| 50 | +[Passed]: Directory "C:\ProgramData\icinga2\etc" is accessible and writeable by the Icinga Service User "NT Authority\NetworkService" |
| 51 | +[Passed]: Directory "C:\ProgramData\icinga2\var" is accessible and writeable by the Icinga Service User "NT Authority\NetworkService" |
| 52 | +[Passed]: Directory "C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache" is accessible and writeable by the Icinga Service User "NT Authority\NetworkService" |
| 53 | +[Passed]: Icinga Agent configuration is valid |
| 54 | +[Passed]: Icinga Agent debug log is disabled |
| 55 | +[Notice]: Starting Icinga Agent service |
| 56 | +[Notice]: Starting service "icinga2" |
| 57 | +``` |
| 58 | + |
| 59 | +Thats it. Your Icinga Agent will now continue it's work behind without requiring additional actions. If you want to use the new Framework features, you should open a new PowerShell instance to apply the updates to your current session. |
| 60 | + |
| 61 | +### Update With Defined Package |
| 62 | + |
| 63 | +To avoid the above wizard and to properly automate the task, the Cmdlet `Install-IcingaFrameworkUpdate` ships with one additional argument: `-FrameworkUrl` |
| 64 | + |
| 65 | +As `-FrameworkUrl` you can define the target to the Icinga PowerShell Frameworks `.zip` file and directly install this version with the same result as above, but fully automated without questions. |
| 66 | + |
| 67 | +#### Examples For URL |
| 68 | + |
| 69 | +Local File: |
| 70 | + |
| 71 | +```powershell |
| 72 | +Install-IcingaFrameworkUpdate -FrameworkUrl 'C:\Icinga2\icinga-powershell-framework-1.5.0.zip'; |
| 73 | +``` |
| 74 | + |
| 75 | +NetworkShare File: |
| 76 | + |
| 77 | +```powershell |
| 78 | +Install-IcingaFrameworkUpdate -FrameworkUrl '\\icinga.example.com\IcingaForWindows\Icinga2\icinga-powershell-framework-1.5.0.zip'; |
| 79 | +``` |
| 80 | + |
| 81 | +Custom Web Path: |
| 82 | + |
| 83 | +```powershell |
| 84 | +Install-IcingaFrameworkUpdate -FrameworkUrl 'https://example.com/Icinga/icinga-powershell-framework-1.5.0.zip'; |
| 85 | +``` |
| 86 | + |
| 87 | +GitHub Release: |
| 88 | + |
| 89 | +```powershell |
| 90 | +Install-IcingaFrameworkUpdate -FrameworkUrl 'https://github.com/Icinga/icinga-powershell-framework/archive/refs/tags/v1.5.0.zip'; |
| 91 | +``` |
| 92 | + |
| 93 | +GitHub Master Branch: |
| 94 | + |
| 95 | +```powershell |
| 96 | +Install-IcingaFrameworkUpdate -FrameworkUrl 'https://github.com/Icinga/icinga-powershell-framework/archive/refs/heads/master.zip'; |
| 97 | +``` |
| 98 | + |
| 99 | +GitHub Branch |
| 100 | + |
| 101 | +```powershell |
| 102 | +Install-IcingaFrameworkUpdate -FrameworkUrl 'https://github.com/Icinga/icinga-powershell-framework/archive/refs/heads/fix/framework_root_folder_lookup.zip'; |
| 103 | +``` |
| 104 | + |
| 105 | +Once you enter the command, the update process will continue as shown above earlier |
| 106 | + |
| 107 | +## Updating Icinga PowerShell Components |
| 108 | + |
| 109 | +Updating components like [plugins](https://icinga.com/docs/icinga-for-windows/latest/plugins/doc/01-Introduction/) is as easy as installing them. If you used the [Framework Component Installer](https://icinga.com/docs/icinga-for-windows/latest/plugins/doc/02-Installation/#icinga-framework-component-installer) as described in every plugin repository, you can use the same command to update the plugins as well. |
| 110 | + |
| 111 | +The command `Install-IcingaFrameworkComponent` is designed to both, install components on a fresh environment and also keeps them updated if you run the same command again. |
0 commit comments