mirror of
https://github.com/prometheus-community/windows_exporter
synced 2024-12-18 04:24:35 +00:00
89 lines
5.1 KiB
XML
89 lines
5.1 KiB
XML
<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" />
|
|
<SetProperty Id="FirewallException" After="InstallFiles" Sequence="execute" Value="[ADD_FIREWALL_EXCEPTION]" Condition="ADD_FIREWALL_EXCEPTION" />
|
|
|
|
<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>
|
|
|
|
<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>
|