mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-25 22:26:37 +00:00
installer: Add UI + Replace ADD_FIREWALL_EXCEPTION with ADDLOCAL=FirewallException (#1611)
This commit is contained in:
@@ -3,4 +3,4 @@ root = true
|
|||||||
[*.wxs]
|
[*.wxs]
|
||||||
|
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 4
|
||||||
1
.github/workflows/release.yml
vendored
1
.github/workflows/release.yml
vendored
@@ -62,6 +62,7 @@ jobs:
|
|||||||
- name: Install WiX extensions
|
- name: Install WiX extensions
|
||||||
run: |
|
run: |
|
||||||
wix extension add -g WixToolset.Util.wixext
|
wix extension add -g WixToolset.Util.wixext
|
||||||
|
wix extension add -g WixToolset.Ui.wixext
|
||||||
wix extension add -g WixToolset.Firewall.wixext
|
wix extension add -g WixToolset.Firewall.wixext
|
||||||
|
|
||||||
- name: Install Build deps
|
- name: Install Build deps
|
||||||
|
|||||||
42
README.md
42
README.md
@@ -94,23 +94,33 @@ windows_exporter accepts flags to configure certain behaviours. The ones configu
|
|||||||
| `--config.file.insecure-skip-verify` | Skip TLS when loading config file from URL | false |
|
| `--config.file.insecure-skip-verify` | Skip TLS when loading config file from URL | false |
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
The latest release can be downloaded from the [releases page](https://github.com/prometheus-community/windows_exporter/releases).
|
The latest release can be downloaded from the [releases page](https://github.com/prometheus-community/windows_exporter/releases).
|
||||||
|
|
||||||
Each release provides a .msi installer. The installer will setup the windows_exporter as a Windows service, as well as create an exception in the Windows Firewall.
|
Each release provides a .msi installer. The installer will setup the windows_exporter as a Windows service, as well as create an exception in the Windows Firewall.
|
||||||
|
|
||||||
If the installer is run without any parameters, the exporter will run with default settings for enabled collectors, ports, etc. The following parameters are available:
|
If the installer is run without any parameters, the exporter will run with default settings for enabled collectors, ports, etc.
|
||||||
|
|
||||||
| Name | Description |
|
The installer provides a configuration file to customize the exporter.
|
||||||
|----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
||||||
| `ENABLED_COLLECTORS` | As the `--collectors.enabled` flag, provide a comma-separated list of enabled collectors |
|
The configuration file
|
||||||
| `LISTEN_ADDR` | The IP address to bind to. Defaults to an empty string. (any local address) |
|
* is located in the same directory as the exporter executable.
|
||||||
| `LISTEN_PORT` | The port to bind to. Defaults to `9182`. |
|
* has the YAML format and is provided with the `--config.file` parameter.
|
||||||
| `METRICS_PATH` | The path at which to serve metrics. Defaults to `/metrics` |
|
* can be used to enable or disable collectors, set collector-specific parameters, and set global parameters.
|
||||||
| `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). |
|
The following parameters are available:
|
||||||
| `EXTRA_FLAGS` | Allows passing full CLI flags. Defaults to an empty string. |
|
|
||||||
| `ADD_FIREWALL_EXCEPTION` | Setup an firewall exception for windows_exporter. Defaults to `no`. |
|
| Name | Description |
|
||||||
| `ENABLE_V1_PERFORMANCE_COUNTERS` | Enables V1 performance counter on modern systems. Defaults to `yes`. |
|
|----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| `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` |
|
||||||
|
|
||||||
Parameters are sent to the installer via `msiexec`. Example invocations:
|
Parameters are sent to the installer via `msiexec`. Example invocations:
|
||||||
|
|
||||||
@@ -132,13 +142,7 @@ msiexec /i C:\Users\Administrator\Downloads\windows_exporter.msi ENABLED_COLLECT
|
|||||||
To install the exporter with creating a firewall exception, use the following command:
|
To install the exporter with creating a firewall exception, use the following command:
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
msiexec /i <path-to-msi-file> ADD_FIREWALL_EXCEPTION=yes
|
msiexec /i <path-to-msi-file> ADDLOCAL=FirewallException
|
||||||
```
|
|
||||||
|
|
||||||
To repair an installation, e.g force re-creating Windows service:
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
msiexec /fa <path-to-msi-file>
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ Copy-Item -Force $PathToExecutable Work/windows_exporter.exe
|
|||||||
Write-Verbose "Creating windows_exporter-${Version}-${Arch}.msi"
|
Write-Verbose "Creating windows_exporter-${Version}-${Arch}.msi"
|
||||||
$wixArch = @{"amd64" = "x64"; "arm64" = "arm64"}[$Arch]
|
$wixArch = @{"amd64" = "x64"; "arm64" = "arm64"}[$Arch]
|
||||||
|
|
||||||
Invoke-Expression "wix build -arch $wixArch -o .\windows_exporter-$($Version)-$($Arch).msi .\windows_exporter.wxs -d Version=$($MsiVersion) -ext WixToolset.Firewall.wixext -ext WixToolset.Util.wixext"
|
Invoke-Expression "wix build -arch $wixArch -o .\windows_exporter-$($Version)-$($Arch).msi .\files.wxs .\main.wxs -d ProductName=windows_exporter -d Version=$($MsiVersion) -ext WixToolset.Firewall.wixext -ext WixToolset.UI.wixext -ext WixToolset.Util.wixext"
|
||||||
|
|
||||||
Write-Verbose "Done!"
|
Write-Verbose "Done!"
|
||||||
Pop-Location
|
Pop-Location
|
||||||
|
|||||||
38
installer/files.wxs
Normal file
38
installer/files.wxs
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:netfx="http://wixtoolset.org/schemas/v4/wxs/netfx"
|
||||||
|
xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
|
||||||
|
<Fragment>
|
||||||
|
<DirectoryRef Id="APPLICATIONFOLDER">
|
||||||
|
<Component Transitive="yes">
|
||||||
|
<File Id="windows_exporter.exe" Name="windows_exporter.exe" Source="Work\windows_exporter.exe" KeyPath="yes" Vital="yes" Checksum="yes"/>
|
||||||
|
<ServiceInstall
|
||||||
|
Id="InstallExporterService"
|
||||||
|
Name="windows_exporter"
|
||||||
|
DisplayName="windows_exporter"
|
||||||
|
Description="Exports Prometheus metrics about the system"
|
||||||
|
ErrorControl="normal"
|
||||||
|
Start="auto"
|
||||||
|
Type="ownProcess"
|
||||||
|
Vital="yes"
|
||||||
|
Arguments="--log.file eventlog --config.file="[APPLICATIONFOLDER]config.yaml" [CollectorsFlag] [ListenFlag] [MetricsPathFlag] [TextfileDirsFlag] [ExtraFlags]">
|
||||||
|
<util:ServiceConfig
|
||||||
|
ResetPeriodInDays="1"
|
||||||
|
FirstFailureActionType="restart"
|
||||||
|
SecondFailureActionType="restart"
|
||||||
|
ThirdFailureActionType="restart"
|
||||||
|
RestartServiceDelayInSeconds="60"
|
||||||
|
/>
|
||||||
|
<ServiceDependency Id="wmiApSrv" />
|
||||||
|
</ServiceInstall>
|
||||||
|
<ServiceControl Id="ServiceStateControl" Name="windows_exporter" Remove="uninstall" Start="install" Stop="both"/>
|
||||||
|
</Component>
|
||||||
|
<Component Id="CreateTextfileDirectory" Directory="textfile_inputs" Guid="d03ef58a-9cbf-4165-ad39-d143e9b27e14">
|
||||||
|
<CreateFolder />
|
||||||
|
</Component>
|
||||||
|
</DirectoryRef>
|
||||||
|
|
||||||
|
<ComponentGroup Id="CG_Files">
|
||||||
|
<ComponentRef Id="windows_exporter.exe" />
|
||||||
|
<ComponentRef Id="CreateTextfileDirectory" />
|
||||||
|
</ComponentGroup>
|
||||||
|
</Fragment>
|
||||||
|
</Wix>
|
||||||
211
installer/main.wxs
Normal file
211
installer/main.wxs
Normal file
@@ -0,0 +1,211 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<?ifndef Version?>
|
||||||
|
<?error Version must be defined?>
|
||||||
|
<?endif?>
|
||||||
|
<?if $(sys.BUILDARCH)=x64 ?>
|
||||||
|
<?define PlatformProgramFiles = "ProgramFiles64Folder" ?>
|
||||||
|
<?else?>
|
||||||
|
<?error Platform $(var.Platform) is not supported?>
|
||||||
|
<?endif?>
|
||||||
|
|
||||||
|
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
|
||||||
|
xmlns:fw="http://wixtoolset.org/schemas/v4/wxs/firewall"
|
||||||
|
xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
|
||||||
|
<Package UpgradeCode="66a6eb5b-1fc2-4b14-a362-5ceec6413308" Name="$(var.ProductName)" Version="$(var.Version)"
|
||||||
|
Manufacturer="prometheus-community" Language="1033" Scope="perMachine">
|
||||||
|
<SummaryInformation Manufacturer="prometheus-community" Description="$(var.ProductName) $(var.Version) installer" />
|
||||||
|
|
||||||
|
<Upgrade Id="66a6eb5b-1fc2-4b14-a362-5ceec6413308">
|
||||||
|
<UpgradeVersion IncludeMinimum="no"
|
||||||
|
Minimum="$(var.Version)"
|
||||||
|
OnlyDetect="no"
|
||||||
|
Property="NEWERVERSIONDETECTED" />
|
||||||
|
<UpgradeVersion IncludeMaximum="yes"
|
||||||
|
IncludeMinimum="yes"
|
||||||
|
Maximum="$(var.Version)"
|
||||||
|
Minimum="0.0.0.0"
|
||||||
|
Property="OLDERVERSIONBEINGUPGRADED" />
|
||||||
|
</Upgrade>
|
||||||
|
|
||||||
|
<CustomAction Id="set_maintenance" Property="MAINTENANCE" Value="true" />
|
||||||
|
|
||||||
|
<!-- Set to reinstall all features. -->
|
||||||
|
<CustomAction Id="set_reinstall_all_property"
|
||||||
|
Property="REINSTALL"
|
||||||
|
Value="ALL" />
|
||||||
|
<!-- "amus" will force reinstall all files.
|
||||||
|
See https://docs.microsoft.com/en-us/windows/desktop/Msi/reinstallmode -->
|
||||||
|
<CustomAction Id="set_reinstallmode_property"
|
||||||
|
Property="REINSTALLMODE"
|
||||||
|
Value="amus" />
|
||||||
|
<SetProperty
|
||||||
|
Id="CreateConfigFile"
|
||||||
|
Value=""[%ComSpec]" /c TYPE NUL >>"[APPLICATIONFOLDER]config.yaml""
|
||||||
|
Before="CreateConfigFile"
|
||||||
|
Sequence="execute"
|
||||||
|
/>
|
||||||
|
<CustomAction
|
||||||
|
Id="CreateConfigFile"
|
||||||
|
BinaryRef="Wix4UtilCA_$(sys.BUILDARCHSHORT)"
|
||||||
|
DllEntry="WixQuietExec"
|
||||||
|
Execute="deferred"
|
||||||
|
Return="check"
|
||||||
|
Impersonate="no"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<InstallExecuteSequence>
|
||||||
|
<!-- Set REINSTALL=all and REINSTALLMODE=amus if the user reruns the
|
||||||
|
MSI, which will force reinstalling all files and services. -->
|
||||||
|
<Custom Action="set_maintenance" Before="set_reinstall_all_property"
|
||||||
|
Condition="Installed AND (NOT REMOVE) AND (NOT UPGRADINGPRODUCTCODE)"/>
|
||||||
|
<Custom Action="set_reinstall_all_property" Before="set_reinstallmode_property" Condition="MAINTENANCE"/>
|
||||||
|
<Custom Action="set_reinstallmode_property" Before="LaunchConditions" Condition="MAINTENANCE"/>
|
||||||
|
<Custom Action="CreateConfigFile" Before="InstallServices" />
|
||||||
|
</InstallExecuteSequence>
|
||||||
|
|
||||||
|
<Media Id="1" Cabinet="windows_exporter.cab" EmbedCab="yes" />
|
||||||
|
<MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." AllowSameVersionUpgrades="yes" />
|
||||||
|
|
||||||
|
<Property Id="ENABLED_COLLECTORS" Secure="yes" Value="[defaults]" />
|
||||||
|
<SetProperty Id="CollectorsFlag" After="InstallFiles" Sequence="execute" Value="--collectors.enabled [ENABLED_COLLECTORS]" Condition="ENABLED_COLLECTORS" />
|
||||||
|
|
||||||
|
<Property Id="EXTRA_FLAGS" Secure="yes" />
|
||||||
|
<SetProperty Id="ExtraFlags" After="InstallFiles" Sequence="execute" Value="[EXTRA_FLAGS]" Condition="EXTRA_FLAGS" />
|
||||||
|
|
||||||
|
<Property Id="LISTEN_PORT" Secure="yes" Value="9182" />
|
||||||
|
<SetProperty Id="ListenFlag" After="InstallFiles" Sequence="execute" Value="--web.listen-address [LISTEN_ADDR]:[LISTEN_PORT]" Condition="LISTEN_ADDR<>"" OR LISTEN_PORT<>9182" />
|
||||||
|
|
||||||
|
<Property Id="METRICS_PATH" Secure="yes" />
|
||||||
|
<SetProperty Id="MetricsPathFlag" After="InstallFiles" Sequence="execute" Value="--telemetry.path [METRICS_PATH]" Condition="METRICS_PATH" />
|
||||||
|
|
||||||
|
<Property Id="REMOTE_ADDR" Secure="yes" />
|
||||||
|
<SetProperty Id="RemoteAddressFlag" After="InstallFiles" Sequence="execute" Value="[REMOTE_ADDR]" Condition="REMOTE_ADDR" />
|
||||||
|
|
||||||
|
<Property Id="TEXTFILE_DIRS" Secure="yes" />
|
||||||
|
<SetProperty Id="TextfileDirsFlag" After="InstallFiles" Sequence="execute" Value="--collector.textfile.directories [TEXTFILE_DIRS]" Condition="TEXTFILE_DIRS" />
|
||||||
|
|
||||||
|
<Property Id="ARPHELPLINK" Value="https://github.com/prometheus-community/windows_exporter/issues" />
|
||||||
|
<Property Id="ARPSIZE" Value="9000" />
|
||||||
|
<Property Id="ARPURLINFOABOUT" Value="https://github.com/prometheus-community/windows_exporter" />
|
||||||
|
<!--<Property Id="ARPNOMODIFY" Value="0" />-->
|
||||||
|
<!--<Property Id="ARPNOREPAIR" Value="1" />-->
|
||||||
|
<Property Id="START_MENU_FOLDER" Value="0" />
|
||||||
|
<Property Id="NOSTART" Value="0" />
|
||||||
|
|
||||||
|
<Feature
|
||||||
|
Id="DefaultFeature"
|
||||||
|
Level="1"
|
||||||
|
Title="$(var.ProductName) $(var.Version)"
|
||||||
|
Description="The binary and configuration files for $(var.ProductName)"
|
||||||
|
Display="expand"
|
||||||
|
ConfigurableDirectory="APPLICATIONFOLDER"
|
||||||
|
AllowAdvertise="no"
|
||||||
|
InstallDefault="local"
|
||||||
|
AllowAbsent="no"
|
||||||
|
>
|
||||||
|
<ComponentGroupRef Id="CG_Files" />
|
||||||
|
|
||||||
|
<Feature
|
||||||
|
Id="FirewallException"
|
||||||
|
Level="2"
|
||||||
|
Title="Firewall Exception"
|
||||||
|
Description="Allow $(var.ProductName) to listen on a port"
|
||||||
|
Display="expand"
|
||||||
|
AllowAdvertise="no"
|
||||||
|
AllowAbsent="yes">
|
||||||
|
<ComponentGroupRef Id="CG_FirewallException" />
|
||||||
|
</Feature>
|
||||||
|
</Feature>
|
||||||
|
|
||||||
|
<UI Id="FeatureTree">
|
||||||
|
<ui:WixUI Id="WixUI_FeatureTree" />
|
||||||
|
<UIRef Id="WixUI_ErrorProgressText" />
|
||||||
|
<Dialog Id="CustomPropertiesDlg" Width="370" Height="270" Title="windows_exporter configuration">
|
||||||
|
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.CustomizeDlgBannerBitmap)" />
|
||||||
|
<!--<Control Id="Text" Type="Text" X="25" Y="55" Width="320" Height="20" Text="Text" />-->
|
||||||
|
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
|
||||||
|
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
|
||||||
|
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="This pages contains configuration related to windows_exporter" />
|
||||||
|
<Control Id="Title" Type="Text" X="15" Y="6" Width="210" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}windows_exporter configuration" />
|
||||||
|
|
||||||
|
<!-- Edit box for property input -->
|
||||||
|
<!-- cpu,cs,logical_disk,physical_disk,net,os,service,system -->
|
||||||
|
<Control Id="PropertyEdit_ENABLED_COLLECTORS_Title1" Type="Text" X="25" Y="55" Width="300" Height="15" Transparent="yes" NoPrefix="yes" Text="Comma-separated list of collectors to use. Use '[\[]defaults[\]]' as a placeholder for all" />
|
||||||
|
<Control Id="PropertyEdit_ENABLED_COLLECTORS_Title2" Type="Text" X="25" Y="65" Width="300" Height="15" Transparent="yes" NoPrefix="yes" Text="the collectors enabled by default." />
|
||||||
|
<Control Id="PropertyEdit_ENABLED_COLLECTORS" Type="Edit" X="24" Y="77" Width="300" Height="18" Property="ENABLED_COLLECTORS" Text="[ENABLED_COLLECTORS]" Indirect="no" />
|
||||||
|
|
||||||
|
<Control Id="PropertyEdit_EXTRA_FLAGS_Title" Type="Text" X="25" Y="100" Width="210" Height="15" Transparent="yes" NoPrefix="yes" Text="Additional command line flags" />
|
||||||
|
<Control Id="PropertyEdit_EXTRA_FLAGS" Type="Edit" X="24" Y="112" Width="300" Height="18" Property="EXTRA_FLAGS" Text="[EXTRA_FLAGS]" Indirect="no" />
|
||||||
|
|
||||||
|
<Control Id="PropertyEdit_LISTEN_PORT_Title" Type="Text" X="25" Y="135" Width="210" Height="15" Transparent="yes" NoPrefix="yes" Text="Port to listen" />
|
||||||
|
<Control Id="PropertyEdit_LISTEN_PORT" Type="Edit" X="24" Y="147" Width="300" Height="18" Property="LISTEN_PORT" Text="[LISTEN_PORT]" Indirect="no" />
|
||||||
|
|
||||||
|
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
|
||||||
|
<Publish Event="NewDialog" Value="VerifyReadyDlg" />
|
||||||
|
</Control>
|
||||||
|
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)">
|
||||||
|
<Publish Event="NewDialog" Value="CustomizeDlg" />
|
||||||
|
</Control>
|
||||||
|
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
|
||||||
|
<Publish Event="SpawnDialog" Value="CancelDlg" />
|
||||||
|
</Control>
|
||||||
|
</Dialog>
|
||||||
|
|
||||||
|
<!-- skip the license agreement dialog; higher Order takes priority (weird) -->
|
||||||
|
|
||||||
|
<Publish
|
||||||
|
Condition="NOT Installed"
|
||||||
|
Dialog="WelcomeDlg"
|
||||||
|
Control="Next"
|
||||||
|
Event="NewDialog"
|
||||||
|
Value="CustomizeDlg"
|
||||||
|
Order="10"/>
|
||||||
|
<Publish
|
||||||
|
Condition="NOT Installed"
|
||||||
|
Dialog="CustomizeDlg"
|
||||||
|
Control="Back"
|
||||||
|
Event="NewDialog"
|
||||||
|
Value="WelcomeDlg"
|
||||||
|
Order="10"/>
|
||||||
|
<Publish
|
||||||
|
Dialog="CustomizeDlg"
|
||||||
|
Control="Next"
|
||||||
|
Event="NewDialog"
|
||||||
|
Value="CustomPropertiesDlg"
|
||||||
|
Order="10"/>
|
||||||
|
<Publish
|
||||||
|
Dialog="VerifyReadyDlg"
|
||||||
|
Control="Back"
|
||||||
|
Event="NewDialog"
|
||||||
|
Value="CustomPropertiesDlg"
|
||||||
|
Order="10"/>
|
||||||
|
|
||||||
|
|
||||||
|
<!--CustomPropertyDlg-->
|
||||||
|
</UI>
|
||||||
|
|
||||||
|
<!-- InstallLocation key -->
|
||||||
|
<CustomAction Id="SetInstallLocation" Property="ARPINSTALLLOCATION" Value="[APPLICATIONFOLDER]" />
|
||||||
|
|
||||||
|
<StandardDirectory Id="ProgramFiles64Folder">
|
||||||
|
<Directory Id="APPLICATIONFOLDER" Name="windows_exporter">
|
||||||
|
<Directory Id="textfile_inputs" Name="textfile_inputs" />
|
||||||
|
</Directory>
|
||||||
|
</StandardDirectory>
|
||||||
|
|
||||||
|
<ComponentGroup Id="CG_FirewallException">
|
||||||
|
<Component Directory="APPLICATIONFOLDER" Id="C_FirewallException" Guid="9f522655-ac0e-42d2-a512-a7b19ebec7f7">
|
||||||
|
<fw:FirewallException
|
||||||
|
Id="MetricsEndpoint"
|
||||||
|
Name="$(var.ProductName)"
|
||||||
|
Description="$(var.ProductName) HTTP endpoint"
|
||||||
|
Program="[#windows_exporter.exe]"
|
||||||
|
Port="[LISTEN_PORT]"
|
||||||
|
Protocol="tcp">
|
||||||
|
<fw:RemoteAddress Value="[REMOTE_ADDR]" />
|
||||||
|
</fw:FirewallException>
|
||||||
|
</Component>
|
||||||
|
</ComponentGroup>
|
||||||
|
</Package>
|
||||||
|
</Wix>
|
||||||
@@ -1,110 +0,0 @@
|
|||||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:fw="http://wixtoolset.org/schemas/v4/wxs/firewall" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
|
|
||||||
<?if $(sys.BUILDARCH)=x64 ?>
|
|
||||||
<?define PlatformProgramFiles = "ProgramFiles64Folder" ?>
|
|
||||||
<?else?>
|
|
||||||
<?define PlatformProgramFiles = "ProgramFilesFolder" ?>
|
|
||||||
<?endif?>
|
|
||||||
|
|
||||||
<Package UpgradeCode="66a6eb5b-1fc2-4b14-a362-5ceec6413308" Name="windows_exporter" Version="$(var.Version)" Manufacturer="prometheus-community" Language="1033" Codepage="1252">
|
|
||||||
<SummaryInformation Manufacturer="prometheus-community" Description="windows_exporter $(var.Version) installer" />
|
|
||||||
|
|
||||||
<Media Id="1" Cabinet="windows_exporter.cab" EmbedCab="yes" />
|
|
||||||
<MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." />
|
|
||||||
|
|
||||||
<Property Id="ENABLED_COLLECTORS" Secure="yes" />
|
|
||||||
<SetProperty Id="CollectorsFlag" After="InstallFiles" Sequence="execute" Value="--collectors.enabled [ENABLED_COLLECTORS]" Condition="ENABLED_COLLECTORS" />
|
|
||||||
|
|
||||||
<Property Id="EXTRA_FLAGS" Secure="yes" />
|
|
||||||
<SetProperty Id="ExtraFlags" After="InstallFiles" Sequence="execute" Value="[EXTRA_FLAGS]" Condition="EXTRA_FLAGS" />
|
|
||||||
|
|
||||||
<Property Id="ADD_FIREWALL_EXCEPTION" Secure="yes" />
|
|
||||||
|
|
||||||
<Property Id="ENABLE_V1_PERFORMANCE_COUNTERS" Secure="yes" />
|
|
||||||
|
|
||||||
<Property Id="LISTEN_PORT" Secure="yes" Value="9182" />
|
|
||||||
<SetProperty Id="ListenFlag" After="InstallFiles" Sequence="execute" Value="--web.listen-address [LISTEN_ADDR]:[LISTEN_PORT]" Condition="LISTEN_ADDR<>"" OR LISTEN_PORT<>9182" />
|
|
||||||
|
|
||||||
<Property Id="METRICS_PATH" Secure="yes" />
|
|
||||||
<SetProperty Id="MetricsPathFlag" After="InstallFiles" Sequence="execute" Value="--telemetry.path [METRICS_PATH]" Condition="METRICS_PATH" />
|
|
||||||
|
|
||||||
<Property Id="REMOTE_ADDR" Secure="yes" />
|
|
||||||
<SetProperty Id="RemoteAddressFlag" After="InstallFiles" Sequence="execute" Value="[REMOTE_ADDR]" Condition="REMOTE_ADDR" />
|
|
||||||
|
|
||||||
<!-- https://github.com/prometheus-community/windows_exporter/issues/1318 -->
|
|
||||||
<!-- https://wixtoolset.org/docs/tools/wixext/quietexec/ -->
|
|
||||||
<SetProperty
|
|
||||||
Id="WixQuietExecCmdLine"
|
|
||||||
Value=""[%ComSpec]" /c reg delete HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Application\windows_exporter /f"
|
|
||||||
Before="RemoveEventSource"
|
|
||||||
Sequence="execute"
|
|
||||||
/>
|
|
||||||
<CustomAction
|
|
||||||
Id="RemoveEventSource"
|
|
||||||
BinaryRef="Wix4UtilCA_$(sys.BUILDARCHSHORT)"
|
|
||||||
DllEntry="WixSilentExec"
|
|
||||||
Execute="deferred"
|
|
||||||
Impersonate="no"
|
|
||||||
Return="ignore"
|
|
||||||
/>
|
|
||||||
<InstallExecuteSequence>
|
|
||||||
<Custom Action="RemoveEventSource" After="InstallInitialize" />
|
|
||||||
</InstallExecuteSequence>
|
|
||||||
|
|
||||||
<SetProperty
|
|
||||||
Id="EnableV1PerformanceCounters"
|
|
||||||
Value=""[%ComSpec]" /c lodctr.exe /E:Lsa & lodctr.exe /E:PerfProc & lodctr.exe /R"
|
|
||||||
Before="EnableV1PerformanceCounters"
|
|
||||||
Sequence="execute"
|
|
||||||
/>
|
|
||||||
<CustomAction
|
|
||||||
Id="EnableV1PerformanceCounters"
|
|
||||||
BinaryRef="Wix4UtilCA_$(sys.BUILDARCHSHORT)"
|
|
||||||
DllEntry="WixSilentExec"
|
|
||||||
Execute="deferred"
|
|
||||||
Impersonate="no"
|
|
||||||
Return="check"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<InstallExecuteSequence>
|
|
||||||
<Custom Action="EnableV1PerformanceCounters" Before="InstallFinalize" Condition="ENABLE_V1_PERFORMANCE_COUNTERS="yes""/>
|
|
||||||
</InstallExecuteSequence>
|
|
||||||
|
|
||||||
<Property Id="TEXTFILE_DIRS" Secure="yes" />
|
|
||||||
<SetProperty Id="TextfileDirsFlag" After="InstallFiles" Sequence="execute" Value="--collector.textfile.directories [TEXTFILE_DIRS]" Condition="TEXTFILE_DIRS" />
|
|
||||||
|
|
||||||
<ComponentGroup Id="Files">
|
|
||||||
<Component Directory="APPLICATIONROOTDIRECTORY">
|
|
||||||
<File Id="windows_exporter.exe" Name="windows_exporter.exe" Source="Work\windows_exporter.exe" KeyPath="yes" />
|
|
||||||
<ServiceInstall Id="InstallExporterService" Name="windows_exporter" DisplayName="windows_exporter" Description="Exports Prometheus metrics about the system" ErrorControl="normal" Start="auto" Type="ownProcess" Arguments="--log.file eventlog [CollectorsFlag] [ListenFlag] [MetricsPathFlag] [TextfileDirsFlag] [ExtraFlags]">
|
|
||||||
<util:ServiceConfig FirstFailureActionType="restart" SecondFailureActionType="restart" ThirdFailureActionType="restart" RestartServiceDelayInSeconds="60" />
|
|
||||||
<ServiceDependency Id="wmiApSrv" />
|
|
||||||
</ServiceInstall>
|
|
||||||
<ServiceControl Id="ServiceStateControl" Name="windows_exporter" Remove="uninstall" Start="install" Stop="both" />
|
|
||||||
</Component>
|
|
||||||
<Component Id="CreateTextfileDirectory" Directory="textfile_inputs" Guid="d03ef58a-9cbf-4165-ad39-d143e9b27e14">
|
|
||||||
<CreateFolder />
|
|
||||||
</Component>
|
|
||||||
</ComponentGroup>
|
|
||||||
<ComponentGroup Id="CG_FirewallException">
|
|
||||||
<Component Condition="ADD_FIREWALL_EXCEPTION="yes"" Directory="APPLICATIONROOTDIRECTORY" Id="C_FirewallException" Guid="9f522655-ac0e-42d2-a512-a7b19ebec7f7">
|
|
||||||
<fw:FirewallException Id="MetricsEndpoint" Name="windows_exporter (HTTP [LISTEN_PORT])" Description="windows_exporter HTTP endpoint" Port="[LISTEN_PORT]" Protocol="tcp" IgnoreFailure="yes">
|
|
||||||
<fw:RemoteAddress Value="[REMOTE_ADDR]" />
|
|
||||||
</fw:FirewallException>
|
|
||||||
</Component>
|
|
||||||
</ComponentGroup>
|
|
||||||
|
|
||||||
<Feature Id="DefaultFeature" Level="1">
|
|
||||||
<ComponentGroupRef Id="Files" />
|
|
||||||
</Feature>
|
|
||||||
|
|
||||||
<Feature Id="FirewallException" Level="1">
|
|
||||||
<ComponentGroupRef Id="CG_FirewallException" />
|
|
||||||
</Feature>
|
|
||||||
|
|
||||||
<StandardDirectory Id="ProgramFiles64Folder">
|
|
||||||
<Directory Id="APPLICATIONROOTDIRECTORY" Name="windows_exporter">
|
|
||||||
<Directory Id="textfile_inputs" Name="textfile_inputs" />
|
|
||||||
</Directory>
|
|
||||||
</StandardDirectory>
|
|
||||||
</Package>
|
|
||||||
</Wix>
|
|
||||||
Reference in New Issue
Block a user