Windows_exporter: How to Enable New Collectors

Created on 24 Sep 2019  路  8Comments  路  Source: prometheus-community/windows_exporter

I have installed wmi exporter and can't seem to enable new collectors. There's very little documentation and I can't seem to get a good answer scrolling through here or searching online. In the exporter.go file I updated defaultCollectors to pull logon and memory metrics.

const (
defaultCollectors = "cpu,cs,logical_disk,net,os,service,system,textfile,logon,memory"
defaultCollectorsPlaceholder = "[defaults]"
serviceName = "wmi_exporter"

When I run the .exe those metrics are not shown under my enabled collectors. What are the actual steps to enable these non-default collectors?

Most helpful comment

Yes, you can run the commands in Powershell or CMD. You'll need to navigate to the directory containing the exe file before running them or run the command with the full path to the executable. E.G. C:\Users\captainhistory\Downloads\wmi_exporter-0.8.3-amd64.exe --collectors.enabled=cpu,memory,net,os

You don't need all the project files on your PC, only the executable. Whether run manually or as a service, the executable will run with the default configuration as specified in exporter.go. These settings can be changed with run-time flags, such as --collectors.enabled and --telemetry.addr.

All 8 comments

If you're running the exe you can use the --collectors.enabled flag. From the project README:

.\wmi_exporter.exe --collectors.enabled "service" --collector.service.services-where "Name='wmi_exporter'"

How do I do that? Through something like powershell or the cmd line? I see in the documentation some stuff regarding the misexec, but I can't utilize that as my company won't allow the use of the msi file due to firewall security.

Also, I do have all the files from the distro on my PC, and I can set it up to run as a service instead of from the .exe. If I run it as a service, will it pull the configuration settings from the exporter.go file?

Yes, you can run the commands in Powershell or CMD. You'll need to navigate to the directory containing the exe file before running them or run the command with the full path to the executable. E.G. C:\Users\captainhistory\Downloads\wmi_exporter-0.8.3-amd64.exe --collectors.enabled=cpu,memory,net,os

You don't need all the project files on your PC, only the executable. Whether run manually or as a service, the executable will run with the default configuration as specified in exporter.go. These settings can be changed with run-time flags, such as --collectors.enabled and --telemetry.addr.

@captainhistory please see https://github.com/martinlindhe/wmi_exporter#installation

using ENABLED_COLLECTORS you can customize what collectors to enable during installation.

How to specify enabled collectors is documented under https://github.com/martinlindhe/wmi_exporter#examples

Additionally, as go is a compiled language, you will need to compile the code in order to make use of your changes.

Documentation could surely be improved, but what specifically did you find lacking?

You can install via powershell using msiexec
E.G. msiexec /i C:\path\to\msi\wmi_exporter-x.x.x-amd64.msi ENABLED_COLLECTORS="service1, service2" LISTEN_PORT="9182"

I have installed wmi exporter using the command:
msiexec /i wmi_exporter-0.9.0-amd64.msi ENABLED_COLLECTORS="ad,cpu,cs,dns,iis,logical_disk,logon,memory,net,os,service,system,tcp,textfile"
and the wmi_exporter is run as windows service,

The service start command is below
"C:\Program Files\wmi_exporter\wmi_exporter.exe" --log.format logger:eventlog?name=wmi_exporter --collectors.enabled ad,cpu,cs,dns,iis,logical_disk,logon,memory,net,os,service,system,tcp,textfile --telemetry.addr :9182

Now I want to change the start command to

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

Any good suggestions? How to do it ?

I have using msiexec /i wmi_exporter-0.9.0-amd64.msi ENABLED_COLLECTORS="cpu,cs,logical_disk,logon,memory,net,os,service,system,tcp,textfile" ,but It can not work

I understand this as your problem being solved in #440? I'll close this, then.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jdx-john picture jdx-john  路  4Comments

amitsaha picture amitsaha  路  5Comments

Gerthum picture Gerthum  路  9Comments

suptimal picture suptimal  路  10Comments

fischerman picture fischerman  路  4Comments