github.com/netdata/go.d.plugin@v0.58.1/modules/docker/integrations/docker.md (about) 1 <!--startmeta 2 custom_edit_url: "https://github.com/netdata/go.d.plugin/edit/master/modules/docker/README.md" 3 meta_yaml: "https://github.com/netdata/go.d.plugin/edit/master/modules/docker/metadata.yaml" 4 sidebar_label: "Docker" 5 learn_status: "Published" 6 learn_rel_path: "Data Collection/Containers and VMs" 7 most_popular: True 8 message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE" 9 endmeta--> 10 11 # Docker 12 13 14 <img src="https://netdata.cloud/img/docker.svg" width="150"/> 15 16 17 Plugin: go.d.plugin 18 Module: docker 19 20 <img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" /> 21 22 ## Overview 23 24 This collector monitors Docker containers state, health status and more. 25 26 27 It connects to the Docker instance via a TCP or UNIX socket and executes the following commands: 28 29 - [System info](https://docs.docker.com/engine/api/v1.43/#tag/System/operation/SystemInfo). 30 - [List images](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageList). 31 - [List containers](https://docs.docker.com/engine/api/v1.43/#tag/Container/operation/ContainerList). 32 33 34 This collector is supported on all platforms. 35 36 This collector supports collecting metrics from multiple instances of this integration, including remote instances. 37 38 Requires netdata user to be in the docker group. 39 40 ### Default Behavior 41 42 #### Auto-Detection 43 44 It discovers instances running on localhost by attempting to connect to a known Docker UNIX socket: `/var/run/docker.sock`. 45 46 47 #### Limits 48 49 The default configuration for this integration does not impose any limits on data collection. 50 51 #### Performance Impact 52 53 Enabling `collect_container_size` may result in high CPU usage depending on the version of Docker Engine. 54 55 56 57 ## Metrics 58 59 Metrics grouped by *scope*. 60 61 The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels. 62 63 64 65 ### Per Docker instance 66 67 These metrics refer to the entire monitored application. 68 69 This scope has no labels. 70 71 Metrics: 72 73 | Metric | Dimensions | Unit | 74 |:------|:----------|:----| 75 | docker.containers_state | running, paused, stopped | containers | 76 | docker.containers_health_status | healthy, unhealthy, not_running_unhealthy, starting, no_healthcheck | containers | 77 | docker.images | active, dangling | images | 78 | docker.images_size | size | bytes | 79 80 ### Per container 81 82 Metrics related to containers. Each container provides its own set of the following metrics. 83 84 Labels: 85 86 | Label | Description | 87 |:-----------|:----------------| 88 | container_name | The container's name | 89 | image | The image name the container uses | 90 91 Metrics: 92 93 | Metric | Dimensions | Unit | 94 |:------|:----------|:----| 95 | docker.container_state | running, paused, exited, created, restarting, removing, dead | state | 96 | docker.container_health_status | healthy, unhealthy, not_running_unhealthy, starting, no_healthcheck | status | 97 | docker.container_writeable_layer_size | writeable_layer | size | 98 99 100 101 ## Alerts 102 103 104 The following alerts are available: 105 106 | Alert name | On metric | Description | 107 |:------------|:----------|:------------| 108 | [ docker_container_unhealthy ](https://github.com/netdata/netdata/blob/master/health/health.d/docker.conf) | docker.container_health_status | ${label:container_name} docker container health status is unhealthy | 109 110 111 ## Setup 112 113 ### Prerequisites 114 115 No action required. 116 117 ### Configuration 118 119 #### File 120 121 The configuration file name for this integration is `go.d/docker.conf`. 122 123 124 You can edit the configuration file using the `edit-config` script from the 125 Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md#the-netdata-config-directory). 126 127 ```bash 128 cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata 129 sudo ./edit-config go.d/docker.conf 130 ``` 131 #### Options 132 133 The following options can be defined globally: update_every, autodetection_retry. 134 135 136 <details><summary>Config options</summary> 137 138 | Name | Description | Default | Required | 139 |:----|:-----------|:-------|:--------:| 140 | update_every | Data collection frequency. | 1 | no | 141 | autodetection_retry | Recheck interval in seconds. Zero means no recheck will be scheduled. | 0 | no | 142 | address | Docker daemon's listening address. When using a TCP socket, the format is: tcp://[ip]:[port] | unix:///var/run/docker.sock | yes | 143 | timeout | Request timeout in seconds. | 1 | no | 144 | collect_container_size | Whether to collect container writable layer size. | no | no | 145 146 </details> 147 148 #### Examples 149 150 ##### Basic 151 152 An example configuration. 153 154 ```yaml 155 jobs: 156 - name: local 157 address: 'unix:///var/run/docker.sock' 158 159 ``` 160 ##### Multi-instance 161 162 > **Note**: When you define multiple jobs, their names must be unique. 163 164 Collecting metrics from local and remote instances. 165 166 167 <details><summary>Config</summary> 168 169 ```yaml 170 jobs: 171 - name: local 172 address: 'unix:///var/run/docker.sock' 173 174 - name: remote 175 address: 'tcp://203.0.113.10:2375' 176 177 ``` 178 </details> 179 180 181 182 ## Troubleshooting 183 184 ### Debug Mode 185 186 To troubleshoot issues with the `docker` collector, run the `go.d.plugin` with the debug option enabled. The output 187 should give you clues as to why the collector isn't working. 188 189 - Navigate to the `plugins.d` directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on 190 your system, open `netdata.conf` and look for the `plugins` setting under `[directories]`. 191 192 ```bash 193 cd /usr/libexec/netdata/plugins.d/ 194 ``` 195 196 - Switch to the `netdata` user. 197 198 ```bash 199 sudo -u netdata -s 200 ``` 201 202 - Run the `go.d.plugin` to debug the collector: 203 204 ```bash 205 ./go.d.plugin -d -m docker 206 ``` 207 208