Project: Netdata (Observability and Analysis / Observability)
File: systemd_units.md

<!--startmeta customediturl: "https://github.com/netdata/netdata/edit/master/src/go/collectors/go.d.plugin/modules/systemdunits/README.md" meta_yaml: "https://github.com/netdata/netdata/edit/master/src/go/collectors/go.d.plugin/modules/systemdunits/metadata.yaml" sidebar_label: "Systemd Units" learn_status: "Published" learnrelpath: "Collecting Metrics/Systemd" most_popular: False message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE" endmeta--> <img src="https://netdata.cloud/img/systemd.svg" width="150"/> Plugin: go.d.plugin Module: systemdunits <img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" /> This collector monitors the state of Systemd units and unit files. This collector is supported on all platforms. This collector supports collecting metrics from multiple instances of this integration, including remote instances. This integration doesn't support auto-detection. The default configuration for this integration does not impose any limits on data collection. The default configuration for this integration is not expected to impose a significant performance impact on the system. Metrics grouped by scope. The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels. These metrics refer to the systemd unit. Labels: | Label | Description | |:--|:-| | unit_name | systemd unit name | Metrics: | Metric | Dimensions | Unit | |:|:-|:-| | systemd.serviceunitstate | active, inactive, activating, deactivating, failed | state | | systemd.socketunitstate | active, inactive, activating, deactivating, failed | state | | systemd.targetunitstate | active, inactive, activating, deactivating, failed | state | | systemd.pathunitstate | active, inactive, activating, deactivating, failed | state | | systemd.deviceunitstate | active, inactive, activating, deactivating, failed | state | | systemd.mountunitstate | active, inactive, activating, deactivating, failed | state | | systemd.automountunitstate | active, inactive, activating, deactivating, failed | state | | systemd.swapunitstate | active, inactive, activating, deactivating, failed | state | | systemd.timerunitstate | active, inactive, activating, deactivating, failed | state | | systemd.scopeunitstate | active, inactive, activating, deactivating, failed | state | | systemd.sliceunitstate | active, inactive, activating, deactivating, failed | state | These metrics refer to the systemd unit file. Labels: | Label | Description | |:--|:-| | unitfilename | systemd unit file name | | unitfiletype | systemd unit file type | Metrics: | Metric | Dimensions | Unit | |:|:-|:-| | systemd.unitfilestate | enabled, enabled-runtime, linked, linked-runtime, alias, masked, masked-runtime, static, disabled, indirect, generated, transient, bad | state | The following alerts are available: | Alert name | On metric | Description | |:|:-|:| | | systemd.serviceunitstate | systemd service unit in the failed state | | | systemd.socketunitstate | systemd socket unit in the failed state | | | systemd.targetunitstate | systemd target unit in the failed state | | | systemd.pathunitstate | systemd path unit in the failed state | | | systemd.deviceunitstate | systemd device unit in the failed state | | | systemd.mountunitstate | systemd mount unit in the failed state | | |

| systemd automount unit in the failed state | | | systemd.swapunitstate | systemd swap unit in the failed state | | | systemd.scopeunitstate | systemd scope unit in the failed state | | | systemd.sliceunitstate | systemd slice unit in the failed state | | | systemd.timerunitstate | systemd timer unit in the failed state | No action required. The configuration file name for this integration is `go.d/systemdunits.conf`. You can edit the configuration file using the `edit-config` script from the Netdata . ```bash cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata sudo ./edit-config go.d/systemdunits.conf ``` The following options can be defined globally: updateevery, autodetectionretry. <details><summary>Config options</summary> | Name | Description | Default | Required | |:-|:--|:-|:--:| | update_every | Data collection frequency. | 1 | no | | autodetection_retry | Recheck interval in seconds. Zero means no recheck will be scheduled. | 0 | no | | timeout | System bus requests timeout. | 1 | no | | include | Systemd units selector. | *.service | no | | collectunitfiles | If set to true, collect the state of installed unit files. Enabling this may increase system overhead. | false | no | | collectunitfiles_every | Interval for querying systemd about unit files and their enablement state, measured in seconds. Data is cached for this interval to reduce system overhead. | 300 | no | | includeunitfiles | Systemd unit files selector. | *.service | no | Systemd units matching the selector will be monitored. Logic: (pattern1 OR pattern2) Pattern syntax: Syntax: ```yaml includes: pattern1 pattern2 ``` Systemd unit files matching the selector will be monitored. Logic: (pattern1 OR pattern2) Pattern syntax: Syntax: ```yaml includes: pattern1 pattern2 ``` </details> Collect state of all service type units. <details><summary>Config</summary> ```yaml jobs: name: service include: '*.service' ``` </details> Collect state of one specific unit. <details><summary>Config</summary> ```yaml jobs: name: my-specific-service include: 'my-specific.service' ``` </details> Collect state of all units. <details><summary>Config</summary> ```yaml jobs: name: my-specific-service-unit include: '*' ``` </details> Note: When you define multiple jobs, their names must be unique. Collect state of all service and socket type units. <details><summary>Config</summary> ```yaml jobs: name: service include: '*.service' name: socket include: '*.socket' ``` </details> To troubleshoot issues with the `systemdunits` collector, run the `go.d.plugin` with the debug option enabled. The output should give you clues as to why the collector isn't working. Navigate to the `plugins.d` directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on your system, open `netdata.conf` and look for the `plugins` setting under `[directories]`. ```bash cd /usr/libexec/netdata/plugins.d/ ``` Switch to the `netdata` user. ```bash sudo -u netdata -s ``` Run the `go.d.plugin` to debug the collector: ```bash ./go.d.plugin -d -m systemdunits ```