Menu
General availability (GA) Open source

prometheus.exporter.windows

The prometheus.exporter.windows component embeds the windows_exporter which exposes a wide variety of hardware and OS metrics for Windows-based systems.

The windows_exporter itself comprises various collectors, which you can enable and disable as needed. For more information on collectors, refer to the collectors-list section.

Note

The blacklist and whitelist configuration arguments are available for backwards compatibility but are deprecated. The include and exclude arguments are preferred going forward.

Usage

alloy
prometheus.exporter.windows "<LABEL>" {
}

Arguments

You can use the following arguments with prometheus.exporter.windows:

NameTypeDescriptionDefaultRequired
enabled_collectorslist(string)List of collectors to enable.["cpu","cs","logical_disk","net","os","service","system"]no

enabled_collectors defines a hand-picked list of enabled-by-default collectors. If set, anything not provided in that list is disabled by default. Refer to the Collectors list for the default set.

Blocks

You can use the following blocks with prometheus.exporter.windows:

NameDescriptionRequired
dfsrConfigures the dfsr collector.no
dnsConfigures the dns collector.no
exchangeConfigures the exchange collector.no
filetimeConfigures the filetime collector.no
iisConfigures the iis collector.no
logical_diskConfigures the logical_disk collector.no
msclusterConfigures the mscluster collector.no
mssqlConfigures the mssql collector.no
netframeworkConfigures the netframework collector.no
networkConfigures the network collector.no
performancecounterConfigures the performancecounter collector.no
physical_diskConfigures the physical_disk collector.no
printerConfigures the printer collector.no
processConfigures the process collector.no
scheduled_taskConfigures the scheduled_task collector.no
serviceConfigures the service collector.no
smb_clientConfigures the smb_client collector.no
smbConfigures the smb collector.no
smtpConfigures the smtp collector.no
tcpConfigures the tcp collector.no
text_fileConfigures the text_file collector.no

dfsr

NameTypeDescriptionDefaultRequired
source_enabledlist(string)A list of DFSR Perflib sources to use.["connection","folder","volume"]no

dns

NameTypeDescriptionDefaultRequired
enabled_listlist(string)A list of collectors to use.["metrics", "wmi_stats"]no

exchange

NameTypeDescriptionDefaultRequired
enabled_listlist(string)A list of collectors to use.["ADAccessProcesses", "TransportQueues", "HttpProxy", "ActiveSync", "AvailabilityService", "OutlookWebAccess", "Autodiscover", "WorkloadManagement", "RpcClientAccess", "MapiHttpEmsmdb"]no

filetime

NameTypeDescriptionDefaultRequired
file_patternslist(string)A list of glob patterns matching files to be monitored.[]no

iis

NameTypeDescriptionDefaultRequired
app_excludestringRegular expression of applications to ignore."^$"no
app_includestringRegular expression of applications to report on."^.+$"no
site_excludestringRegular expression of sites to ignore."^$"no
site_includestringRegular expression of sites to report on."^.+$"no

User-supplied app_exclude, app_include, site_exclude and site_include strings are wrapped in a regular expression.

logical_disk

NameTypeDescriptionDefaultRequired
excludestringRegular expression of volumes to exclude."^$"no
includestringRegular expression of volumes to include."^.+$"no

Volume names must match the regular expression specified by include and must not match the regular expression specified by exclude to be included.

User-supplied exclude and include strings are wrapped in a regular expression.

mscluster

NameTypeDescriptionDefaultRequired
enabled_listlist(string)A list of collectors to use.["cluster","network","node","resource","resourcegroup"]no

The collectors specified by enabled_list can include the following:

  • cluster
  • network
  • node
  • resource
  • resouregroup

For example, you can set enabled_list to ["cluster"].

mssql

NameTypeDescriptionDefaultRequired
enabled_classeslist(string)A list of MSSQL WMI classes to use.["accessmethods", "availreplica", "bufman", "databases", "dbreplica", "genstats", "info", "locks", "memmgr", "sqlerrors", "sqlstats", "transactions", "waitstats"]no

network

NameTypeDescriptionDefaultRequired
excludestringRegular expression of NICs to exclude."^$"no
includestringRegular expression of NICs to include."^.+$"no

NIC names must match the regular expression specified by include and must not match the regular expression specified by exclude to be included.

User-supplied exclude and include strings are wrapped in a regular expression.

netframework

