> ## Documentation Index
> Fetch the complete documentation index at: https://otel.fyi/llms.txt
> Use this file to discover all available pages before exploring further.

# Systemd

> OpenTelemetry receiver for Systemd

# Systemd Receiver

![Status](https://img.shields.io/badge/status-alpha-red)

**Available in:** `contrib`

**Maintainers:** [@atoulme](https://github.com/atoulme)

**Source:** [opentelemetry-collector-contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/systemdreceiver)

## Supported Telemetry

![Metrics](https://img.shields.io/badge/metrics-alpha-green)

## Overview

This scraper generates a metric with a label for service state with a value of `1` if the unit is in that state. For
example, the following metrics will be generated if the `nginx` service is currently active:

```
systemd.unit.state{systemd.unit.name="nginx", systemd.unit.active_state="active"} = 1
systemd.unit.state{systemd.unit.name="nginx", systemd.unit.active_state="reloading"} = 0
systemd.unit.state{systemd.unit.name="nginx", systemd.unit.active_state="inactive"} = 0
systemd.unit.state{systemd.unit.name="nginx", systemd.unit.active_state="failed"} = 0
systemd.unit.state{systemd.unit.name="nginx", systemd.unit.active_state="activating"} = 0
systemd.unit.state{systemd.unit.name="nginx", systemd.unit.active_state="deactivating"} = 0
systemd.unit.state{systemd.unit.name="nginx", systemd.unit.active_state="maintenance"} = 0
systemd.unit.state{systemd.unit.name="nginx", systemd.unit.active_state="refreshing"} = 0
```

## Configuration

| Field   | Default         | Description                                                          |
| ------- | --------------- | -------------------------------------------------------------------- |
| `scope` | `system`        | The service manager to gather units from, either `system` or `user`. |
| `units` | `["*.service"]` | The units to scrape, as a list of [patterns].                        |

[patterns]: https://www.freedesktop.org/software/systemd/man/latest/systemctl.html#Parameter%20Syntax

## Example

### Basic configuration

In its default configuration, the systemd receiver will scrape all system-level services:

```yaml theme={null}
  receivers:
    systemd:
```

### Advanced configuration

```yaml theme={null}
  receivers:
    systemd:
        scope: user
        units: ["emacs.service"]
```

## Metrics

| Metric Name                  | Description                                                                       | Unit        | Type          | Attributes                 |
| ---------------------------- | --------------------------------------------------------------------------------- | ----------- | ------------- | -------------------------- |
| ✅ `systemd.service.cpu.time` | Total CPU time spent by this service.                                             | us          | Counter       | cpu.mode                   |
| ❌ `systemd.service.restarts` | Number of automatic restarts for the service.                                     | \{restarts} | Counter       |                            |
| ✅ `systemd.unit.state`       | 1 if the check resulted in active\_state matching the current state, otherwise 0. | 1           | UpDownCounter | systemd.unit.active\_state |

## Attributes

| Attribute Name              | Description                                                                                                                                                                             | Type   | Values                                                                                                 |
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------ |
| `cpu.mode`                  | Breakdown of CPU usage by type.                                                                                                                                                         | string | `system`, `user`                                                                                       |
| `systemd.unit.active_state` | The active state of the unit ([https://www.freedesktop.org/software/systemd/man/latest/systemd.html#Units](https://www.freedesktop.org/software/systemd/man/latest/systemd.html#Units)) | string | `active`, `reloading`, `inactive`, `failed`, `activating`, `deactivating`, `maintenance`, `refreshing` |

## Resource Attributes

| Attribute Name      | Description              | Type   | Enabled |
| ------------------- | ------------------------ | ------ | ------- |
| `systemd.unit.name` | Name of the systemd unit | string | ✅       |

***

*Last generated: 2026-07-06*
