Windows_exporter: Update config via installer

Created on 28 Sep 2020  路  4Comments  路  Source: prometheus-community/windows_exporter

I'm trying to change the collectors for an existing installation.

 msiexec /i windows_exporter-0.14.0-amd64.msi
 msiexec /i windows_exporter-0.14.0-amd64.msi ENABLED_COLLECTORS=os,service

The changes are not picked up. The service continues to run with the default collectors. It only works during a version change.

 msiexec /i windows_exporter-0.13.0-amd64.msi
 msiexec /i windows_exporter-0.14.0-amd64.msi ENABLED_COLLECTORS=os,service

... works fine. I'm suspecting that the installer just compares versions and exits. I've also tried the repair options /f and /fa without any luck. The only work around is a proper uninstall.

FYI We are using SCCM to deploy the installer on ~200 machines.

Most helpful comment

msiexec /i windows_exporter-0.14.0-amd64.msi ENABLED_COLLECTORS=os,service REINSTALL=ALL should work.

You can additionally use REINSTALLMODE to specify the type of reinstall to perform, see https://docs.microsoft.com/en-us/windows/win32/msi/reinstallmode

All 4 comments

msiexec /i windows_exporter-0.14.0-amd64.msi ENABLED_COLLECTORS=os,service REINSTALL=ALL should work.

You can additionally use REINSTALLMODE to specify the type of reinstall to perform, see https://docs.microsoft.com/en-us/windows/win32/msi/reinstallmode

Yes, that works. The repair option /f does ignore any arguments while REINSTALL does not.

However, the problem with REINSTALL is that it only reinstalls features which are already present. On a clean install it will not install anything. So I'm still missing the "install or change" approach. I've also tried in in combination with ADDLOCAL.

Out of curiosity, how are people updating collectors on the fly?

If i've already deployed 0.15.0, what's the process others are using to change the enabled collectors for the same version that was previously installed.

At the moment i'm adding a line to the install script to uninstall then reinstall with the new desired collectors, i'm unsure if there is a better way.

It is possible to change the register.
(get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\windows_exporter\").ImagePath
In ma case

"C:\Program Files\windows_exporter\windows_exporter.exe" --log.format logger:eventlog?name=windows_exporter --collectors.enabled os,net,system,service,logical_disk,cpu,cs,textfile,iis,tcp,netframework_clrexceptions --telemetry.addr :9182

Overwrite value withe new value
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\windows_exporter\" -Name ImagePath -Value '"C:\Program Files\windows_exporter\windows_exporter.exe" --log.format logger:eventlog?name=windows_exporter --collectors.enabled os,net,system,service,logical_disk,cpu,cs,textfile,iis,tcp,netframework_clrexceptions --telemetry.addr :9182'

restart-service -name windows_exporter

Was this page helpful?
0 / 5 - 0 ratings

Related issues

benridley picture benridley  路  5Comments

suptimal picture suptimal  路  10Comments

majerus1223 picture majerus1223  路  7Comments

Knuspel picture Knuspel  路  5Comments

LuisLoranca picture LuisLoranca  路  5Comments