NameTypeDescriptionDefaultRequired
enabled_listlist(string)A list of collectors to use.["clrexceptions","clrinterop","clrjit","clrloading","clrlocksandthreads","clrmemory","clrremoting","clrsecurity"]no

The collectors specified by enabled_list can include the following:

  • clrexceptions
  • clrinterop
  • clrjit
  • clrloading
  • clrlocksandthreads
  • clrmemory
  • clrremoting
  • clrsecurity

For example, you can set enabled_list to ["clrjit"].

performancecounter

NameTypeDescriptionDefaultRequired
objectsstringYAML string representing the counters to monitor.""no

The objects field should contain a YAML file as a string that satisfies the schema shown in the exporter’s documentation for the performancecounter collector. While there are ways to construct this directly in Alloy syntax using raw Alloy syntax strings for example, the best way to configure this collector will be using a local.file component.

alloy
local.file "counters" {
  filename = "/etc/alloy/performance_counters.yaml"
}

prometheus.exporter.windows "default" {
  ...

  performancecounter {
    objects = local.file.counters.content
  }
  
  ...
}

physical_disk

NameTypeDescriptionDefaultRequired
excludestringRegular expression of physical disk to exclude."^$"no
includestringRegular expression of physical disk to include."^.+$"no

User-supplied exclude and include strings are wrapped in a regular expression.

printer

NameTypeDescriptionDefaultRequired
excludestringRegular expression of printer to exclude."^$"no
includestringRegular expression of printer to include."^.+$"no

Printer must match the regular expression specified by include and must not match the regular expression specified by exclude to be included.

User-supplied exclude and include strings are wrapped in a regular expression.

process

NameTypeDescriptionDefaultRequired
excludestringRegular expression of processes to exclude."^$"no
includestringRegular expression of processes to include."^.+$"no
enable_iis_worker_processstringEnable IIS collectWorker process name queriesfalseno

Processes must match the regular expression specified by include and must not match the regular expression specified by exclude to be included.

User-supplied exclude and include strings are wrapped in a regular expression.

There is a warning in the upstream collector that use of enable_iis_worker_process may leak memory. Use with caution.

scheduled_task

NameTypeDescriptionDefaultRequired
excludestringRegular expression of tasks to exclude."^$"no
includestringRegular expression of tasks to include."^.+$"no

For a task to be included, it must match the regular expression specified by include and must not match the regular expression specified by exclude.

User-supplied exclude and include strings are wrapped in a regular expression.

service

NameTypeDescriptionDefaultRequired
excludestringRegular expression of services to exclude."^$"no
includestringRegular expression of services to include."^.+$"no

For a service to be included, it must match the regular expression specified by include and must not match the regular expression specified by exclude.

User-supplied exclude and include strings are wrapped in a regular expression.

smb

NameTypeDescriptionDefaultRequired
enabled_listlist(string)Deprecated (no-op), a list of collectors to use.[]no

The collectors specified by enabled_list can include the following:

  • ServerShares

For example, enabled_list may be set to ["ServerShares"].

smb_client

NameTypeDescriptionDefaultRequired
enabled_listlist(string)Deprecated (no-op), a list of collectors to use.[]no

The collectors specified by enabled_list can include the following:

  • ClientShares

For example, enabled_list may be set to ["ClientShares"].

smtp

NameTypeDescriptionDefaultRequired
excludestringRegular expression of virtual servers to ignore."^$"no
includestringRegular expression of virtual servers to include."^.+$"no

For a server name to be included, it must match the regular expression specified by include and must not match the regular expression specified by exclude.

User-supplied exclude and include strings are wrapped in a regular expression.

tcp

NameTypeDescriptionDefaultRequired
enabled_listlist(string)A list of collectors to use.["metrics","connections_state"]no

The collectors specified by enabled_list can include the following:

  • connections_state
  • metrics

For example, you can set enabled_list to ["metrics"].

text_file

NameTypeDescriptionDefaultRequired
text_file_directorystringThe directory containing the files to be ingested.see belowno

The default value for text_file_directory is relative to the location of the Alloy executable. By default, text_file_directory is set to the textfile_inputs directory in the installation directory of Alloy. For example, if Alloy is installed in C:\Program Files\GrafanaLabs\Alloy\, the default is C:\Program Files\GrafanaLabs\Alloy\textfile_inputs.

When text_file_directory is set, only files with the extension .prom inside the specified directory are read.

Note

The .prom files must end with an empty line feed for the component to recognize and read them.

Exported fields

The following fields are exported and can be referenced by other components.

NameTypeDescription
targetslist(map(string))The targets that can be used to collect exporter metrics.

