Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.
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
blacklistandwhitelistconfiguration arguments are available for backwards compatibility but are deprecated. Theincludeandexcludearguments are preferred going forward.
Usage
prometheus.exporter.windows "<LABEL>" {
}Arguments
You can use the following arguments with prometheus.exporter.windows:
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:
The textfile collector is currently configured with the text_file block.
To be consistent with the textfile collector name, the text_file block will be deprecated in a future release and replaced with a textfile block.
Note
Starting with release 1.9.0, the
msmqblock is deprecated. It will be removed in a future release. You can still include this block in your configuration files. However, its usage is now a no-op.
dfsr
dns
exchange
filetime
iis
User-supplied app_exclude, app_include, site_exclude and site_include strings are wrapped in a regular expression.
logical_disk
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
The collectors specified by enabled_list can include the following:
clusternetworknoderesourceresouregroup
For example, you can set enabled_list to ["cluster"].
mssql
network
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
The collectors specified by enabled_list can include the following:
clrexceptionsclrinteropclrjitclrloadingclrlocksandthreadsclrmemoryclrremotingclrsecurity
For example, you can set enabled_list to ["clrjit"].
performancecounter
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.
local.file "counters" {
filename = "/etc/alloy/performance_counters.yaml"
}
prometheus.exporter.windows "default" {
...
performancecounter {
objects = local.file.counters.content
}
...
}The performance_counters.yaml file should be a YAML file that represents an array of objects matching the schema in the documentation, like the example below.
- name: memory
object: "Memory"
counters:
- name: "Cache Faults/sec"
type: "counter" # optionalphysical_disk
User-supplied exclude and include strings are wrapped in a regular expression.
printer
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
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
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
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.
Note
Starting with release 1.9.0, the
use_api,where_clause, andenable_v2_collectorattributes are deprecated. They will be removed in a future release. You can still include these attributes in your configuration files. However, their usage is now a no-op.
smb
The collectors specified by enabled_list can include the following:
ServerShares
For example, enabled_list may be set to ["ServerShares"].
smb_client
The collectors specified by enabled_list can include the following:
ClientShares
For example, enabled_list may be set to ["ClientShares"].
smtp
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
The collectors specified by enabled_list can include the following:
connections_statemetrics
For example, you can set enabled_list to ["metrics"].
text_file
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
.promfiles must end with an empty line feed for the component to recognize and read them.
update
Exported fields
The following fields are exported and can be referenced by other components.
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.
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, andscheduled_task.The
cscollector 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:
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 Prometheusremote_writecompatible server to send metrics to.<USERNAME>: The username to use for authentication to theremote_writeAPI.<PASSWORD>: The password to use for authentication to theremote_writeAPI.
Compatible components
prometheus.exporter.windows has exports that can be consumed by the following components:
- Components that consume Targets
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.



