---
title: Windows Services
description: Monitor the state of your Windows services.
breadcrumbs: Docs > Integrations > Windows Services
---

# Windows Services
Supported OS Integration version6.7.0
## Overview{% #overview %}

This check monitors the state of any Windows Service and submits a service check to Datadog.

**Minimum Agent version:** 6.0.0

## Setup{% #setup %}

### Installation{% #installation %}

The Windows Service check is installed by default with the [Datadog Agent](https://app.datadoghq.com/account/settings/agent/latest), but is not configured. Please see the next section to configure the check.

### Configuration{% #configuration %}

The configuration is located in the `windows_service.d/conf.yaml` file in the `conf.d/` folder at the root of your [Agent's configuration directory](https://docs.datadoghq.com/agent/guide/agent-configuration-files/#agent-configuration-directory). See the [sample windows_service.d/conf.yaml](https://github.com/DataDog/integrations-core/blob/master/windows_service/datadog_checks/windows_service/data/conf.yaml.example) for all available configuration options. When you are done editing the configuration file, [restart the Agent](https://docs.datadoghq.com/agent/guide/agent-commands/#start-stop-and-restart-the-agent) to load the new configuration.

The check can monitor all services on the system or selectively monitor a few services by name. Beginning with Agent version 7.41, the check can select which services to monitor based on their startup type.

This example configuration monitors only the `Dnscache` and `wmiApSrv` services:

```yaml
instances:
  - services:
    - dnscache
    - wmiapsrv
```

This example uses the `ALL` keyword to monitor all services on the host. If the `ALL` keyword is used, the other patterns in the instance are ignored.

```yaml
instances:
  - services:
    - ALL
```

The check uses case-insensitive [Python regular expressions](https://docs.python.org/3/howto/regex.html#regex-howto) when matching service names. If a service name includes special characters, you must escape the special characters with a `\`. For example, `MSSQL$CRMAWS` becomes `MSSQL\$CRMAWS` and `Web Server (prod)` becomes `Web Server \(prod\)`. The service name pattern matches all service names that start with the pattern. For an exact match, use the regular expression `^service$`.

Provide service names as they appear in the service name field, **NOT** the display name field. For example, configure the service name `datadogagent` **NOT** the display name `Datadog Agent`.

Beginning with Agent version 7.41, the check can select which services to monitor based on their startup type. For example, to monitor only the services that have an `automatic` or `automatic_delayed_start` startup type.

```yaml
instances:
  - services:
    - startup_type: automatic
    - startup_type: automatic_delayed_start
```

The possible values for `startup_type` are:

- `disabled`
- `manual`
- `automatic`
- `automatic_delayed_start`

Beginning with Agent version 7.50, the check can select which services to monitor based on whether they have a [Service Trigger assigned](https://learn.microsoft.com/en-us/windows/win32/services/service-trigger-events). Below are some examples showing possible configurations.

```yaml
# Matches all services that do not have a trigger
services:
  - trigger_start: false

# Matches all services with an automatic startup type and excludes services with triggers
services:
  - startup_type: automatic
    trigger_start: false

# Only matches EventLog service when its startup type is automatic and has triggers
services:
  - name: EventLog
    startup_type: automatic
    trigger_start: true
```

Beginning with Agent version 7.74, the check automatically collects metrics for Windows services.

#### Tags{% #tags %}

The check automatically tags the Windows service name to each service check in the `windows_service:<SERVICE>` tag. The `<SERVICE>` name in the tag uses lowercase and special characters are replaced with underscores. See [Getting Started with Tags](https://docs.datadoghq.com/getting_started/tagging/) for more information.

**NOTE:** The check also automatically tags the Windows service name to each service check in the `service:<SERVICE>` tag. **This behavior is deprecated**. In a future version of the Agent, the check will stop automatically assigning this tag. To stop the check from automatically assigning this tag and to disable the associated deprecation warning, set the `disable_legacy_service_tag` option. See [Assigning Tags](https://docs.datadoghq.com/getting_started/tagging/assigning_tags/) for information on how to assign the `service` tag to a service.

Beginning with Agent version 7.40, the check can add a `windows_service_startup_type:<STARTUP_TYPE>` tag to each service check to indicate the startup type of the service. Set the `windows_service_startup_type_tag` option to include this tag with each service check.

Beginning with Agent version 7.55, the check can add a `display_name:<DISPLAY_NAME>` tag to each service check to indicate the display name of the service. Set the `collect_display_name_as_tag` option to `true` to include this tag with each service check.

Beginning with Agent version 7.73, the check automatically adds a `windows_service_state:<STATE>` tag to each service check to indicate the state of the service.

### Validation{% #validation %}

[Run the Agent's status subcommand](https://docs.datadoghq.com/agent/guide/agent-commands/#agent-status-and-information) and look for `windows_service` under the **Checks** section.

## Data Collected{% #data-collected %}

### Metrics{% #metrics %}

|  |
|  |
| **windows\_service.restarts**(count) | The number of restarts of the host process of the Windows service*Shown as event*   |
| **windows\_service.state**(gauge)    | Sum by state to count the number of services in each state*Shown as service*        |
| **windows\_service.uptime**(gauge)   | The uptime (in seconds) of the host process of the Windows service*Shown as second* |

**Note:** Metrics are tagged with the same tags as the service check.

### Events{% #events %}

The Windows Service check does not include any events.

### Service Checks{% #service-checks %}

**windows\_service.state**

Returns `OK` if the windows service is in Running state, `CRITICAL` if it is Stopped, `UNKNOWN` if it is Unknown, and `WARNING` for the other service states.

*Statuses: ok, warning, critical, unknown*

## Troubleshooting{% #troubleshooting %}

Need help? Contact [Datadog support](https://docs.datadoghq.com/help/).

### Service permissions{% #service-permissions %}

If a service is present and matches the configuration, but the Datadog Agent does not report a service check for the service, the Datadog Agent might have insufficient permissions. For example, by default the Datadog Agent does not have access to the NTDS Active Directory Domain Services service. To verify this, run the check from an **elevated (run as Admin)** PowerShell shell.

```powershell
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" check windows_service
```

If the service is present in the output, permissions are the issue. To give the Datadog Agent permission [grant `Read` access on the service](https://learn.microsoft.com/en-us/troubleshoot/windows-server/windows-security/grant-users-rights-manage-services) to the [Datadog Agent User](https://docs.datadoghq.com/agent/guide/windows-agent-ddagent-user/). We recommend [granting `Read` access with Group Policy](https://learn.microsoft.com/en-US/troubleshoot/windows-server/group-policy/configure-group-policies-set-security) to ensure the permissions persist through Windows Updates.

## Further Reading{% #further-reading %}

- [Monitoring Windows Server 2012](https://www.datadoghq.com/blog/monitoring-windows-server-2012)
- [How to collect Windows Server 2012 metrics](https://www.datadoghq.com/blog/collect-windows-server-2012-metrics)
- [Monitoring Windows Server 2012 with Datadog](https://www.datadoghq.com/blog/windows-server-monitoring)