For example, the targets can either be passed to a discovery.relabel component to rewrite the targets’ label sets or to a prometheus.scrape component that collects the exposed metrics.

The exported targets use the configured in-memory traffic address specified by the run command.

Component health

prometheus.exporter.windows is only reported as unhealthy if given an invalid configuration. In those cases, exported fields retain their last healthy values.

Debug information

prometheus.exporter.windows doesn’t expose any component-specific debug information.

Debug metrics

prometheus.exporter.windows doesn’t expose any component-specific debug metrics.

Wrap regular expression strings

Some collector blocks such as scheduled_task accept a regular expression as a string argument. prometheus.exporter.windows prefixes some regular expression string arguments with ^(?: and suffixes them with )$. For example, if a user sets an exclude argument to ".*", Alloy sets it to "^(?:.*)$".

To find out if a particular regular expression argument will be wrapped, refer to the collector block documentation.

Note

The wrapping may change the behaviour of your regular expression. For example, the e.* regular expression would normally match both the “service” and “email” strings. However, ^(?:e.*)$ would only match “email”.

Collectors list

The following table lists the available collectors in windows_exporter. Some collectors only work on specific operating systems, enabling a collector that’s not supported by the host OS where Alloy is running is a no-op.

Users can choose to enable a subset of collectors to limit the amount of metrics exposed by the prometheus.exporter.windows component, or disable collectors that are expensive to run.

NameDescriptionEnabled by default
adActive Directory Domain Services
adcsActive Directory Certificate Services
adfsActive Directory Federation Services
cacheCache metrics
cpuCPU usageYes
cpu_infoCPU Information
cs“Computer System” metrics (system properties, num cpus/total memory)Yes
containerContainer metrics
dfsrDFSR metrics
dhcpDHCP Server
dnsDNS Server
exchangeExchange metrics
filetimeFile modification time metrics
fsrmquotaMicrosoft File Server Resource Manager (FSRM) Quotas collector
hypervHyper-V hosts
iisIIS sites and applications
logical_diskLogical disks, disk I/OYes
logonUser logon sessions
memoryMemory usage metrics
msclusterMSCluster metrics
msmqMSMQ queues
mssqlSQL Server Performance Objects metrics
netframework.NET Framework metrics
netNetwork interface I/OYes
osOS metrics (memory, processes, users)Yes
pagefilePagefile metrics
performancecounterPerformance Counter metrics
physical_diskPhysical disksYes
printerPrinter metrics
processPer-process metrics
remote_fxRemoteFX protocol (RDP) metrics
scheduled_taskScheduled Tasks metrics
serviceService state metricsYes
smbIIS SMTP Server
smb_clientIIS SMTP Server
smtpIIS SMTP Server
systemSystem callsYes
tcpTCP connections
timeWindows Time Service
thermalzoneThermal information
terminal_servicesTerminal services (RDS)
textfileRead Prometheus metrics from a text file
udpUDP connections
vmwarePerformance counters installed by the VMware Guest agent

Refer to the linked documentation on each collector for more information on reported metrics, configuration settings and usage examples.

Caution

Certain collectors cause Alloy to crash if those collectors are used and the required infrastructure isn’t installed. These include but aren’t limited to mscluster, vmware, nps, dns, msmq, ad, hyperv, and scheduled_task.

The cs collector has been deprecated and may be removed in future versions of the exporter.

Example

The following example uses a prometheus.scrape component to collect metrics from prometheus.exporter.windows:

alloy
prometheus.exporter.windows "default" { }

// Configure a prometheus.scrape component to collect windows metrics.
prometheus.scrape "example" {
  targets    = prometheus.exporter.windows.default.targets
  forward_to = [prometheus.remote_write.demo.receiver]
}

prometheus.remote_write "demo" {
  endpoint {
    url = "<PROMETHEUS_REMOTE_WRITE_URL>"

    basic_auth {
      username = "<USERNAME>"
      password = "<PASSWORD>"
    }
  }
}

Replace the following:

  • <PROMETHEUS_REMOTE_WRITE_URL>: The URL of the Prometheus remote_write compatible server to send metrics to.
  • <USERNAME>: The username to use for authentication to the remote_write API.
  • <PASSWORD>: The password to use for authentication to the remote_write API.

Compatible components

prometheus.exporter.windows has exports that can be consumed by the following components:

Note

Connecting some components may not be sensible or components may require further configuration to make the connection work correctly. Refer to the linked documentation for more details.