windows_exporter: Unable to start windows_exporter with a configuration file in the default location
Unable to start windows_exporter with a configuration file in the default location
Steps to reproduce:
OS: Win 10 Pro 10.0.19041 User with a Administrator privileges
First scenario: Default config
1)Create folder C:\Program Files\windows_exporter with the following files:
windows_exporter-0.15.0-amd64.msi config.yml
config.yml file content:
collectors:
enabled: service
collector:
service:
services-where: "Name='<any_existing_service>'"
log:
level: warn
2)Execute the following command in PowerShell (under Administrator)
msiexec /i C:\Program Files\windows_exporter\windows_exporter-0.15.0-amd64.msi
Expected result:
The windows_exporter is up and running with parameters from the C:\Program Files\windows_exporter\config.yml file
Actual result:
The windows installer popup like this
Second scenario: Explicitly add a path to the config file in the C:\Program Files\windows_exporter directory
1)Create folder C:\Program Files\windows_exporter with the following files:
windows_exporter-0.15.0-amd64.msi config.yml
config.yml file content:
collectors:
enabled: service
collector:
service:
services-where: "Name='<any_existing_service>'"
log:
level: warn
2)Execute the following command in PowerShell (under Administrator)
msiexec /i C:\Program Files\windows_exporter\windows_exporter-0.15.0-amd64.msi --% EXTRA_FLAGS=“–config.file=C:\Program Files\windows_exporter\config.yml”
Expected result:
The windows_exporter is up and running with parameters from the C:\Program Files\windows_exporter\config.yml file
Actual result:
The windows installer popup like this
Third scenario: Explicitly add a path to the config file in the C:\Program Files\windows_exporter directory and locate windows_exporter-0.15.0-amd64.msi installation file in C:\windows_exporter folder
1)Create folder C:\windows_exporter with the following file:
windows_exporter-0.15.0-amd64.msi
Create folder C:\Program Files\windows_exporter with the following file:
config.yml
config.yml file content:
collectors:
enabled: service
collector:
service:
services-where: "Name='<any_existing_service>'"
log:
level: warn
2)Execute the following command in PowerShell (under Administrator)
msiexec /i C:\windows_exporter\windows_exporter-0.15.0-amd64.msi --% EXTRA_FLAGS=“–config.file=C:\Program Files\windows_exporter\config.yml”
Expected result:
The windows_exporter is up and running with parameters from the C:\Program Files\windows_exporter\config.yml file
Actual result:
Error popup:
Fourth scenario: Explicitly add a path to the config file in the C:\windows_exporter directory
1)Create folder C:\windows_exporter with the following files:
windows_exporter-0.15.0-amd64.msi config.yml file content:
collectors:
enabled: service
collector:
service:
services-where: "Name='<any_existing_service>'"
log:
level: warn
3)Execute the following command in PowerShell (under Administrator)
msiexec /i C:\windows_exporter\windows_exporter-0.15.0-amd64.msi --% EXTRA_FLAGS=“–config.file=C:\windows_exporter\config.yml”
Expected result:
windows_exporter is up and running with parameters from the C:\windows_exporter\config.yml file
Actual result: The windows_exporter is up and running
Question: How to start windows_exporter with a configuration file in the default location?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 24 (2 by maintainers)
why do we need to run an MSI with a bunch of custom args? Why doesnt the installer deliver a config.yml to the installed directory and set the service to use that file?
-or- have windows_exporter.exe look in its own directory for a conventionally named config.yml file?
This works for me when run from cmd.exe:
I would expect the directory where the executable is located or the LOCAL_APPDATA directory (Environment.SpecialFolder.LocalApplicationData) . AFAIK for services it’s something like C:\WINDOWS\system32\config\systemprofile\AppData\Local + AppName. The path differs from OS.
My personal recommendation is to remove the “–config-file” from EXTRA_FLAGS and use a common default path. If the config file exits, is readable, etc. it is used by the services. If not use the default / command line arguments. A message in the event look is helpful to be transparent. From which path the config file is used or not because it was not found.
Hi,
I have the same need to use a config file and the same issue with the msi installer:
msiexec /i C:\Users\Administrator\Downloads\windows_exporter-0.15.0-amd64.msi /log msiexec.log EXTRA_FLAGS="--config.file=config.yml"
This ends up in the message mentioned above “Can’t start the service”… The logfile: msiexec.logThe lines with the error:
Error 1920. Service 'windows_exporter' (windows_exporter) failed to start. Verify that you have sufficient privileges to start system services. MSI (s) (C0:2C) [19:30:32:327]: Product: windows_exporter -- Error 1920. Service 'windows_exporter' (windows_exporter) failed to start. Verify that you have sufficient privileges to start system services.
btw.Property(C): EXTRA_FLAGS = --config.file=config.yml
looks good, right?Asking Dr. Google for 1920 is not really helpful but one hint I found: Ask the application event log and there I found the following:
could not load config file: CreateFile config.yml: Das System kann die angegebene Datei nicht finden.
uhhh. ok, now I copied the config.yml to C:\Temp etc… but no, it’s C:\Windows\System32 where the config.yml (in my case) must exists. (Path where the “system services” starts.)
I think it’s a kind of race condition that the config.yml must exist while the installer is running and if not the installer can’t proceed.
Hope that helps, Kai