---
title: "prometheus.exporter.windows | Grafana Agent documentation"
description: "Learn about prometheus.exporter.windows"
---

# prometheus.exporter.windows

The `prometheus.exporter.windows` component embeds [windows\_exporter](https://github.com/prometheus-community/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`](#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

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```alloy
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.

Expand table

| 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](#collectors-list) for the default set.

## Blocks

The following blocks are supported inside the definition of `prometheus.exporter.windows` to configure collector-specific options:

Expand table

| Hierarchy       | Name                                    | Description                               | Required |
|-----------------|-----------------------------------------|-------------------------------------------|----------|
| dfsr            | [dfsr](#dfsr-block)                     | Configures the dfsr collector.            | no       |
| exchange        | [exchange](#exchange-block)             | Configures the exchange collector.        | no       |
| iis             | [iis](#iis-block)                       | Configures the iis collector.             | no       |
| logical\_disk   | [logical\_disk](#logicaldisk-block)     | Configures the logical\_disk collector.   | no       |
| msmq            | [msmq](#msmq-block)                     | Configures the msmq collector.            | no       |
| mssql           | [mssql](#mssql-block)                   | Configures the mssql collector.           | no       |
| network         | [network](#network-block)               | Configures the network collector.         | no       |
| process         | [process](#process-block)               | Configures the process collector.         | no       |
| scheduled\_task | [scheduled\_task](#scheduledtask-block) | Configures the scheduled\_task collector. | no       |
| service         | [service](#service-block)               | Configures the service collector.         | no       |
| smtp            | [smtp](#smtp-block)                     | Configures the smtp collector.            | no       |
| text\_file      | [text\_file](#textfile-block)           | Configures the text\_file collector.      | no       |

### dfsr block

Expand table

| Name             | Type           | Description                                          | Default                            | Required |
|------------------|----------------|------------------------------------------------------|------------------------------------|----------|
| `source_enabled` | `list(string)` | Comma-separated list of DFSR Perflib sources to use. | `["connection","folder","volume"]` | no       |

### exchange block

Expand table

| 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

Expand table

| 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

Expand table

| 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

Expand table

| 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

Expand table

| 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

Expand table

| 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

Expand table

| 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

Expand table

| 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

Expand table

| 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 the `state` property to retrieve status information. This property provides the same information, but it is formatted differently.

### smtp block

Expand table

| 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

Expand table

| 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.

Expand table

| 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](/docs/agent/v0.43/flow/concepts/component_controller/#in-memory-traffic) address specified by the [run command](/docs/agent/v0.43/flow/reference/cli/run/).

## 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.

Expand table

| Name                                                                                                                                                       | Description                                                                                                                                                 | Enabled by default |
|------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------|
| [ad](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.ad.md)                                                            | Active Directory Domain Services                                                                                                                            |                    |
| [adcs](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.adcs.md)                                                        | Active Directory Certificate Services                                                                                                                       |                    |
| [adfs](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.adfs.md)                                                        | Active Directory Federation Services                                                                                                                        |                    |
| [cache](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.cache.md)                                                      | Cache metrics                                                                                                                                               |                    |
| [cpu](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.cpu.md)                                                          | CPU usage                                                                                                                                                   | ✓                  |
| [cpu\_info](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.cpu_info.md)                                               | CPU Information                                                                                                                                             |                    |
| [cs](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.cs.md)                                                            | “Computer System” metrics (system properties, num cpus/total memory)                                                                                        | ✓                  |
| [container](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.container.md)                                              | Container metrics                                                                                                                                           |                    |
| [dfsr](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.dfsr.md)                                                        | DFSR metrics                                                                                                                                                |                    |
| [dhcp](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.dhcp.md)                                                        | DHCP Server                                                                                                                                                 |                    |
| [dns](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.dns.md)                                                          | DNS Server                                                                                                                                                  |                    |
| [exchange](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.exchange.md)                                                | Exchange metrics                                                                                                                                            |                    |
| [fsrmquota](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.fsrmquota.md)                                              | Microsoft File Server Resource Manager (FSRM) Quotas collector                                                                                              |                    |
| [hyperv](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.hyperv.md)                                                    | Hyper-V hosts                                                                                                                                               |                    |
| [iis](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.iis.md)                                                          | IIS sites and applications                                                                                                                                  |                    |
| [logical\_disk](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.logical_disk.md)                                       | Logical disks, disk I/O                                                                                                                                     | ✓                  |
| [logon](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.logon.md)                                                      | User logon sessions                                                                                                                                         |                    |
| [memory](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.memory.md)                                                    | Memory usage metrics                                                                                                                                        |                    |
| [mscluster\_cluster](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.mscluster_cluster.md)                             | MSCluster cluster metrics                                                                                                                                   |                    |
| [mscluster\_network](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.mscluster_network.md)                             | MSCluster network metrics                                                                                                                                   |                    |
| [mscluster\_node](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.mscluster_node.md)                                   | MSCluster Node metrics                                                                                                                                      |                    |
| [mscluster\_resource](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.mscluster_resource.md)                           | MSCluster Resource metrics                                                                                                                                  |                    |
| [mscluster\_resourcegroup](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.mscluster_resourcegroup.md)                 | MSCluster ResourceGroup metrics                                                                                                                             |                    |
| [msmq](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.msmq.md)                                                        | MSMQ queues                                                                                                                                                 |                    |
| [mssql](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.mssql.md)                                                      | [SQL Server Performance Objects](https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/use-sql-server-objects#SQLServerPOs) metrics |                    |
| [netframework\_clrexceptions](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.netframework_clrexceptions.md)           | .NET Framework CLR Exceptions                                                                                                                               |                    |
| [netframework\_clrinterop](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.netframework_clrinterop.md)                 | .NET Framework Interop Metrics                                                                                                                              |                    |
| [netframework\_clrjit](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.netframework_clrjit.md)                         | .NET Framework JIT metrics                                                                                                                                  |                    |
| [netframework\_clrloading](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.netframework_clrloading.md)                 | .NET Framework CLR Loading metrics                                                                                                                          |                    |
| [netframework\_clrlocksandthreads](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.netframework_clrlocksandthreads.md) | .NET Framework locks and metrics threads                                                                                                                    |                    |
| [netframework\_clrmemory](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.netframework_clrmemory.md)                   | .NET Framework Memory metrics                                                                                                                               |                    |
| [netframework\_clrremoting](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.netframework_clrremoting.md)               | .NET Framework Remoting metrics                                                                                                                             |                    |
| [netframework\_clrsecurity](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.netframework_clrsecurity.md)               | .NET Framework Security Check metrics                                                                                                                       |                    |
| [net](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.net.md)                                                          | Network interface I/O                                                                                                                                       | ✓                  |
| [os](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.os.md)                                                            | OS metrics (memory, processes, users)                                                                                                                       | ✓                  |
| [physical\_disk](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.physical_disk.md)                                     | Physical disks                                                                                                                                              | ✓                  |
| [process](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.process.md)                                                  | Per-process metrics                                                                                                                                         |                    |
| [remote\_fx](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.remote_fx.md)                                             | RemoteFX protocol (RDP) metrics                                                                                                                             |                    |
| [scheduled\_task](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.scheduled_task.md)                                   | Scheduled Tasks metrics                                                                                                                                     |                    |
| [service](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.service.md)                                                  | Service state metrics                                                                                                                                       | ✓                  |
| [smtp](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.smtp.md)                                                        | IIS SMTP Server                                                                                                                                             |                    |
| [system](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.system.md)                                                    | System calls                                                                                                                                                | ✓                  |
| [tcp](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.tcp.md)                                                          | TCP connections                                                                                                                                             |                    |
| [teradici\_pcoip](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.teradici_pcoip.md)                                   | [Teradici PCoIP](https://www.teradici.com/web-help/pcoip_wmi_specs/) session metrics                                                                        |                    |
| [time](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.time.md)                                                        | Windows Time Service                                                                                                                                        |                    |
| [thermalzone](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.thermalzone.md)                                          | Thermal information                                                                                                                                         |                    |
| [terminal\_services](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.terminal_services.md)                             | Terminal services (RDS)                                                                                                                                     |                    |
| [textfile](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.textfile.md)                                                | Read prometheus metrics from a text file                                                                                                                    |                    |
| [vmware\_blast](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.vmware_blast.md)                                       | VMware Blast session metrics                                                                                                                                |                    |
| [vmware](https://github.com/prometheus-community/windows_exporter/blob/master/docs/collector.vmware.md)                                                    | 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](../prometheus.scrape/) to collect metrics from `prometheus.exporter.windows`:

Alloy ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```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:

- Components that consume [Targets](../../compatibility/#targets-consumers)

> 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.
