Menu
Grafana Cloud

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 blacklist and whitelist configuration arguments 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

The following arguments can be used to configure the exporter’s behavior. All arguments are optional. Omitted fields take their default values.

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

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

HierarchyNameDescriptionRequired
dfsrdfsrConfigures the dfsr collector.no
exchangeexchangeConfigures the exchange collector.no
iisiisConfigures the iis collector.no
logical_disklogical_diskConfigures the logical_disk collector.no
msmqmsmqConfigures the msmq collector.no
mssqlmssqlConfigures the mssql collector.no
networknetworkConfigures the network collector.no
physical_diskphysical_diskConfigures the physical_disk collector.no
printerprinterConfigures the printer collector.no
processprocessConfigures the process collector.no
scheduled_taskscheduled_taskConfigures the scheduled_task collector.no
serviceserviceConfigures the service collector.no
smbsmbConfigures the smb collector.no
smb_clientsmb_clientConfigures the smb_client collector.no
smtpsmtpConfigures the smtp collector.no
text_filetext_fileConfigures the text_file collector.no

dfsr block

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

exchange block

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

iis block

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 will be wrapped in a regular expression.

logical_disk block

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 will be wrapped in a regular expression.

msmq block

NameTypeDescriptionDefaultRequired
where_clausestringWQL ‘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

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

network block

NameTypeDescriptionDefaultRequired
excludestringRegular expression of NIC:s to exclude."^$"no
includestringRegular 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.

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

physical_disk block

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

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

printer block

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 will be wrapped in a regular expression.

process block

NameTypeDescriptionDefaultRequired
excludestringRegular expression of processes to exclude."^$"no
includestringRegular 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.

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

scheduled_task block

NameTypeDescriptionDefaultRequired
excludestringRegular expression of tasks to exclude."^$"no
includestringRegular expression 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.

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

service block

NameTypeDescriptionDefaultRequired
enable_v2_collectorstringEnable V2 service collector."false"no
use_apistringUse API calls to collect service data instead of WMI."false"no
where_clausestringWQL ‘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 v2 collector can query service states much more efficiently, but can’t provide general service information.

smb block

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 block

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 block

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 will be wrapped in a regular expression.

text_file block

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

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 does not expose any component-specific debug information.

Debug metrics

prometheus.exporter.windows does not expose any component-specific debug metrics.

Wrapping of regular expression strings

Some collector blocks such as scheduled_task accept a regular expression as a string argument. prometheus.exporter.windows will prefix some regular expression string arguments with ^(?: and will suffix them with )$. For example, if a user sets an exclude argument to ".*", Alloy will set 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 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 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 usage
cpu_infoCPU Information
cs“Computer System” metrics (system properties, num cpus/total memory)
containerContainer metrics
dfsrDFSR metrics
dhcpDHCP Server
dnsDNS Server
exchangeExchange metrics
fsrmquotaMicrosoft File Server Resource Manager (FSRM) Quotas collector
hypervHyper-V hosts
iisIIS sites and applications
logical_diskLogical disks, disk I/O
logonUser logon sessions
memoryMemory usage metrics
mscluster_clusterMSCluster cluster metrics
mscluster_networkMSCluster network metrics
mscluster_nodeMSCluster Node metrics
mscluster_resourceMSCluster Resource metrics
mscluster_resourcegroupMSCluster ResourceGroup metrics
msmqMSMQ queues
mssqlSQL 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
netNetwork interface I/O
osOS metrics (memory, processes, users)
physical_diskPhysical disks
printerPrinter metrics
processPer-process metrics
remote_fxRemoteFX protocol (RDP) metrics
scheduled_taskScheduled Tasks metrics
serviceService state metrics
smbIIS SMTP Server
smb_clientIIS SMTP Server
smtpIIS SMTP Server
systemSystem calls
tcpTCP connections
teradici_pcoipTeradici PCoIP session metrics
timeWindows Time Service
thermalzoneThermal information
terminal_servicesTerminal services (RDS)
textfileRead prometheus metrics from a text file
vmware_blastVMware Blast session metrics
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 will 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, teradici_pcoip, ad, hyperv, and scheduled_task.

Example

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