---
title: Windows services integration
source: https://docs.newrelic.com/docs/infrastructure/host-integrations/host-integrations-list/windows-services-integration
---

New Relic's Windows services integration collects data about the services running on your Microsoft Windows hosts and sends it to our platform. You can check the state and start mode of each service, find out which hosts are running a service, set up alerts for services, and more.

With our Windows services integration you can:

-   Check all your Windows services, their state (running, stopped, etc.), start mode (auto, manual, etc.), and other service [metadata](#metadata).
-   See which hosts are running specific Windows services.
-   [Set alerts](#set-alerts) based on any Windows services that you are monitoring using New Relic.
-   Install the [Windows Services Quickstart](https://newrelic.com/instant-observability/winservices) or create your own dashboards to track your Windows services.

Our integration is bundled with the [Windows infrastructure agent](https://docs.newrelic.com/docs/infrastructure/install-infrastructure-agent/windows-installation/install-infrastructure-monitoring-agent-windows). If you're monitoring Windows hosts on New Relic, you only need to enable the integration to get Windows services data into our platform.

![New Relic - Windows services integration - Metric data](https://docs.newrelic.com/images/infrastructure_screenshot-crop_windows-services-metric.webp "New Relic - Windows services integration - Metric data")

**[one.newrelic.com > All capabilities](https://one.newrelic.com/all-capabilities) > Dashboards**: You can use the Microsoft Windows services integration metrics to create tables for your services.

## Compatibility and requirements [#requirements]

Our integration is compatible with all [Windows versions supported](https://docs.newrelic.com/docs/infrastructure/install-infrastructure-agent/get-started/requirements-infrastructure-agent) by the New Relic infrastructure agent.

You must have **version 1.12.1 or higher** for our [infrastructure agent](https://docs.newrelic.com/docs/infrastructure/install-infrastructure-agent/windows-installation/install-infrastructure-monitoring-agent-windows) installed on a supported host. The x86 Windows versions are not yet supported.

## Install the infrastructure agent [#infra-install]

To use the Windows services integration, you need to first [install the infrastructure agent](https://docs.newrelic.com/docs/infrastructure/install-infrastructure-agent/get-started/install-infrastructure-agent-new-relic/) on the same host. All our on-host integrations require the infrastructure agent, which helps expose and report metrics to New Relic.

## Configure the Windows services integration [#configure]

To activate and configure the Windows services integration:

1.  Change the directory to the integrations folder:

    ```shell
    cd C:\Program Files\New Relic\newrelic-infra\integrations.d\
    ```
2.  Copy the sample configuration file:

    ```shell
    copy winservices-config.yml.sample winservices-config.yml
    ```
3.  Edit the `winservices-config.yml` file. By default, no service is included. To include and filter services, you must edit `include_matching_entities:` and/or `exclude_matching_entities:`.

    Here's an example of the Windows services integration configuration with both a regex pattern matching all services named `win32.*` and a direct match for the `newrelic-infra` service. You can also use `exclude_matching_entities` to filter out specific services you do not want to monitor:

    ```yml
    integrations:
      - name: nri-winservices
        config:
          exporter_bind_address: 127.0.0.1
          exporter_bind_port: 9182
          include_matching_entities:
            windowsService.name:
              - regex "win32.*"
              - "newrelic-infra"
          exclude_matching_entities:
            windowsService.name:
              - regex "test.*"
              - "unwanted-service"
          scrape_interval: 30s
        labels:
          env: production
          role: load_balancer
        timeout: 60s
    ```

    For more information, see our documentation about the [general structure of on-host integration configurations](https://docs.newrelic.com/docs/integrations/integrations-sdk/file-specifications/host-integration-configuration-overview).

## Restart the New Relic infrastructure agent

Restart your infrastructure agent:

````shell
net stop newrelic-infra && net start newrelic-infra
```

In a couple of minutes, your application will send metrics to [one.newrelic.com](https://one.newrelic.com).  


````

## Find your data

You can choose our pre-built dashboard template named `Windows services integration ` to monitor your Windows services. Follow these steps to use our pre-built dashboard template:

1.  From [one.newrelic.com](https://one.newrelic.com), go to the **+ Integrations & Agents** page.
2.  Click on **Dashboards**.
3.  In the search bar, type `Windows services`.
4.  The Windows services dashboard should appear. Click on it to install it.

    Your Windows services dashboard is considered a custom dashboard and can be found in the **Dashboards** UI. For docs on using and editing dashboards, see [our dashboard docs](https://docs.newrelic.com/docs/query-your-data/explore-query-data/dashboards/introduction-dashboards).

## Set up an alert [#set-alerts]

You can create Windows services alerts using NRQL conditions to get notified about state changes of the services you wish to monitor. Here are two examples of alert conditions that use Windows services data:

**Service is not running**

````sql
SELECT count(*) FROM Metric WHERE metricName = 'windows_service_state' AND state != 'running' FACET hostname, service_name
```

````

**Start mode is `auto`, but current state is not `running`**

````sql
FROM Metric SELECT count(*) WHERE start_mode = 'auto' AND state != 'running' FACET hostname, service_name
```

````

## How it works [#process]

To get data from Windows hosts, our Windows services integration uses a reduced version of the [Prometheus exporter for Windows](https://github.com/prometheus-community/windows_exporter), which exposes Prometheus metrics on the port specified in the agent configuration. The integration collects these metrics, transforms them into entities, filters them, and then sends them to New Relic.

![Windows services integration architecture](https://docs.newrelic.com/images/infrastructure_diagram_windows-services.webp "Windows services integration architecture")

The Windows services integration collects [Service Functions](https://docs.microsoft.com/en-us/windows/win32/services/service-functions) data using the Windows Prometheus exporter. It then transforms and filters the data before sending it to New Relic.

## Metric data [#metrics]

The Windows services integration provides the following data:

> #### 💡 TIP
>
> This integration creates dimensional metrics, which return the numeric status supplied by the [Win32_Service class](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-service). Enumeration of these metrics into readable string values is provided under the `start_mode` and `state` attributes.

| Metric Name                  | Enumerated Attribute | Description                                                                                                                                                         |
| ---------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `windows_service_start_mode` | `start_mode`         | Start mode of the service. Possible values are: - `boot` - `system` - `auto` - `manual` - `disabled`                                                                |
| `windows_service_state`      | `state`              | State of the service. Possible values are: - `stopped` - `start pending` - `stop pending` - `running` - `continue pending` - `pause pending` - `paused` - `unknown` |

## Labels [#labels]

You can also decorate your metrics and tags with labels. Labels allow you to add key/value pair attributes to your metrics & tags so that you can query, filter, or group your metrics and use tags for grouping, searching and filtering the data about your entities.

Even though our default sample configuration file includes examples of labels, they're optional. You can remove, modify, or add new ones.

```yml
labels:
  env: production
  role: load_balancer
```

## Metadata [#metadata]

The Windows services integration sends the following metadata to New Relic:

-   `display_name`: Name of the service as viewed in the services snap-in.

-   `process_id`: Process identifier of the service.

-   `run_as`: Account name under which a service runs. Depending on the service type, the format of the account name may be `DomainName\Username` or `Username@DomainName` (UPN). The value is taken from the `StartName` attribute of the `Win32_Service` class, which can be `NULL` (in that case, the label is reported as an empty string).

    > #### ⚠️ IMPORTANT
    >
    > If the `StartName` attribute is `NULL`, the service is logged on under the `LocalSystem` account. For kernel or system-level drive, it runs with a default object name that the the I/O system creates based on the service name, for example, `DWDOM\Admin`.

-   `service_name`: Unique identifier of the service.

    > #### ⚠️ IMPORTANT
    >
    > The system converts `service_name` to lowercase per best practices. It replaces all spaces and periods with underscores. It isn't the the same as the service name on the Windows interface.

## Source code [#open-source]

The Windows services integration is open source software. That means you can [browse its source code](https://github.com/newrelic/nri-winservices/) and [send improvements](https://github.com/newrelic/nri-winservices/blob/master/CONTRIBUTING.md), or create your own fork and build it. For more information, see the [README](https://github.com/newrelic/nri-winservices/blob/master/README.md).
