From 064ea74b6f5598b103bd26cf78f5cec70f7d8639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Thu, 12 Sep 2024 15:02:21 +0200 Subject: [PATCH] installer: fix arm64 msi installer (#1623) --- .github/workflows/release.yml | 17 ++++++++----- README.md | 46 ++++++++++++++++++++--------------- installer/files.wxs | 2 +- installer/main.wxs | 24 ++++++++++++------ 4 files changed, 55 insertions(+), 34 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9a42d860..87055671 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,6 +26,9 @@ jobs: runs-on: windows-2022 steps: - uses: actions/checkout@v4 + with: + fetch-depth: '0' + - uses: actions/setup-go@v5 with: go-version-file: 'go.mod' @@ -88,12 +91,6 @@ jobs: Get-ChildItem -Path output - - name: Upload Artifacts - uses: actions/upload-artifact@v4 - with: - name: windows_exporter_binaries - path: output\windows_exporter-*.exe - - name: Build Release Artifacts run: | $ErrorActionPreference = "Stop" @@ -109,6 +106,14 @@ jobs: promu checksum output\ + - name: Upload Artifacts + uses: actions/upload-artifact@v4 + with: + name: windows_exporter_binaries + path: | + output\windows_exporter-*.exe + output\windows_exporter-*.msi + - name: Build Docker Artifacts run: make build-all env: diff --git a/README.md b/README.md index 6b23bb04..91a14e82 100644 --- a/README.md +++ b/README.md @@ -110,47 +110,55 @@ The configuration file The following parameters are available: -| Name | Description | -|----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `ENABLED_COLLECTORS` | As the `--collectors.enabled` flag, provide a comma-separated list of enabled collectors | -| `LISTEN_ADDR` | The IP address to bind to. Defaults to an empty string. (any local address) | -| `LISTEN_PORT` | The port to bind to. Defaults to `9182`. | -| `METRICS_PATH` | The path at which to serve metrics. Defaults to `/metrics` | -| `TEXTFILE_DIRS` | Use the `--collector.textfile.directories` flag to specify one or more directories, separated by commas, where the collector should read text files containing metrics | -| `REMOTE_ADDR` | Allows setting comma separated remote IP addresses for the Windows Firewall exception (allow list). Defaults to an empty string (any remote address). | -| `EXTRA_FLAGS` | Allows passing full CLI flags. Defaults to an empty string. | -| `ADDLOCAL` | Enables features within the windows_exporter installer. Supported values: `FirewallException` | -| `REMOVE` | Disables features within the windows_exporter installer. Supported values: `FirewallException` | +| Name | Description | +|----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `ENABLED_COLLECTORS` | As the `--collectors.enabled` flag, provide a comma-separated list of enabled collectors | +| `CONFIG_FILE` | Use the `--config.file` flag to specify a config file. If empty, no config file will be set. The special value `config.yaml` set the path to the config.yaml at install dir | | +| `LISTEN_ADDR` | The IP address to bind to. Defaults to an empty string. (any local address) | +| `LISTEN_PORT` | The port to bind to. Defaults to `9182`. | +| `METRICS_PATH` | The path at which to serve metrics. Defaults to `/metrics` | +| `TEXTFILE_DIRS` | Use the `--collector.textfile.directories` flag to specify one or more directories, separated by commas, where the collector should read text files containing metrics | +| `REMOTE_ADDR` | Allows setting comma separated remote IP addresses for the Windows Firewall exception (allow list). Defaults to an empty string (any remote address). | +| `EXTRA_FLAGS` | Allows passing full CLI flags. Defaults to an empty string. For `--collectors.enabled` and `--config.file`, use the specialized properties `ENABLED_COLLECTORS` and `CONFIG_FILE` | +| `ADDLOCAL` | Enables features within the windows_exporter installer. Supported values: `FirewallException` | +| `REMOVE` | Disables features within the windows_exporter installer. Supported values: `FirewallException` | -Parameters are sent to the installer via `msiexec`. Example invocations: +Parameters are sent to the installer via `msiexec`. +On PowerShell, the `--%` should be passed before defining properties. + +Example invocations: ```powershell -msiexec /i ENABLED_COLLECTORS=os,iis LISTEN_PORT=5000 +msiexec /i --% ENABLED_COLLECTORS=os,iis LISTEN_PORT=5000 ``` Example service collector with a custom query. ```powershell -msiexec /i ENABLED_COLLECTORS=os,service --% EXTRA_FLAGS="--collector.service.services-where ""Name LIKE 'sql%'""" +msiexec /i --% ENABLED_COLLECTORS=os,service EXTRA_FLAGS="--collectors.exchange.enabled=""ADAccessProcesses""" +``` + +Define a config file. +```powershell +msiexec /i --% CONFIG_FILE="D:\config.yaml" ``` On some older versions of Windows, you may need to surround parameter values with double quotes to get the installation command parsing properly: ```powershell -msiexec /i C:\Users\Administrator\Downloads\windows_exporter.msi ENABLED_COLLECTORS="ad,iis,logon,memory,process,tcp,textfile,thermalzone" TEXTFILE_DIRS="C:\custom_metrics\" +msiexec /i C:\Users\Administrator\Downloads\windows_exporter.msi --% ENABLED_COLLECTORS="ad,iis,logon,memory,process,tcp,textfile,thermalzone" TEXTFILE_DIRS="C:\custom_metrics\" ``` To install the exporter with creating a firewall exception, use the following command: ```powershell -msiexec /i ADDLOCAL=FirewallException +msiexec /i --% ADDLOCAL=FirewallException ``` - -Powershell versions 7.3 and above require [PSNativeCommandArgumentPassing](https://learn.microsoft.com/en-us/powershell/scripting/learn/experimental-features?view=powershell-7.3) to be set to `Legacy` when using `--% EXTRA_FLAGS`: +PowerShell versions 7.3 and above require [PSNativeCommandArgumentPassing](https://learn.microsoft.com/en-us/powershell/scripting/learn/experimental-features?view=powershell-7.3) to be set to `Legacy` when using `--% EXTRA_FLAGS`: ```powershell $PSNativeCommandArgumentPassing = 'Legacy' -msiexec /i ENABLED_COLLECTORS=os,service --% EXTRA_FLAGS="--collector.service.services-where ""Name LIKE 'sql%'""" +msiexec /i ENABLED_COLLECTORS=os,service --% EXTRA_FLAGS="--collectors.exchange.enabled=""ADAccessProcesses""" ``` ## Docker Implementation diff --git a/installer/files.wxs b/installer/files.wxs index 90794a97..1578d912 100644 --- a/installer/files.wxs +++ b/installer/files.wxs @@ -13,7 +13,7 @@ Start="auto" Type="ownProcess" Vital="yes" - Arguments="--log.file eventlog --config.file="[APPLICATIONFOLDER]config.yaml" [CollectorsFlag] [ListenFlag] [MetricsPathFlag] [TextfileDirsFlag] [ExtraFlags]"> + Arguments="--log.file eventlog [ConfigFile_NonDefault][ConfigFile_Default] [CollectorsFlag] [ListenFlag] [MetricsPathFlag] [TextfileDirsFlag] [ExtraFlags]"> - - - - + + + + - + + + + + @@ -132,15 +136,19 @@ - + - + - + + + + +