mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-08 05:56:37 +00:00
installer: Disable Windows Firewall Exception by default. Can be re-enabled with ADD_FIREWALL_EXCEPTION=yes
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
6
.editorconfig
Normal file
6
.editorconfig
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*.wxs]
|
||||||
|
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -6,3 +6,5 @@ output/
|
|||||||
.vscode
|
.vscode
|
||||||
.idea
|
.idea
|
||||||
*.syso
|
*.syso
|
||||||
|
installer/*.msi
|
||||||
|
installer/*.wixpdb
|
||||||
11
README.md
11
README.md
@@ -121,11 +121,19 @@ Example service collector with a custom query.
|
|||||||
msiexec /i <path-to-msi-file> ENABLED_COLLECTORS=os,service --% EXTRA_FLAGS="--collector.service.services-where ""Name LIKE 'sql%'"""
|
msiexec /i <path-to-msi-file> ENABLED_COLLECTORS=os,service --% EXTRA_FLAGS="--collector.service.services-where ""Name LIKE 'sql%'"""
|
||||||
```
|
```
|
||||||
|
|
||||||
On some older versions of Windows you may need to surround parameter values with double quotes to get the install command parsing properly:
|
On some older versions of Windows,
|
||||||
|
you may need to surround parameter values with double quotes to get the installation command parsing properly:
|
||||||
```powershell
|
```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 <path-to-msi-file> ADD_FIREWALL_EXCEPTION=yes
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
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
|
```powershell
|
||||||
@@ -133,7 +141,6 @@ $PSNativeCommandArgumentPassing = 'Legacy'
|
|||||||
msiexec /i <path-to-msi-file> ENABLED_COLLECTORS=os,service --% EXTRA_FLAGS="--collector.service.services-where ""Name LIKE 'sql%'"""
|
msiexec /i <path-to-msi-file> ENABLED_COLLECTORS=os,service --% EXTRA_FLAGS="--collector.service.services-where ""Name LIKE 'sql%'"""
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Kubernetes Implementation
|
## Kubernetes Implementation
|
||||||
|
|
||||||
See detailed steps to install on Windows Kubernetes [here](./kubernetes/kubernetes.md).
|
See detailed steps to install on Windows Kubernetes [here](./kubernetes/kubernetes.md).
|
||||||
|
|||||||
@@ -24,7 +24,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]
|
||||||
$wixOpts = "-ext WixFirewallExtension -ext WixUtilExtension"
|
|
||||||
Invoke-Expression "wix build -arch $wixArch -o .\windows_exporter-$($Version)-$($Arch).msi .\windows_exporter.wxs -d Version=$($Version) -ext WixToolset.Firewall.wixext -ext WixToolset.Util.wixext"
|
Invoke-Expression "wix build -arch $wixArch -o .\windows_exporter-$($Version)-$($Arch).msi .\windows_exporter.wxs -d Version=$($Version) -ext WixToolset.Firewall.wixext -ext WixToolset.Util.wixext"
|
||||||
|
|
||||||
Write-Verbose "Done!"
|
Write-Verbose "Done!"
|
||||||
|
|||||||
@@ -15,6 +15,9 @@
|
|||||||
<Property Id="EXTRA_FLAGS" Secure="yes" />
|
<Property Id="EXTRA_FLAGS" Secure="yes" />
|
||||||
<SetProperty Id="ExtraFlags" After="InstallFiles" Sequence="execute" Value="[EXTRA_FLAGS]" Condition="EXTRA_FLAGS" />
|
<SetProperty Id="ExtraFlags" After="InstallFiles" Sequence="execute" Value="[EXTRA_FLAGS]" Condition="EXTRA_FLAGS" />
|
||||||
|
|
||||||
|
<Property Id="ADD_FIREWALL_EXCEPTION" Secure="yes" />
|
||||||
|
<SetProperty Id="FirewallException" After="InstallFiles" Sequence="execute" Value="[ADD_FIREWALL_EXCEPTION]" Condition="ADD_FIREWALL_EXCEPTION" />
|
||||||
|
|
||||||
<Property Id="LISTEN_ADDR" Secure="yes" Value="0.0.0.0" />
|
<Property Id="LISTEN_ADDR" Secure="yes" Value="0.0.0.0" />
|
||||||
<Property Id="LISTEN_PORT" Secure="yes" Value="9182" />
|
<Property Id="LISTEN_PORT" Secure="yes" Value="9182" />
|
||||||
|
|
||||||
@@ -49,11 +52,7 @@
|
|||||||
|
|
||||||
<ComponentGroup Id="Files">
|
<ComponentGroup Id="Files">
|
||||||
<Component Directory="APPLICATIONROOTDIRECTORY">
|
<Component Directory="APPLICATIONROOTDIRECTORY">
|
||||||
<File Id="windows_exporter.exe" Name="windows_exporter.exe" Source="Work\windows_exporter.exe" KeyPath="yes">
|
<File Id="windows_exporter.exe" Name="windows_exporter.exe" Source="Work\windows_exporter.exe" KeyPath="yes" />
|
||||||
<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>
|
|
||||||
</File>
|
|
||||||
<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] --web.listen-address [LISTEN_ADDR]:[LISTEN_PORT] [MetricsPathFlag] [TextfileDirsFlag] [ExtraFlags]">
|
<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] --web.listen-address [LISTEN_ADDR]:[LISTEN_PORT] [MetricsPathFlag] [TextfileDirsFlag] [ExtraFlags]">
|
||||||
<util:ServiceConfig FirstFailureActionType="restart" SecondFailureActionType="restart" ThirdFailureActionType="restart" RestartServiceDelayInSeconds="60" />
|
<util:ServiceConfig FirstFailureActionType="restart" SecondFailureActionType="restart" ThirdFailureActionType="restart" RestartServiceDelayInSeconds="60" />
|
||||||
<ServiceDependency Id="wmiApSrv" />
|
<ServiceDependency Id="wmiApSrv" />
|
||||||
@@ -64,15 +63,26 @@
|
|||||||
<CreateFolder />
|
<CreateFolder />
|
||||||
</Component>
|
</Component>
|
||||||
</ComponentGroup>
|
</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">
|
<Feature Id="DefaultFeature" Level="1">
|
||||||
<ComponentGroupRef Id="Files" />
|
<ComponentGroupRef Id="Files" />
|
||||||
</Feature>
|
</Feature>
|
||||||
|
|
||||||
<Directory Id="$(var.PlatformProgramFiles)">
|
<Feature Id="FirewallException" Level="1">
|
||||||
|
<ComponentGroupRef Id="CG_FirewallException" />
|
||||||
|
</Feature>
|
||||||
|
|
||||||
|
<StandardDirectory Id="ProgramFiles64Folder">
|
||||||
<Directory Id="APPLICATIONROOTDIRECTORY" Name="windows_exporter">
|
<Directory Id="APPLICATIONROOTDIRECTORY" Name="windows_exporter">
|
||||||
<Directory Id="textfile_inputs" Name="textfile_inputs" />
|
<Directory Id="textfile_inputs" Name="textfile_inputs" />
|
||||||
</Directory>
|
</Directory>
|
||||||
</Directory>
|
</StandardDirectory>
|
||||||
</Package>
|
</Package>
|
||||||
</Wix>
|
</Wix>
|
||||||
|
|||||||
Reference in New Issue
Block a user