Skip to content

Commit

Permalink
fix: Set default values for MSI web.listen-address
Browse files Browse the repository at this point in the history
This prevents the exporter HTTP port from being omitted from the
firewall rule DisplayName.

I've tested this in the following four scenarios, and web.listen-address
is set correctly for each:

* Nothing set: 0.0.0.0:9182
* LISTEN_PORT=9184: 0.0.0.0:9184
* LISTEN_ADDR=127.0.0.1: 127.0.0.1:9182
* LISTEN_PORT=9184 LISTEN_ADDR=127.0.0.1: 127.0.0.1:9184

Signed-off-by: Ben Reedy <breed808@breed808.com>
  • Loading branch information
breed808 committed Dec 4, 2023
1 parent d4b48e5 commit 7feafc1
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions installer/windows_exporter.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@
<Property Id="EXTRA_FLAGS" Secure="yes" />
<SetProperty Id="ExtraFlags" After="InstallFiles" Sequence="execute" Value="[EXTRA_FLAGS]" Condition="EXTRA_FLAGS" />

<Property Id="LISTEN_ADDR" Secure="yes" />
<Property Id="LISTEN_PORT" Secure="yes" />
<SetProperty Id="ListenFlagBoth" After="InstallFiles" Sequence="execute" Value="--web.listen-address [LISTEN_ADDR]:[LISTEN_PORT]" Condition="LISTEN_ADDR AND LISTEN_PORT" />
<SetProperty Id="ListenFlagAddr" After="InstallFiles" Sequence="execute" Value="--web.listen-address [LISTEN_ADDR]:9182" Condition="LISTEN_ADDR AND (NOT LISTEN_PORT)" />
<SetProperty Id="ListenFlagPort" After="InstallFiles" Sequence="execute" Value="--web.listen-address 0.0.0.0:[LISTEN_PORT]" Condition="LISTEN_PORT AND (NOT LISTEN_ADDR)" />
<Property Id="LISTEN_ADDR" Secure="yes" Value="0.0.0.0" />
<Property Id="LISTEN_PORT" Secure="yes" Value="9182" />

<Property Id="METRICS_PATH" Secure="yes" />
<SetProperty Id="MetricsPathFlag" After="InstallFiles" Sequence="execute" Value="--telemetry.path [METRICS_PATH]" Condition="METRICS_PATH" />
Expand All @@ -39,7 +36,7 @@
<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] [ListenFlagBoth] [ListenFlagAddr] [ListenFlagPort] [MetricsPathFlag] [TextfileDirFlag] [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] [TextfileDirFlag] [ExtraFlags]">
<util:ServiceConfig FirstFailureActionType="restart" SecondFailureActionType="restart" ThirdFailureActionType="restart" RestartServiceDelayInSeconds="60" />
<ServiceDependency Id="wmiApSrv" />
</ServiceInstall>
Expand Down

0 comments on commit 7feafc1

Please sign in to comment.