github.com/netdata/go.d.plugin@v0.58.1/modules/systemdunits/integrations/systemd_units.md (about) 1 <!--startmeta 2 custom_edit_url: "https://github.com/netdata/go.d.plugin/edit/master/modules/systemdunits/README.md" 3 meta_yaml: "https://github.com/netdata/go.d.plugin/edit/master/modules/systemdunits/metadata.yaml" 4 sidebar_label: "Systemd Units" 5 learn_status: "Published" 6 learn_rel_path: "Data Collection/Systemd" 7 most_popular: False 8 message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE" 9 endmeta--> 10 11 # Systemd Units 12 13 14 <img src="https://netdata.cloud/img/systemd.svg" width="150"/> 15 16 17 Plugin: go.d.plugin 18 Module: systemdunits 19 20 <img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" /> 21 22 ## Overview 23 24 This collector monitors Systemd units state. 25 26 27 28 29 This collector is supported on all platforms. 30 31 This collector supports collecting metrics from multiple instances of this integration, including remote instances. 32 33 34 ### Default Behavior 35 36 #### Auto-Detection 37 38 This integration doesn't support auto-detection. 39 40 #### Limits 41 42 The default configuration for this integration does not impose any limits on data collection. 43 44 #### Performance Impact 45 46 The default configuration for this integration is not expected to impose a significant performance impact on the system. 47 48 49 ## Metrics 50 51 Metrics grouped by *scope*. 52 53 The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels. 54 55 56 57 ### Per unit 58 59 These metrics refer to the systemd unit. 60 61 Labels: 62 63 | Label | Description | 64 |:-----------|:----------------| 65 | unit_name | systemd unit name | 66 67 Metrics: 68 69 | Metric | Dimensions | Unit | 70 |:------|:----------|:----| 71 | systemd.service_unit_state | active, inactive, activating, deactivating, failed | state | 72 | systemd.socket_unit_state | active, inactive, activating, deactivating, failed | state | 73 | systemd.target_unit_state | active, inactive, activating, deactivating, failed | state | 74 | systemd.path_unit_state | active, inactive, activating, deactivating, failed | state | 75 | systemd.device_unit_state | active, inactive, activating, deactivating, failed | state | 76 | systemd.mount_unit_state | active, inactive, activating, deactivating, failed | state | 77 | systemd.automount_unit_state | active, inactive, activating, deactivating, failed | state | 78 | systemd.swap_unit_state | active, inactive, activating, deactivating, failed | state | 79 | systemd.timer_unit_state | active, inactive, activating, deactivating, failed | state | 80 | systemd.scope_unit_state | active, inactive, activating, deactivating, failed | state | 81 | systemd.slice_unit_state | active, inactive, activating, deactivating, failed | state | 82 83 84 85 ## Alerts 86 87 88 The following alerts are available: 89 90 | Alert name | On metric | Description | 91 |:------------|:----------|:------------| 92 | [ systemd_service_unit_failed_state ](https://github.com/netdata/netdata/blob/master/health/health.d/systemdunits.conf) | systemd.service_unit_state | systemd service unit in the failed state | 93 | [ systemd_socket_unit_failed_state ](https://github.com/netdata/netdata/blob/master/health/health.d/systemdunits.conf) | systemd.socket_unit_state | systemd socket unit in the failed state | 94 | [ systemd_target_unit_failed_state ](https://github.com/netdata/netdata/blob/master/health/health.d/systemdunits.conf) | systemd.target_unit_state | systemd target unit in the failed state | 95 | [ systemd_path_unit_failed_state ](https://github.com/netdata/netdata/blob/master/health/health.d/systemdunits.conf) | systemd.path_unit_state | systemd path unit in the failed state | 96 | [ systemd_device_unit_failed_state ](https://github.com/netdata/netdata/blob/master/health/health.d/systemdunits.conf) | systemd.device_unit_state | systemd device unit in the failed state | 97 | [ systemd_mount_unit_failed_state ](https://github.com/netdata/netdata/blob/master/health/health.d/systemdunits.conf) | systemd.mount_unit_state | systemd mount unit in the failed state | 98 | [ systemd_automount_unit_failed_state ](https://github.com/netdata/netdata/blob/master/health/health.d/systemdunits.conf) | systemd.automount_unit_state | systemd automount unit in the failed state | 99 | [ systemd_swap_unit_failed_state ](https://github.com/netdata/netdata/blob/master/health/health.d/systemdunits.conf) | systemd.swap_unit_state | systemd swap unit in the failed state | 100 | [ systemd_scope_unit_failed_state ](https://github.com/netdata/netdata/blob/master/health/health.d/systemdunits.conf) | systemd.scope_unit_state | systemd scope unit in the failed state | 101 | [ systemd_slice_unit_failed_state ](https://github.com/netdata/netdata/blob/master/health/health.d/systemdunits.conf) | systemd.slice_unit_state | systemd slice unit in the failed state | 102 103 104 ## Setup 105 106 ### Prerequisites 107 108 No action required. 109 110 ### Configuration 111 112 #### File 113 114 The configuration file name for this integration is `go.d/systemdunits.conf`. 115 116 117 You can edit the configuration file using the `edit-config` script from the 118 Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md#the-netdata-config-directory). 119 120 ```bash 121 cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata 122 sudo ./edit-config go.d/systemdunits.conf 123 ``` 124 #### Options 125 126 The following options can be defined globally: update_every, autodetection_retry. 127 128 129 <details><summary>Config options</summary> 130 131 | Name | Description | Default | Required | 132 |:----|:-----------|:-------|:--------:| 133 | update_every | Data collection frequency. | 1 | no | 134 | autodetection_retry | Recheck interval in seconds. Zero means no recheck will be scheduled. | 0 | no | 135 | include | Systemd units filter. | *.service | no | 136 | timeout | System bus requests timeout. | 1 | no | 137 138 ##### include 139 140 Systemd units matching the selector will be monitored. 141 142 - Logic: (pattern1 OR pattern2) 143 - Pattern syntax: [shell file name pattern](https://golang.org/pkg/path/filepath/#Match) 144 - Syntax: 145 146 ```yaml 147 includes: 148 - pattern1 149 - pattern2 150 ``` 151 152 153 </details> 154 155 #### Examples 156 157 ##### Service units 158 159 Collect state of all service type units. 160 161 <details><summary>Config</summary> 162 163 ```yaml 164 jobs: 165 - name: service 166 include: 167 - '*.service' 168 169 ``` 170 </details> 171 172 ##### One specific unit 173 174 Collect state of one specific unit. 175 176 <details><summary>Config</summary> 177 178 ```yaml 179 jobs: 180 - name: my-specific-service 181 include: 182 - 'my-specific.service' 183 184 ``` 185 </details> 186 187 ##### All unit types 188 189 Collect state of all units. 190 191 <details><summary>Config</summary> 192 193 ```yaml 194 jobs: 195 - name: my-specific-service-unit 196 include: 197 - '*' 198 199 ``` 200 </details> 201 202 ##### Multi-instance 203 204 > **Note**: When you define multiple jobs, their names must be unique. 205 206 Collect state of all service and socket type units. 207 208 209 <details><summary>Config</summary> 210 211 ```yaml 212 jobs: 213 - name: service 214 include: 215 - '*.service' 216 217 - name: socket 218 include: 219 - '*.socket' 220 221 ``` 222 </details> 223 224 225 226 ## Troubleshooting 227 228 ### Debug Mode 229 230 To troubleshoot issues with the `systemdunits` collector, run the `go.d.plugin` with the debug option enabled. The output 231 should give you clues as to why the collector isn't working. 232 233 - Navigate to the `plugins.d` directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on 234 your system, open `netdata.conf` and look for the `plugins` setting under `[directories]`. 235 236 ```bash 237 cd /usr/libexec/netdata/plugins.d/ 238 ``` 239 240 - Switch to the `netdata` user. 241 242 ```bash 243 sudo -u netdata -s 244 ``` 245 246 - Run the `go.d.plugin` to debug the collector: 247 248 ```bash 249 ./go.d.plugin -d -m systemdunits 250 ``` 251 252