Windows_exporter: Document needed user permissions

Created on 9 Sep 2020  路  5Comments  路  Source: prometheus-community/windows_exporter

Due to my companies security policies we're supposed to start the windows_exporter service using a "service-account" with reduced permissions.
I cannot find documentation on which permissions a user would minimally need to run the exporter properly.

As an admin I'd like to know the proper permissions so we can set up a user correspondingly.

feature-request help wanted installer

Most helpful comment

For what it's worth, I am running the exporter as a Windows service account (e.g. NT Service\windows_exporter) that has been added to the local "Performance Monitor Users" group (found in Computer Management > Users and Groups > Groups).

I use a different name for the service (PrometheusWMIExporter), so it's a little different, but here's the PowerShell script I use to set this up.

$serviceName = "PrometheusWMIExporter"
$exeLocation = "E:\windows_exporter\windows_exporter.exe"
$collectorsEnabled = @(
  "system",
  "cpu",
  "memory",
  "os",
  "cs",
  "logical_disk",
  "mssql",
  "process"
)

# Create the service
New-Service -Name $serviceName `
  -Description "Prometheus Exporter for WMI" `
  -BinaryPathName """$exeLocation"" --log.format logger:eventlog?name=windows_exporter  --telemetry.addr :9182 --collectors.enabled $($collectorsEnabled - Join ',')"

# Run as service account
C:\Windows\System32\sc.exe config $serviceName obj= "NT Service\$serviceName"

# Add service account to Performance Monitor group
Add-LocalGroupMember -Group (get-localgroup -name "Performance Monitor Users") -Member "NT Service\$serviceName"

Start-Service $serviceName

So far, it works like a charm. :)

All 5 comments

Hi @Knuspel,
To the best of our knowledge, there isn't a permission set exposed by Windows which allows querying the APIs we use (primarily WMI and perflib).
Perhaps your security team has some deeper knowledge about how to accomplish this, and if so we'd be very happy to have it added to the documentation!

For what it's worth, I am running the exporter as a Windows service account (e.g. NT Service\windows_exporter) that has been added to the local "Performance Monitor Users" group (found in Computer Management > Users and Groups > Groups).

I use a different name for the service (PrometheusWMIExporter), so it's a little different, but here's the PowerShell script I use to set this up.

$serviceName = "PrometheusWMIExporter"
$exeLocation = "E:\windows_exporter\windows_exporter.exe"
$collectorsEnabled = @(
  "system",
  "cpu",
  "memory",
  "os",
  "cs",
  "logical_disk",
  "mssql",
  "process"
)

# Create the service
New-Service -Name $serviceName `
  -Description "Prometheus Exporter for WMI" `
  -BinaryPathName """$exeLocation"" --log.format logger:eventlog?name=windows_exporter  --telemetry.addr :9182 --collectors.enabled $($collectorsEnabled - Join ',')"

# Run as service account
C:\Windows\System32\sc.exe config $serviceName obj= "NT Service\$serviceName"

# Add service account to Performance Monitor group
Add-LocalGroupMember -Group (get-localgroup -name "Performance Monitor Users") -Member "NT Service\$serviceName"

Start-Service $serviceName

So far, it works like a charm. :)

That sounds like something we should try. I鈥檒l see if it works for our setup.

Is there any difference if we are running windows exporter as admin vs service account as mentioned above. And if there are no differences how can we conclude on that?

So after testing with the other rights it appears to work with the user rights.

Our security likes to have non system users running services so the rights are as restricted as possible.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wizardmatas picture wizardmatas  路  5Comments

LuisLoranca picture LuisLoranca  路  5Comments

finkr picture finkr  路  3Comments

amitsaha picture amitsaha  路  5Comments

captainhistory picture captainhistory  路  8Comments