Caution
Grafana Alloy is the new name for our distribution of the OTel collector. Grafana Agent has been deprecated and is in Long-Term Support (LTS) through October 31, 2025. Grafana Agent will reach an End-of-Life (EOL) on November 1, 2025. Read more about why we recommend migrating to Grafana Alloy.
prometheus.exporter.windows
The prometheus.exporter.windows
component embeds
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 black and white list configuration options are available for backwards compatibility but are deprecated. The include and exclude configuration options are preferred going forward.
Usage
prometheus.exporter.windows "LABEL" {
}
Arguments
The following arguments can be used to configure the exporter’s behavior. All arguments are optional. Omitted fields take their default values.
Name | Type | Description | Default | Required |
---|---|---|---|---|
enabled_collectors | list(string) | List of collectors to enable. | ["cpu","cs","logical_disk","net","os","service","system"] | no |
timeout | duration | Configure timeout for collecting metrics. | 4m | 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
The following blocks are supported inside the definition of
prometheus.exporter.windows
to configure collector-specific options:
Hierarchy | Name | Description | Required |
---|---|---|---|
dfsr | dfsr | Configures the dfsr collector. | no |
exchange | exchange | Configures the exchange collector. | no |
iis | iis | Configures the iis collector. | no |
logical_disk | logical_disk | Configures the logical_disk collector. | no |
msmq | msmq | Configures the msmq collector. | no |
mssql | mssql | Configures the mssql collector. | no |
network | network | Configures the network collector. | no |
process | process | Configures the process collector. | no |
scheduled_task | scheduled_task | Configures the scheduled_task collector. | no |
service | service | Configures the service collector. | no |
smtp | smtp | Configures the smtp collector. | no |
text_file | text_file | Configures the text_file collector. | no |
dfsr block
Name | Type | Description | Default | Required |
---|---|---|---|---|
source_enabled | list(string) | Comma-separated list of DFSR Perflib sources to use. | ["connection","folder","volume"] | no |
exchange block
Name | Type | Description | Default | Required |
---|---|---|---|---|
enabled_list | string | Comma-separated list of collectors to use. | "" | no |
The collectors specified by enabled_list
can include the following:
ADAccessProcesses
TransportQueues
HttpProxy
ActiveSync
AvailabilityService
OutlookWebAccess
Autodiscover
WorkloadManagement
RpcClientAccess
For example, enabled_list
may be set to "AvailabilityService,OutlookWebAccess"
.
iis block
Name | Type | Description | Default | Required |
---|---|---|---|---|
app_exclude | string | Regular expression of applications to ignore. | "" | no |
app_include | string | Regular expression of applications to report on. | ".*" | no |
site_exclude | string | Regular expression of sites to ignore. | "" | no |
site_include | string | Regular expression of sites to report on. | ".*" | no |
logical_disk block
Name | Type | Description | Default | Required |
---|---|---|---|---|
exclude | string | Regular expression of volumes to exclude. | "" | no |
include | string | Regular 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.
msmq block
Name | Type | Description | Default | Required |
---|---|---|---|---|
where_clause | string | WQL ‘where’ clause to use in WMI metrics query. | "" | no |
Specifying enabled_classes
is useful to limit the response to the MSMQs you specify, reducing the size of the response.
mssql block
Name | Type | Description | Default | Required |
---|---|---|---|---|
enabled_classes | list(string) | Comma-separated list of MSSQL WMI classes to use. | ["accessmethods", "availreplica", "bufman", "databases", "dbreplica", "genstats", "locks", "memmgr", "sqlstats", "sqlerrorstransactions"] | no |
network block
Name | Type | Description | Default | Required |
---|---|---|---|---|
exclude | string | Regular expression of NIC:s to exclude. | "" | no |
include | string | Regular expression of NIC:s 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.
process block
Name | Type | Description | Default | Required |
---|---|---|---|---|
exclude | string | Regular expression of processes to exclude. | "" | no |
include | string | Regular expression of processes to include. | ".*" | no |
Processes must match the regular expression specified by include
and must not match the regular expression specified by exclude
to be included.
scheduled_task block
Name | Type | Description | Default | Required |
---|---|---|---|---|
exclude | string | Regexp of tasks to exclude. | "" | no |
include | string | Regexp of tasks 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
.
service block
Name | Type | Description | Default | Required |
---|---|---|---|---|
use_api | string | Use the Windows API to collect service data instead of WMI. | false | no |
where_clause | string | WQL ‘where’ clause to use in WMI metrics query. | "" | no |
The where_clause
argument can be used to limit the response to the services you specify, reducing the size of the response.
If use_api
is enabled, ‘where_clause’ won’t be effective.
The Windows API is more performant than WMI. Set use_api
to true
in situations when the WMI takes too long to get the service information.
Setting use_api
to true
does have a few disadvantages compared to using WMI:
- WMI queries in
where_clause
won’t work. - The
status
field of the service is not available. You can use thestate
property to retrieve status information. This property provides the same information, but it is formatted differently.
smtp block
Name | Type | Description | Default | Required |
---|---|---|---|---|
exclude | string | Regexp of virtual servers to ignore. | no | |
include | string | Regexp 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
.
text_file block
Name | Type | Description | Default | Required |
---|---|---|---|---|
text_file_directory | string | The directory containing the files to be ingested. | C:\Program Files\Grafana Agent Flow\textfile_inputs | no |
When text_file_directory
is set, only files with the extension .prom
inside the specified directory are read. Each .prom
file found must end with an empty line feed to work properly.
Exported fields
The following fields are exported and can be referenced by other components.
Name | Type | Description |
---|---|---|
targets | list(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
does not expose any component-specific
debug information.
Debug metrics
prometheus.exporter.windows
does not expose any component-specific
debug metrics.
Collectors list
The following table lists the available collectors that windows_exporter
brings
bundled in. Some collectors only work on specific operating systems; enabling a
collector that is not supported by the host OS where Flow 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.
Name | Description | Enabled by default |
---|---|---|
ad | Active Directory Domain Services | |
adcs | Active Directory Certificate Services | |
adfs | Active Directory Federation Services | |
cache | Cache metrics | |
cpu | CPU usage | ✓ |
cpu_info | CPU Information | |
cs | “Computer System” metrics (system properties, num cpus/total memory) | ✓ |
container | Container metrics | |
dfsr | DFSR metrics | |
dhcp | DHCP Server | |
dns | DNS Server | |
exchange | Exchange metrics | |
fsrmquota | Microsoft File Server Resource Manager (FSRM) Quotas collector | |
hyperv | Hyper-V hosts | |
iis | IIS sites and applications | |
logical_disk | Logical disks, disk I/O | ✓ |
logon | User logon sessions | |
memory | Memory usage metrics | |
mscluster_cluster | MSCluster cluster metrics | |
mscluster_network | MSCluster network metrics | |
mscluster_node | MSCluster Node metrics | |
mscluster_resource | MSCluster Resource metrics | |
mscluster_resourcegroup | MSCluster ResourceGroup metrics | |
msmq | MSMQ queues | |
mssql | SQL Server Performance Objects metrics | |
netframework_clrexceptions | .NET Framework CLR Exceptions | |
netframework_clrinterop | .NET Framework Interop Metrics | |
netframework_clrjit | .NET Framework JIT metrics | |
netframework_clrloading | .NET Framework CLR Loading metrics | |
netframework_clrlocksandthreads | .NET Framework locks and metrics threads | |
netframework_clrmemory | .NET Framework Memory metrics | |
netframework_clrremoting | .NET Framework Remoting metrics | |
netframework_clrsecurity | .NET Framework Security Check metrics | |
net | Network interface I/O | ✓ |
os | OS metrics (memory, processes, users) | ✓ |
physical_disk | Physical disks | ✓ |
process | Per-process metrics | |
remote_fx | RemoteFX protocol (RDP) metrics | |
scheduled_task | Scheduled Tasks metrics | |
service | Service state metrics | ✓ |
smtp | IIS SMTP Server | |
system | System calls | ✓ |
tcp | TCP connections | |
teradici_pcoip | Teradici PCoIP session metrics | |
time | Windows Time Service | |
thermalzone | Thermal information | |
terminal_services | Terminal services (RDS) | |
textfile | Read prometheus metrics from a text file | |
vmware_blast | VMware Blast session metrics | |
vmware | Performance 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 will cause Grafana Agent 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, teradici_pcoip, ad, hyperv, and scheduled_task.
Example
This 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 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:
- 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.