├── chapter13 ├── docker-wordpress │ ├── wordpress │ │ ├── .gitkeep │ │ └── nginx.conf │ ├── .gitignore │ └── docker-compose.yml └── prometheus │ ├── .gitignore │ ├── grafana │ ├── grafana.config │ └── provisioning │ │ ├── dashboards │ │ ├── dashboards.yml │ │ └── Docker Monitoring.json │ │ └── datasources │ │ └── datasource.yml │ ├── README.md │ ├── prometheus │ └── prometheus.yml │ └── docker-compose.yml ├── README.md ├── chapter02 ├── scratch-example │ ├── Dockerfile │ └── files │ │ └── alpine-minirootfs-3.8.0-x86_64.tar.gz ├── dockerfile-example │ ├── files │ │ ├── default.conf │ │ ├── html.tar.gz │ │ └── nginx.conf │ └── Dockerfile ├── multi-stage │ └── Dockerfile ├── env-example │ └── Dockerfile └── consul-example │ └── Dockerfile ├── chapter09 └── stack │ ├── docker-compose.yml │ ├── cluster-pod.yaml │ └── cluster-service.yaml ├── chapter08 └── stack │ └── docker-compose.yml ├── chapter05 ├── mobycounter │ └── docker-compose.yml └── mobycounter-app │ ├── docker-compose.yml │ ├── mobycounter.dockerapp │ └── mobycounter.dockerapp.original ├── chapter12 └── sshd │ └── Dockerfile ├── .gitmodules ├── LICENSE └── chapter06 └── Dockerfile /chapter13/docker-wordpress/wordpress/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter13/prometheus/.gitignore: -------------------------------------------------------------------------------- 1 | docker-compose.png 2 | .cache -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mastering-Docker-Third-Edition 2 | Mastering Docker Third Edition, published by Packt 3 | -------------------------------------------------------------------------------- /chapter02/scratch-example/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM scratch 2 | ADD files/alpine-minirootfs-3.8.0-x86_64.tar.gz / 3 | CMD ["/bin/sh"] -------------------------------------------------------------------------------- /chapter13/docker-wordpress/.gitignore: -------------------------------------------------------------------------------- 1 | docker-compose.png 2 | wordpress/mysql 3 | wordpress/web 4 | wordpress/export 5 | .cache -------------------------------------------------------------------------------- /chapter02/dockerfile-example/files/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | location / { 3 | root /usr/share/nginx/html; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /chapter13/prometheus/grafana/grafana.config: -------------------------------------------------------------------------------- 1 | GF_SECURITY_ADMIN_USER=admin 2 | GF_SECURITY_ADMIN_PASSWORD=password 3 | GF_USERS_ALLOW_SIGN_UP=false -------------------------------------------------------------------------------- /chapter02/dockerfile-example/files/html.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Mastering-Docker-Third-Edition/HEAD/chapter02/dockerfile-example/files/html.tar.gz -------------------------------------------------------------------------------- /chapter02/scratch-example/files/alpine-minirootfs-3.8.0-x86_64.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PacktPublishing/Mastering-Docker-Third-Edition/HEAD/chapter02/scratch-example/files/alpine-minirootfs-3.8.0-x86_64.tar.gz -------------------------------------------------------------------------------- /chapter09/stack/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | cluster: 4 | image: russmckendrick/cluster 5 | ports: 6 | - "80:80" 7 | deploy: 8 | replicas: 6 9 | restart_policy: 10 | condition: on-failure -------------------------------------------------------------------------------- /chapter13/prometheus/grafana/provisioning/dashboards/dashboards.yml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | providers: 4 | - name: 'Prometheus' 5 | orgId: 1 6 | folder: '' 7 | type: file 8 | disableDeletion: false 9 | editable: true 10 | options: 11 | path: /etc/grafana/provisioning/dashboards -------------------------------------------------------------------------------- /chapter08/stack/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | cluster: 4 | image: russmckendrick/cluster 5 | ports: 6 | - "80:80" 7 | deploy: 8 | replicas: 6 9 | restart_policy: 10 | condition: on-failure 11 | placement: 12 | constraints: 13 | - node.role == worker 14 | -------------------------------------------------------------------------------- /chapter13/prometheus/README.md: -------------------------------------------------------------------------------- 1 | Use the following command to configure the Prometheus endpoint in Grafana; 2 | 3 | ``` 4 | curl 'http://admin:password@localhost:3000/api/datasources' -X POST -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"name":"Prometheus","type":"prometheus","url":"http://prometheus:9090","access":"proxy","isDefault":true}' 5 | ``` -------------------------------------------------------------------------------- /chapter09/stack/cluster-pod.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | creationTimestamp: null 5 | labels: 6 | io.kompose.service: cluster 7 | name: cluster 8 | spec: 9 | containers: 10 | - image: russmckendrick/cluster 11 | name: cluster 12 | ports: 13 | - containerPort: 80 14 | resources: {} 15 | restartPolicy: OnFailure 16 | status: {} 17 | -------------------------------------------------------------------------------- /chapter05/mobycounter/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | redis: 5 | image: redis:alpine 6 | volumes: 7 | - redis_data:/data 8 | restart: always 9 | mobycounter: 10 | depends_on: 11 | - redis 12 | image: russmckendrick/moby-counter 13 | ports: 14 | - "8080:80" 15 | restart: always 16 | 17 | volumes: 18 | redis_data: -------------------------------------------------------------------------------- /chapter05/mobycounter-app/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.6" 2 | 3 | services: 4 | redis: 5 | image: redis:alpine 6 | volumes: 7 | - redis_data:/data 8 | restart: always 9 | mobycounter: 10 | depends_on: 11 | - redis 12 | image: russmckendrick/moby-counter 13 | ports: 14 | - "8080:80" 15 | restart: always 16 | 17 | volumes: 18 | redis_data: -------------------------------------------------------------------------------- /chapter02/multi-stage/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:latest as builder 2 | WORKDIR /go-http-hello-world/ 3 | RUN go get -d -v golang.org/x/net/html 4 | ADD https://raw.githubusercontent.com/geetarista/go-http-hello-world/master/hello_world/hello_world.go ./hello_world.go 5 | RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . 6 | 7 | FROM scratch 8 | COPY --from=builder /go-http-hello-world/app . 9 | CMD ["./app"] -------------------------------------------------------------------------------- /chapter13/prometheus/prometheus/prometheus.yml: -------------------------------------------------------------------------------- 1 | global: 2 | scrape_interval: 15s 3 | evaluation_interval: 15s 4 | external_labels: 5 | monitor: 'monitoring' 6 | 7 | rule_files: 8 | 9 | scrape_configs: 10 | 11 | - job_name: 'prometheus' 12 | static_configs: 13 | - targets: ['localhost:9090'] 14 | 15 | - job_name: 'cadvisor' 16 | static_configs: 17 | - targets: ['cadvisor:8080'] -------------------------------------------------------------------------------- /chapter09/stack/cluster-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | annotations: 5 | kompose.cmd: kompose convert 6 | kompose.version: 1.16.0 (0c01309) 7 | creationTimestamp: null 8 | labels: 9 | io.kompose.service: cluster 10 | name: cluster 11 | spec: 12 | ports: 13 | - name: "80" 14 | port: 80 15 | targetPort: 80 16 | selector: 17 | io.kompose.service: cluster 18 | status: 19 | loadBalancer: {} 20 | -------------------------------------------------------------------------------- /chapter12/sshd/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get update && apt-get install -y openssh-server 4 | RUN mkdir /var/run/sshd 5 | RUN echo 'root:screencast' | chpasswd 6 | RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config 7 | RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd 8 | ENV NOTVISIBLE "in users profile" 9 | RUN echo "export VISIBLE=now" >> /etc/profile 10 | EXPOSE 22 11 | CMD ["/usr/sbin/sshd", "-D"] -------------------------------------------------------------------------------- /chapter02/dockerfile-example/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:latest 2 | LABEL maintainer="Russ McKendrick " 3 | LABEL description="This example Dockerfile installs NGINX." 4 | RUN apk add --update nginx && \ 5 | rm -rf /var/cache/apk/* && \ 6 | mkdir -p /tmp/nginx/ 7 | 8 | COPY files/nginx.conf /etc/nginx/nginx.conf 9 | COPY files/default.conf /etc/nginx/conf.d/default.conf 10 | ADD files/html.tar.gz /usr/share/nginx/ 11 | 12 | EXPOSE 80/tcp 13 | 14 | ENTRYPOINT ["nginx"] 15 | CMD ["-g", "daemon off;"] -------------------------------------------------------------------------------- /chapter13/docker-wordpress/wordpress/nginx.conf: -------------------------------------------------------------------------------- 1 | server { 2 | server_name _; 3 | listen 80 default_server; 4 | 5 | root /var/www/html; 6 | index index.php index.html; 7 | 8 | access_log /dev/stdout; 9 | error_log /dev/stdout info; 10 | 11 | location / { 12 | try_files $uri $uri/ /index.php?$args; 13 | } 14 | 15 | location ~ .php$ { 16 | include fastcgi_params; 17 | fastcgi_pass wordpress:9000; 18 | fastcgi_index index.php; 19 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 20 | fastcgi_buffers 16 16k; 21 | fastcgi_buffer_size 32k; 22 | } 23 | } -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "chapter05/example-voting-app"] 2 | path = chapter05/example-voting-app 3 | url = https://github.com/dockersamples/example-voting-app.git 4 | [submodule "chapter06/windows-docker-machine"] 5 | path = chapter06/windows-docker-machine 6 | url = git@github.com:StefanScherer/windows-docker-machine.git 7 | [submodule "chapter06/dotnet-musicstore"] 8 | path = chapter06/dotnet-musicstore 9 | url = git@github.com:dockersamples/dotnet-musicstore.git 10 | [submodule "chapter06/dotnet-album-viewer"] 11 | path = chapter06/dotnet-album-viewer 12 | url = git@github.com:dockersamples/dotnet-album-viewer.git 13 | -------------------------------------------------------------------------------- /chapter02/env-example/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.8 2 | LABEL maintainer="Russ McKendrick " 3 | LABEL description="This example Dockerfile installs Apache & PHP." 4 | ENV PHPVERSION 7 5 | 6 | RUN apk add --update apache2 php${PHPVERSION}-apache2 php${PHPVERSION} && \ 7 | rm -rf /var/cache/apk/* && \ 8 | mkdir /run/apache2/ && \ 9 | rm -rf /var/www/localhost/htdocs/index.html && \ 10 | echo "" > /var/www/localhost/htdocs/index.php && \ 11 | chmod 755 /var/www/localhost/htdocs/index.php 12 | 13 | EXPOSE 80/tcp 14 | 15 | ENTRYPOINT ["httpd"] 16 | CMD ["-D", "FOREGROUND"] 17 | -------------------------------------------------------------------------------- /chapter02/dockerfile-example/files/nginx.conf: -------------------------------------------------------------------------------- 1 | user nginx; 2 | worker_processes 1; 3 | 4 | error_log /var/log/nginx/error.log warn; 5 | pid /var/run/nginx.pid; 6 | 7 | events { 8 | worker_connections 1024; 9 | } 10 | 11 | http { 12 | include /etc/nginx/mime.types; 13 | default_type application/octet-stream; 14 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 15 | '$status $body_bytes_sent "$http_referer" ' 16 | '"$http_user_agent" "$http_x_forwarded_for"'; 17 | access_log /var/log/nginx/access.log main; 18 | sendfile off; 19 | keepalive_timeout 65; 20 | include /etc/nginx/conf.d/*.conf; 21 | } -------------------------------------------------------------------------------- /chapter05/mobycounter-app/mobycounter.dockerapp: -------------------------------------------------------------------------------- 1 | version: latest 2 | name: mobycounter 3 | description: An example Docker App file which packages up the Moby Counter application 4 | namespace: masteringdockerthirdedition 5 | maintainers: 6 | - name: Russ McKendrick 7 | email: russ@mckendrick.io 8 | 9 | --- 10 | version: "3.6" 11 | 12 | services: 13 | redis: 14 | image: redis:alpine 15 | volumes: 16 | - redis_data:/data 17 | restart: always 18 | mobycounter: 19 | depends_on: 20 | - redis 21 | image: russmckendrick/moby-counter 22 | ports: 23 | - "${port}:80" 24 | restart: always 25 | 26 | volumes: 27 | redis_data: 28 | 29 | --- 30 | 31 | { "port":"8080" } 32 | -------------------------------------------------------------------------------- /chapter02/consul-example/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:latest 2 | LABEL maintainer="Russ McKendrick " 3 | LABEL description="An image with the latest version on Consul." 4 | 5 | ENV CONSUL_VERSION 1.2.2 6 | ENV CONSUL_SHA256 7fa3b287b22b58283b8bd5479291161af2badbc945709eb5412840d91b912060 7 | 8 | RUN apk add --update ca-certificates wget && \ 9 | wget -O consul.zip https://releases.hashicorp.com/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_linux_amd64.zip && \ 10 | echo "$CONSUL_SHA256 *consul.zip" | sha256sum -c - && \ 11 | unzip consul.zip && \ 12 | mv consul /bin/ && \ 13 | rm -rf consul.zip && \ 14 | rm -rf /tmp/* /var/cache/apk/* 15 | 16 | EXPOSE 8300 8301 8301/udp 8302 8302/udp 8400 8500 8600 8600/udp 17 | 18 | VOLUME [ "/data" ] 19 | 20 | ENTRYPOINT [ "/bin/consul" ] 21 | CMD [ "agent", "-data-dir", "/data", "-server", "-bootstrap-expect", "1", "-client=0.0.0.0"] -------------------------------------------------------------------------------- /chapter13/docker-wordpress/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | web: 5 | image: nginx:alpine 6 | ports: 7 | - "8080:80" 8 | volumes: 9 | - "./wordpress/web:/var/www/html" 10 | - "./wordpress/nginx.conf:/etc/nginx/conf.d/default.conf" 11 | depends_on: 12 | - wordpress 13 | wordpress: 14 | image: wordpress:php7.2-fpm-alpine 15 | volumes: 16 | - "./wordpress/web:/var/www/html" 17 | depends_on: 18 | - mysql 19 | mysql: 20 | image: mysql:5 21 | environment: 22 | MYSQL_ROOT_PASSWORD: "wordpress" 23 | MYSQL_USER: "wordpress" 24 | MYSQL_PASSWORD: "wordpress" 25 | MYSQL_DATABASE: "wordpress" 26 | volumes: 27 | - "./wordpress/mysql:/var/lib/mysql" 28 | wp: 29 | image: wordpress:cli-2-php7.2 30 | volumes: 31 | - "./wordpress/web:/var/www/html" 32 | - "./wordpress/export:/export" -------------------------------------------------------------------------------- /chapter05/mobycounter-app/mobycounter.dockerapp.original: -------------------------------------------------------------------------------- 1 | # This section contains your application metadata. 2 | # Version of the application 3 | version: 0.1.0 4 | # Name of the application 5 | name: mobycounter 6 | # A short description of the application 7 | description: 8 | # Namespace to use when pushing to a registry. This is typically your Hub username. 9 | #namespace: myHubUsername 10 | # List of application maintainers with name and email for each 11 | maintainers: 12 | - name: russ 13 | email: 14 | 15 | --- 16 | # This section contains the Compose file that describes your application services. 17 | version: "3.6" 18 | 19 | services: 20 | redis: 21 | image: redis:alpine 22 | volumes: 23 | - redis_data:/data 24 | restart: always 25 | mobycounter: 26 | depends_on: 27 | - redis 28 | image: russmckendrick/moby-counter 29 | ports: 30 | - "8080:80" 31 | restart: always 32 | 33 | volumes: 34 | redis_data: 35 | --- 36 | # This section contains the default values for your application settings. 37 | {} 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Packt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /chapter13/prometheus/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | 5 | cadvisor: 6 | image: google/cadvisor:latest 7 | container_name: cadvisor 8 | volumes: 9 | - /:/rootfs:ro 10 | - /var/run:/var/run:rw 11 | - /sys:/sys:ro 12 | - /var/lib/docker/:/var/lib/docker:ro 13 | restart: unless-stopped 14 | expose: 15 | - 8080 16 | networks: 17 | - back 18 | 19 | prometheus: 20 | image: prom/prometheus 21 | container_name: prometheus 22 | volumes: 23 | - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml 24 | - prometheus_data:/prometheus 25 | restart: unless-stopped 26 | expose: 27 | - 9090 28 | depends_on: 29 | - cadvisor 30 | networks: 31 | - back 32 | 33 | grafana: 34 | image: grafana/grafana 35 | container_name: grafana 36 | volumes: 37 | - grafana_data:/var/lib/grafana 38 | - ./grafana/provisioning/:/etc/grafana/provisioning/ 39 | env_file: 40 | - ./grafana/grafana.config 41 | restart: unless-stopped 42 | ports: 43 | - 3000:3000 44 | depends_on: 45 | - prometheus 46 | networks: 47 | - front 48 | - back 49 | 50 | volumes: 51 | prometheus_data: 52 | grafana_data: 53 | 54 | networks: 55 | front: 56 | back: -------------------------------------------------------------------------------- /chapter06/Dockerfile: -------------------------------------------------------------------------------- 1 | # escape=` 2 | FROM microsoft/nanoserver:sac2016 3 | 4 | RUN powershell -NoProfile -Command ` 5 | New-Item -Type Directory C:\install; ` 6 | Invoke-WebRequest https://az880830.vo.msecnd.net/nanoserver-ga-2016/Microsoft-NanoServer-IIS-Package_base_10-0-14393-0.cab -OutFile C:\install\Microsoft-NanoServer-IIS-Package_base_10-0-14393-0.cab; ` 7 | Invoke-WebRequest https://az880830.vo.msecnd.net/nanoserver-ga-2016/Microsoft-NanoServer-IIS-Package_English_10-0-14393-0.cab -OutFile C:\install\Microsoft-NanoServer-IIS-Package_English_10-0-14393-0.cab; ` 8 | dism.exe /online /add-package /packagepath:c:\install\Microsoft-NanoServer-IIS-Package_base_10-0-14393-0.cab & ` 9 | dism.exe /online /add-package /packagepath:c:\install\Microsoft-NanoServer-IIS-Package_English_10-0-14393-0.cab & ` 10 | dism.exe /online /add-package /packagepath:c:\install\Microsoft-NanoServer-IIS-Package_base_10-0-14393-0.cab & ;` 11 | powershell -NoProfile -Command ` 12 | Remove-Item -Recurse C:\install\ ; ` 13 | Invoke-WebRequest https://dotnetbinaries.blob.core.windows.net/servicemonitor/2.0.1.3/ServiceMonitor.exe -OutFile C:\ServiceMonitor.exe; ` 14 | Start-Service Was; ` 15 | While ((Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Services\WAS\Parameters\ -Name NanoSetup -ErrorAction Ignore) -ne $null) {Start-Sleep 1} 16 | 17 | EXPOSE 80 18 | 19 | ENTRYPOINT ["C:\\ServiceMonitor.exe", "w3svc"] -------------------------------------------------------------------------------- /chapter13/prometheus/grafana/provisioning/datasources/datasource.yml: -------------------------------------------------------------------------------- 1 | # config file version 2 | apiVersion: 1 3 | 4 | # list of datasources that should be deleted from the database 5 | deleteDatasources: 6 | - name: Prometheus 7 | orgId: 1 8 | 9 | # list of datasources to insert/update depending 10 | # whats available in the database 11 | datasources: 12 | # name of the datasource. Required 13 | - name: Prometheus 14 | # datasource type. Required 15 | type: prometheus 16 | # access mode. direct or proxy. Required 17 | access: proxy 18 | # org id. will default to orgId 1 if not specified 19 | orgId: 1 20 | # url 21 | url: http://prometheus:9090 22 | # database password, if used 23 | password: 24 | # database user, if used 25 | user: 26 | # database name, if used 27 | database: 28 | # enable/disable basic auth 29 | basicAuth: true 30 | # basic auth username 31 | basicAuthUser: admin 32 | # basic auth password 33 | basicAuthPassword: password 34 | # enable/disable with credentials headers 35 | withCredentials: 36 | # mark as default datasource. Max one per org 37 | isDefault: true 38 | # fields that will be converted to json and stored in json_data 39 | jsonData: 40 | graphiteVersion: "1.1" 41 | tlsAuth: false 42 | tlsAuthWithCACert: false 43 | # json object of data that will be encrypted. 44 | secureJsonData: 45 | tlsCACert: "..." 46 | tlsClientCert: "..." 47 | tlsClientKey: "..." 48 | version: 1 49 | # allow users to edit datasources from the UI. 50 | editable: true 51 | -------------------------------------------------------------------------------- /chapter13/prometheus/grafana/provisioning/dashboards/Docker Monitoring.json: -------------------------------------------------------------------------------- 1 | { 2 | "__inputs": [ 3 | { 4 | "name": "Prometheus", 5 | "label": "Prometheus", 6 | "description": "", 7 | "type": "datasource", 8 | "pluginId": "prometheus", 9 | "pluginName": "Prometheus" 10 | } 11 | ], 12 | "__requires": [ 13 | { 14 | "type": "grafana", 15 | "id": "grafana", 16 | "name": "Grafana", 17 | "version": "5.2.2" 18 | }, 19 | { 20 | "type": "panel", 21 | "id": "graph", 22 | "name": "Graph", 23 | "version": "5.0.0" 24 | }, 25 | { 26 | "type": "datasource", 27 | "id": "prometheus", 28 | "name": "Prometheus", 29 | "version": "5.0.0" 30 | }, 31 | { 32 | "type": "panel", 33 | "id": "singlestat", 34 | "name": "Singlestat", 35 | "version": "5.0.0" 36 | }, 37 | { 38 | "type": "panel", 39 | "id": "table", 40 | "name": "Table", 41 | "version": "5.0.0" 42 | } 43 | ], 44 | "annotations": { 45 | "list": [ 46 | { 47 | "builtIn": 1, 48 | "datasource": "-- Grafana --", 49 | "enable": true, 50 | "hide": true, 51 | "iconColor": "rgba(0, 211, 255, 1)", 52 | "name": "Annotations & Alerts", 53 | "type": "dashboard" 54 | } 55 | ] 56 | }, 57 | "description": "Docker Monitoring Template", 58 | "editable": true, 59 | "gnetId": 893, 60 | "graphTooltip": 1, 61 | "id": 1, 62 | "iteration": 1538856575908, 63 | "links": [], 64 | "panels": [ 65 | { 66 | "cacheTimeout": null, 67 | "colorBackground": false, 68 | "colorValue": false, 69 | "colors": [ 70 | "rgba(245, 54, 54, 0.9)", 71 | "rgba(237, 129, 40, 0.89)", 72 | "rgba(50, 172, 45, 0.97)" 73 | ], 74 | "datasource": "Prometheus", 75 | "editable": true, 76 | "error": false, 77 | "format": "none", 78 | "gauge": { 79 | "maxValue": 100, 80 | "minValue": 0, 81 | "show": false, 82 | "thresholdLabels": false, 83 | "thresholdMarkers": true 84 | }, 85 | "gridPos": { 86 | "h": 4, 87 | "w": 8, 88 | "x": 0, 89 | "y": 0 90 | }, 91 | "id": 31, 92 | "interval": null, 93 | "links": [], 94 | "mappingType": 1, 95 | "mappingTypes": [ 96 | { 97 | "name": "value to text", 98 | "value": 1 99 | }, 100 | { 101 | "name": "range to text", 102 | "value": 2 103 | } 104 | ], 105 | "maxDataPoints": 100, 106 | "nullPointMode": "connected", 107 | "nullText": null, 108 | "postfix": "", 109 | "postfixFontSize": "50%", 110 | "prefix": "", 111 | "prefixFontSize": "50%", 112 | "rangeMaps": [ 113 | { 114 | "from": "null", 115 | "text": "N/A", 116 | "to": "null" 117 | } 118 | ], 119 | "sparkline": { 120 | "fillColor": "rgba(31, 118, 189, 0.18)", 121 | "full": false, 122 | "lineColor": "rgb(31, 120, 193)", 123 | "show": false 124 | }, 125 | "tableColumn": "", 126 | "targets": [ 127 | { 128 | "expr": "count(rate(container_last_seen{name=~\".+\"}[$interval]))", 129 | "format": "time_series", 130 | "intervalFactor": 2, 131 | "refId": "A", 132 | "step": 1800 133 | } 134 | ], 135 | "thresholds": "", 136 | "title": "Containers", 137 | "type": "singlestat", 138 | "valueFontSize": "120%", 139 | "valueMaps": [ 140 | { 141 | "op": "=", 142 | "text": "N/A", 143 | "value": "null" 144 | } 145 | ], 146 | "valueName": "current" 147 | }, 148 | { 149 | "aliasColors": {}, 150 | "bars": false, 151 | "dashLength": 10, 152 | "dashes": false, 153 | "datasource": "Prometheus", 154 | "editable": true, 155 | "error": false, 156 | "fill": 5, 157 | "grid": {}, 158 | "gridPos": { 159 | "h": 10, 160 | "w": 16, 161 | "x": 8, 162 | "y": 0 163 | }, 164 | "id": 1, 165 | "legend": { 166 | "alignAsTable": true, 167 | "avg": false, 168 | "current": false, 169 | "max": false, 170 | "min": false, 171 | "rightSide": true, 172 | "show": true, 173 | "total": false, 174 | "values": false 175 | }, 176 | "lines": true, 177 | "linewidth": 1, 178 | "links": [], 179 | "nullPointMode": "null as zero", 180 | "percentage": false, 181 | "pointradius": 5, 182 | "points": false, 183 | "renderer": "flot", 184 | "seriesOverrides": [], 185 | "spaceLength": 10, 186 | "stack": true, 187 | "steppedLine": false, 188 | "targets": [ 189 | { 190 | "expr": "sum(rate(container_cpu_usage_seconds_total{name=~\".+\"}[$interval])) by (name) * 100", 191 | "hide": false, 192 | "interval": "", 193 | "intervalFactor": 2, 194 | "legendFormat": "{{name}}", 195 | "metric": "", 196 | "refId": "F", 197 | "step": 240 198 | } 199 | ], 200 | "thresholds": [], 201 | "timeFrom": null, 202 | "timeShift": null, 203 | "title": "CPU Usage per Container", 204 | "tooltip": { 205 | "msResolution": true, 206 | "shared": true, 207 | "sort": 0, 208 | "value_type": "individual" 209 | }, 210 | "type": "graph", 211 | "xaxis": { 212 | "buckets": null, 213 | "mode": "time", 214 | "name": null, 215 | "show": true, 216 | "values": [] 217 | }, 218 | "yaxes": [ 219 | { 220 | "format": "percent", 221 | "label": "", 222 | "logBase": 1, 223 | "max": null, 224 | "show": true 225 | }, 226 | { 227 | "format": "short", 228 | "label": null, 229 | "logBase": 1, 230 | "max": null, 231 | "min": null, 232 | "show": false 233 | } 234 | ], 235 | "yaxis": { 236 | "align": false, 237 | "alignLevel": null 238 | } 239 | }, 240 | { 241 | "aliasColors": { 242 | "SENT": "#BF1B00" 243 | }, 244 | "bars": false, 245 | "dashLength": 10, 246 | "dashes": false, 247 | "datasource": "Prometheus", 248 | "editable": true, 249 | "error": false, 250 | "fill": 1, 251 | "grid": {}, 252 | "gridPos": { 253 | "h": 6, 254 | "w": 4, 255 | "x": 0, 256 | "y": 4 257 | }, 258 | "id": 19, 259 | "legend": { 260 | "avg": false, 261 | "current": false, 262 | "max": false, 263 | "min": false, 264 | "show": false, 265 | "total": false, 266 | "values": false 267 | }, 268 | "lines": true, 269 | "linewidth": 1, 270 | "links": [], 271 | "nullPointMode": "null as zero", 272 | "percentage": false, 273 | "pointradius": 1, 274 | "points": false, 275 | "renderer": "flot", 276 | "seriesOverrides": [], 277 | "spaceLength": 10, 278 | "stack": false, 279 | "steppedLine": false, 280 | "targets": [ 281 | { 282 | "expr": "sum(rate(container_network_receive_bytes_total{id=\"/\"}[$interval])) by (id)", 283 | "intervalFactor": 2, 284 | "legendFormat": "RECEIVED", 285 | "refId": "A", 286 | "step": 600 287 | }, 288 | { 289 | "expr": "- sum(rate(container_network_transmit_bytes_total{id=\"/\"}[$interval])) by (id)", 290 | "hide": false, 291 | "intervalFactor": 2, 292 | "legendFormat": "SENT", 293 | "refId": "B", 294 | "step": 600 295 | } 296 | ], 297 | "thresholds": [], 298 | "timeFrom": null, 299 | "timeShift": null, 300 | "title": "Network Traffic", 301 | "tooltip": { 302 | "msResolution": true, 303 | "shared": true, 304 | "sort": 0, 305 | "value_type": "cumulative" 306 | }, 307 | "transparent": false, 308 | "type": "graph", 309 | "xaxis": { 310 | "buckets": null, 311 | "mode": "time", 312 | "name": null, 313 | "show": false, 314 | "values": [] 315 | }, 316 | "yaxes": [ 317 | { 318 | "format": "bytes", 319 | "label": null, 320 | "logBase": 1, 321 | "max": null, 322 | "min": null, 323 | "show": true 324 | }, 325 | { 326 | "format": "short", 327 | "label": null, 328 | "logBase": 1, 329 | "max": null, 330 | "min": null, 331 | "show": false 332 | } 333 | ], 334 | "yaxis": { 335 | "align": false, 336 | "alignLevel": null 337 | } 338 | }, 339 | { 340 | "aliasColors": { 341 | "{id=\"/\",instance=\"cadvisor:8080\",job=\"prometheus\"}": "#BA43A9" 342 | }, 343 | "bars": false, 344 | "dashLength": 10, 345 | "dashes": false, 346 | "datasource": "Prometheus", 347 | "editable": true, 348 | "error": false, 349 | "fill": 1, 350 | "grid": {}, 351 | "gridPos": { 352 | "h": 6, 353 | "w": 4, 354 | "x": 4, 355 | "y": 4 356 | }, 357 | "id": 5, 358 | "legend": { 359 | "avg": false, 360 | "current": false, 361 | "max": false, 362 | "min": false, 363 | "show": false, 364 | "total": false, 365 | "values": false 366 | }, 367 | "lines": true, 368 | "linewidth": 1, 369 | "links": [], 370 | "nullPointMode": "null as zero", 371 | "percentage": false, 372 | "pointradius": 5, 373 | "points": false, 374 | "renderer": "flot", 375 | "seriesOverrides": [], 376 | "spaceLength": 10, 377 | "stack": true, 378 | "steppedLine": false, 379 | "targets": [ 380 | { 381 | "expr": "sum(rate(container_cpu_system_seconds_total[1m]))", 382 | "hide": true, 383 | "intervalFactor": 2, 384 | "legendFormat": "a", 385 | "refId": "B", 386 | "step": 120 387 | }, 388 | { 389 | "expr": "sum(rate(container_cpu_system_seconds_total{name=~\".+\"}[1m]))", 390 | "hide": true, 391 | "interval": "", 392 | "intervalFactor": 2, 393 | "legendFormat": "nur container", 394 | "refId": "F", 395 | "step": 10 396 | }, 397 | { 398 | "expr": "sum(rate(container_cpu_system_seconds_total{id=\"/\"}[1m]))", 399 | "hide": true, 400 | "interval": "", 401 | "intervalFactor": 2, 402 | "legendFormat": "nur docker host", 403 | "metric": "", 404 | "refId": "A", 405 | "step": 20 406 | }, 407 | { 408 | "expr": "sum(rate(process_cpu_seconds_total[$interval])) * 100", 409 | "hide": false, 410 | "interval": "", 411 | "intervalFactor": 2, 412 | "legendFormat": "host", 413 | "metric": "", 414 | "refId": "C", 415 | "step": 600 416 | }, 417 | { 418 | "expr": "sum(rate(container_cpu_system_seconds_total{name=~\".+\"}[1m])) + sum(rate(container_cpu_system_seconds_total{id=\"/\"}[1m])) + sum(rate(process_cpu_seconds_total[1m]))", 419 | "hide": true, 420 | "intervalFactor": 2, 421 | "legendFormat": "", 422 | "refId": "D", 423 | "step": 120 424 | } 425 | ], 426 | "thresholds": [], 427 | "timeFrom": null, 428 | "timeShift": null, 429 | "title": "CPU Usage", 430 | "tooltip": { 431 | "msResolution": true, 432 | "shared": true, 433 | "sort": 0, 434 | "value_type": "cumulative" 435 | }, 436 | "type": "graph", 437 | "xaxis": { 438 | "buckets": null, 439 | "mode": "time", 440 | "name": null, 441 | "show": false, 442 | "values": [] 443 | }, 444 | "yaxes": [ 445 | { 446 | "format": "percent", 447 | "label": "", 448 | "logBase": 1, 449 | "max": null, 450 | "min": null, 451 | "show": true 452 | }, 453 | { 454 | "format": "short", 455 | "label": null, 456 | "logBase": 1, 457 | "max": null, 458 | "min": null, 459 | "show": false 460 | } 461 | ], 462 | "yaxis": { 463 | "align": false, 464 | "alignLevel": null 465 | } 466 | }, 467 | { 468 | "aliasColors": {}, 469 | "bars": false, 470 | "dashLength": 10, 471 | "dashes": false, 472 | "datasource": "Prometheus", 473 | "editable": true, 474 | "error": false, 475 | "fill": 1, 476 | "grid": {}, 477 | "gridPos": { 478 | "h": 7, 479 | "w": 12, 480 | "x": 0, 481 | "y": 10 482 | }, 483 | "id": 8, 484 | "legend": { 485 | "alignAsTable": true, 486 | "avg": false, 487 | "current": false, 488 | "max": false, 489 | "min": false, 490 | "rightSide": true, 491 | "show": true, 492 | "total": false, 493 | "values": false 494 | }, 495 | "lines": true, 496 | "linewidth": 2, 497 | "links": [], 498 | "nullPointMode": "null as zero", 499 | "percentage": false, 500 | "pointradius": 5, 501 | "points": false, 502 | "renderer": "flot", 503 | "seriesOverrides": [], 504 | "spaceLength": 10, 505 | "stack": false, 506 | "steppedLine": false, 507 | "targets": [ 508 | { 509 | "expr": "sum(rate(container_network_receive_bytes_total{name=~\".+\"}[$interval])) by (name)", 510 | "intervalFactor": 2, 511 | "legendFormat": "{{name}}", 512 | "refId": "A", 513 | "step": 240 514 | }, 515 | { 516 | "expr": "- rate(container_network_transmit_bytes_total{name=~\".+\"}[$interval])", 517 | "hide": true, 518 | "intervalFactor": 2, 519 | "legendFormat": "{{name}}", 520 | "refId": "B", 521 | "step": 10 522 | } 523 | ], 524 | "thresholds": [], 525 | "timeFrom": null, 526 | "timeShift": null, 527 | "title": "Received Network Traffic per Container", 528 | "tooltip": { 529 | "msResolution": true, 530 | "shared": true, 531 | "sort": 0, 532 | "value_type": "cumulative" 533 | }, 534 | "transparent": false, 535 | "type": "graph", 536 | "xaxis": { 537 | "buckets": null, 538 | "mode": "time", 539 | "name": null, 540 | "show": true, 541 | "values": [] 542 | }, 543 | "yaxes": [ 544 | { 545 | "format": "Bps", 546 | "label": null, 547 | "logBase": 1, 548 | "max": null, 549 | "min": null, 550 | "show": true 551 | }, 552 | { 553 | "format": "short", 554 | "label": null, 555 | "logBase": 1, 556 | "max": null, 557 | "min": null, 558 | "show": true 559 | } 560 | ], 561 | "yaxis": { 562 | "align": false, 563 | "alignLevel": null 564 | } 565 | }, 566 | { 567 | "aliasColors": {}, 568 | "bars": false, 569 | "dashLength": 10, 570 | "dashes": false, 571 | "datasource": "Prometheus", 572 | "editable": true, 573 | "error": false, 574 | "fill": 1, 575 | "grid": {}, 576 | "gridPos": { 577 | "h": 7, 578 | "w": 12, 579 | "x": 12, 580 | "y": 10 581 | }, 582 | "id": 9, 583 | "legend": { 584 | "alignAsTable": true, 585 | "avg": false, 586 | "current": false, 587 | "hideEmpty": false, 588 | "hideZero": false, 589 | "max": false, 590 | "min": false, 591 | "rightSide": true, 592 | "show": true, 593 | "total": false, 594 | "values": false 595 | }, 596 | "lines": true, 597 | "linewidth": 2, 598 | "links": [], 599 | "nullPointMode": "null as zero", 600 | "percentage": false, 601 | "pointradius": 5, 602 | "points": false, 603 | "renderer": "flot", 604 | "seriesOverrides": [], 605 | "spaceLength": 10, 606 | "stack": false, 607 | "steppedLine": false, 608 | "targets": [ 609 | { 610 | "expr": "sum(rate(container_network_transmit_bytes_total{name=~\".+\"}[$interval])) by (name)", 611 | "intervalFactor": 2, 612 | "legendFormat": "{{name}}", 613 | "refId": "A", 614 | "step": 240 615 | }, 616 | { 617 | "expr": "rate(container_network_transmit_bytes_total{id=\"/\"}[$interval])", 618 | "hide": true, 619 | "intervalFactor": 2, 620 | "legendFormat": "", 621 | "refId": "B", 622 | "step": 10 623 | } 624 | ], 625 | "thresholds": [], 626 | "timeFrom": null, 627 | "timeShift": null, 628 | "title": "Sent Network Traffic per Container", 629 | "tooltip": { 630 | "msResolution": true, 631 | "shared": true, 632 | "sort": 0, 633 | "value_type": "cumulative" 634 | }, 635 | "transparent": false, 636 | "type": "graph", 637 | "xaxis": { 638 | "buckets": null, 639 | "mode": "time", 640 | "name": null, 641 | "show": true, 642 | "values": [] 643 | }, 644 | "yaxes": [ 645 | { 646 | "format": "Bps", 647 | "label": "", 648 | "logBase": 1, 649 | "max": null, 650 | "min": null, 651 | "show": true 652 | }, 653 | { 654 | "format": "short", 655 | "label": "", 656 | "logBase": 10, 657 | "max": 8, 658 | "min": 0, 659 | "show": false 660 | } 661 | ], 662 | "yaxis": { 663 | "align": false, 664 | "alignLevel": null 665 | } 666 | }, 667 | { 668 | "aliasColors": {}, 669 | "bars": false, 670 | "dashLength": 10, 671 | "dashes": false, 672 | "datasource": "Prometheus", 673 | "editable": true, 674 | "error": false, 675 | "fill": 3, 676 | "grid": {}, 677 | "gridPos": { 678 | "h": 7, 679 | "w": 12, 680 | "x": 0, 681 | "y": 17 682 | }, 683 | "id": 10, 684 | "legend": { 685 | "alignAsTable": true, 686 | "avg": false, 687 | "current": false, 688 | "max": false, 689 | "min": false, 690 | "rightSide": true, 691 | "show": true, 692 | "total": false, 693 | "values": false 694 | }, 695 | "lines": true, 696 | "linewidth": 2, 697 | "links": [], 698 | "nullPointMode": "null as zero", 699 | "percentage": false, 700 | "pointradius": 5, 701 | "points": false, 702 | "renderer": "flot", 703 | "seriesOverrides": [], 704 | "spaceLength": 10, 705 | "stack": true, 706 | "steppedLine": false, 707 | "targets": [ 708 | { 709 | "expr": "sum(container_memory_rss{name=~\".+\"}) by (name)", 710 | "hide": false, 711 | "intervalFactor": 2, 712 | "legendFormat": "{{name}}", 713 | "refId": "A", 714 | "step": 240 715 | }, 716 | { 717 | "expr": "container_memory_usage_bytes{name=~\".+\"}", 718 | "hide": true, 719 | "intervalFactor": 2, 720 | "legendFormat": "{{name}}", 721 | "refId": "B", 722 | "step": 240 723 | } 724 | ], 725 | "thresholds": [], 726 | "timeFrom": null, 727 | "timeShift": null, 728 | "title": "Memory Usage per Container", 729 | "tooltip": { 730 | "msResolution": true, 731 | "shared": true, 732 | "sort": 0, 733 | "value_type": "individual" 734 | }, 735 | "type": "graph", 736 | "xaxis": { 737 | "buckets": null, 738 | "mode": "time", 739 | "name": null, 740 | "show": true, 741 | "values": [] 742 | }, 743 | "yaxes": [ 744 | { 745 | "format": "bytes", 746 | "label": "", 747 | "logBase": 1, 748 | "max": null, 749 | "min": null, 750 | "show": true 751 | }, 752 | { 753 | "format": "short", 754 | "label": null, 755 | "logBase": 1, 756 | "max": null, 757 | "min": null, 758 | "show": true 759 | } 760 | ], 761 | "yaxis": { 762 | "align": false, 763 | "alignLevel": null 764 | } 765 | }, 766 | { 767 | "aliasColors": {}, 768 | "bars": false, 769 | "dashLength": 10, 770 | "dashes": false, 771 | "datasource": "Prometheus", 772 | "editable": true, 773 | "error": false, 774 | "fill": 3, 775 | "grid": {}, 776 | "gridPos": { 777 | "h": 7, 778 | "w": 12, 779 | "x": 12, 780 | "y": 17 781 | }, 782 | "id": 34, 783 | "legend": { 784 | "alignAsTable": true, 785 | "avg": false, 786 | "current": false, 787 | "max": false, 788 | "min": false, 789 | "rightSide": true, 790 | "show": true, 791 | "total": false, 792 | "values": false 793 | }, 794 | "lines": true, 795 | "linewidth": 2, 796 | "links": [], 797 | "nullPointMode": "null as zero", 798 | "percentage": false, 799 | "pointradius": 5, 800 | "points": false, 801 | "renderer": "flot", 802 | "seriesOverrides": [], 803 | "spaceLength": 10, 804 | "stack": true, 805 | "steppedLine": false, 806 | "targets": [ 807 | { 808 | "expr": "sum(container_memory_swap{name=~\".+\"}) by (name)", 809 | "hide": false, 810 | "intervalFactor": 2, 811 | "legendFormat": "{{name}}", 812 | "refId": "A", 813 | "step": 240 814 | }, 815 | { 816 | "expr": "container_memory_usage_bytes{name=~\".+\"}", 817 | "hide": true, 818 | "intervalFactor": 2, 819 | "legendFormat": "{{name}}", 820 | "refId": "B", 821 | "step": 240 822 | } 823 | ], 824 | "thresholds": [], 825 | "timeFrom": null, 826 | "timeShift": null, 827 | "title": "Memory Swap per Container", 828 | "tooltip": { 829 | "msResolution": true, 830 | "shared": true, 831 | "sort": 0, 832 | "value_type": "individual" 833 | }, 834 | "type": "graph", 835 | "xaxis": { 836 | "buckets": null, 837 | "mode": "time", 838 | "name": null, 839 | "show": true, 840 | "values": [] 841 | }, 842 | "yaxes": [ 843 | { 844 | "format": "bytes", 845 | "label": "", 846 | "logBase": 1, 847 | "max": null, 848 | "min": null, 849 | "show": true 850 | }, 851 | { 852 | "format": "short", 853 | "label": null, 854 | "logBase": 1, 855 | "max": null, 856 | "min": null, 857 | "show": true 858 | } 859 | ], 860 | "yaxis": { 861 | "align": false, 862 | "alignLevel": null 863 | } 864 | }, 865 | { 866 | "columns": [ 867 | { 868 | "text": "Current", 869 | "value": "current" 870 | } 871 | ], 872 | "datasource": null, 873 | "editable": true, 874 | "error": false, 875 | "fontSize": "100%", 876 | "gridPos": { 877 | "h": 10, 878 | "w": 8, 879 | "x": 0, 880 | "y": 24 881 | }, 882 | "id": 37, 883 | "links": [], 884 | "pageSize": null, 885 | "scroll": true, 886 | "showHeader": true, 887 | "sort": { 888 | "col": 0, 889 | "desc": true 890 | }, 891 | "styles": [ 892 | { 893 | "colorMode": null, 894 | "colors": [ 895 | "rgba(245, 54, 54, 0.9)", 896 | "rgba(237, 129, 40, 0.89)", 897 | "rgba(50, 172, 45, 0.97)" 898 | ], 899 | "decimals": 2, 900 | "pattern": "/.*/", 901 | "thresholds": [ 902 | "10000000", 903 | " 25000000" 904 | ], 905 | "type": "number", 906 | "unit": "decbytes" 907 | } 908 | ], 909 | "targets": [ 910 | { 911 | "expr": "sum(container_spec_memory_limit_bytes{name=~\".+\"} - container_memory_usage_bytes{name=~\".+\"}) by (name) ", 912 | "hide": true, 913 | "intervalFactor": 2, 914 | "legendFormat": "{{name}}", 915 | "metric": "", 916 | "refId": "A", 917 | "step": 240 918 | }, 919 | { 920 | "expr": "sum(container_spec_memory_limit_bytes{name=~\".+\"}) by (name) ", 921 | "hide": true, 922 | "intervalFactor": 2, 923 | "legendFormat": "{{name}}", 924 | "refId": "B", 925 | "step": 240 926 | }, 927 | { 928 | "expr": "container_memory_usage_bytes{name=~\".+\"}", 929 | "hide": false, 930 | "intervalFactor": 2, 931 | "legendFormat": "{{name}}", 932 | "refId": "C", 933 | "step": 240 934 | } 935 | ], 936 | "title": "Usage memory", 937 | "transform": "timeseries_aggregations", 938 | "type": "table" 939 | }, 940 | { 941 | "columns": [ 942 | { 943 | "text": "Current", 944 | "value": "current" 945 | } 946 | ], 947 | "datasource": null, 948 | "editable": true, 949 | "error": false, 950 | "fontSize": "100%", 951 | "gridPos": { 952 | "h": 10, 953 | "w": 8, 954 | "x": 8, 955 | "y": 24 956 | }, 957 | "id": 35, 958 | "links": [], 959 | "pageSize": null, 960 | "scroll": true, 961 | "showHeader": true, 962 | "sort": { 963 | "col": 1, 964 | "desc": true 965 | }, 966 | "styles": [ 967 | { 968 | "colorMode": "cell", 969 | "colors": [ 970 | "rgba(50, 172, 45, 0.97)", 971 | "rgba(237, 129, 40, 0.89)", 972 | "rgba(245, 54, 54, 0.9)" 973 | ], 974 | "decimals": 2, 975 | "pattern": "/.*/", 976 | "thresholds": [ 977 | "80", 978 | "90" 979 | ], 980 | "type": "number", 981 | "unit": "percent" 982 | } 983 | ], 984 | "targets": [ 985 | { 986 | "expr": "sum(100 - ((container_spec_memory_limit_bytes{name=~\".+\"} - container_memory_usage_bytes{name=~\".+\"}) * 100 / container_spec_memory_limit_bytes{name=~\".+\"}) ) by (name) ", 987 | "intervalFactor": 2, 988 | "legendFormat": "{{name}}", 989 | "metric": "", 990 | "refId": "A", 991 | "step": 240 992 | }, 993 | { 994 | "expr": "sum(container_spec_memory_limit_bytes{name=~\".+\"}) by (name) ", 995 | "hide": true, 996 | "intervalFactor": 2, 997 | "legendFormat": "{{name}}", 998 | "refId": "B", 999 | "step": 240 1000 | }, 1001 | { 1002 | "expr": "container_memory_usage_bytes{name=~\".+\"}", 1003 | "hide": true, 1004 | "intervalFactor": 2, 1005 | "legendFormat": "{{name}}", 1006 | "refId": "C", 1007 | "step": 240 1008 | } 1009 | ], 1010 | "title": "Remaining memory", 1011 | "transform": "timeseries_aggregations", 1012 | "type": "table" 1013 | }, 1014 | { 1015 | "columns": [ 1016 | { 1017 | "text": "Current", 1018 | "value": "current" 1019 | } 1020 | ], 1021 | "datasource": null, 1022 | "editable": true, 1023 | "error": false, 1024 | "fontSize": "100%", 1025 | "gridPos": { 1026 | "h": 10, 1027 | "w": 8, 1028 | "x": 16, 1029 | "y": 24 1030 | }, 1031 | "id": 36, 1032 | "links": [], 1033 | "pageSize": null, 1034 | "scroll": true, 1035 | "showHeader": true, 1036 | "sort": { 1037 | "col": 0, 1038 | "desc": true 1039 | }, 1040 | "styles": [ 1041 | { 1042 | "colorMode": null, 1043 | "colors": [ 1044 | "rgba(245, 54, 54, 0.9)", 1045 | "rgba(237, 129, 40, 0.89)", 1046 | "rgba(50, 172, 45, 0.97)" 1047 | ], 1048 | "decimals": 2, 1049 | "pattern": "/.*/", 1050 | "thresholds": [ 1051 | "10000000", 1052 | " 25000000" 1053 | ], 1054 | "type": "number", 1055 | "unit": "decbytes" 1056 | } 1057 | ], 1058 | "targets": [ 1059 | { 1060 | "expr": "sum(container_spec_memory_limit_bytes{name=~\".+\"} - container_memory_usage_bytes{name=~\".+\"}) by (name) ", 1061 | "hide": true, 1062 | "intervalFactor": 2, 1063 | "legendFormat": "{{name}}", 1064 | "metric": "", 1065 | "refId": "A", 1066 | "step": 240 1067 | }, 1068 | { 1069 | "expr": "sum(container_spec_memory_limit_bytes{name=~\".+\"}) by (name) ", 1070 | "hide": false, 1071 | "intervalFactor": 2, 1072 | "legendFormat": "{{name}}", 1073 | "refId": "B", 1074 | "step": 240 1075 | }, 1076 | { 1077 | "expr": "container_memory_usage_bytes{name=~\".+\"}", 1078 | "hide": true, 1079 | "intervalFactor": 2, 1080 | "legendFormat": "{{name}}", 1081 | "refId": "C", 1082 | "step": 240 1083 | } 1084 | ], 1085 | "title": "Limit memory", 1086 | "transform": "timeseries_aggregations", 1087 | "type": "table" 1088 | } 1089 | ], 1090 | "refresh": "5m", 1091 | "schemaVersion": 16, 1092 | "style": "dark", 1093 | "tags": [], 1094 | "templating": { 1095 | "list": [ 1096 | { 1097 | "allValue": ".+", 1098 | "current": { 1099 | "text": "All", 1100 | "value": "$__all" 1101 | }, 1102 | "datasource": "Prometheus", 1103 | "hide": 0, 1104 | "includeAll": true, 1105 | "label": "Container Group", 1106 | "multi": true, 1107 | "name": "containergroup", 1108 | "options": [], 1109 | "query": "label_values(container_group)", 1110 | "refresh": 1, 1111 | "regex": "", 1112 | "sort": 0, 1113 | "tagValuesQuery": null, 1114 | "tags": [], 1115 | "tagsQuery": null, 1116 | "type": "query", 1117 | "useTags": false 1118 | }, 1119 | { 1120 | "auto": true, 1121 | "auto_count": 50, 1122 | "auto_min": "50s", 1123 | "current": { 1124 | "text": "auto", 1125 | "value": "$__auto_interval_interval" 1126 | }, 1127 | "datasource": null, 1128 | "hide": 0, 1129 | "includeAll": false, 1130 | "label": "Interval", 1131 | "multi": false, 1132 | "name": "interval", 1133 | "options": [ 1134 | { 1135 | "selected": true, 1136 | "text": "auto", 1137 | "value": "$__auto_interval_interval" 1138 | }, 1139 | { 1140 | "selected": false, 1141 | "text": "30s", 1142 | "value": "30s" 1143 | }, 1144 | { 1145 | "selected": false, 1146 | "text": "1m", 1147 | "value": "1m" 1148 | }, 1149 | { 1150 | "selected": false, 1151 | "text": "2m", 1152 | "value": "2m" 1153 | }, 1154 | { 1155 | "selected": false, 1156 | "text": "3m", 1157 | "value": "3m" 1158 | }, 1159 | { 1160 | "selected": false, 1161 | "text": "5m", 1162 | "value": "5m" 1163 | }, 1164 | { 1165 | "selected": false, 1166 | "text": "7m", 1167 | "value": "7m" 1168 | }, 1169 | { 1170 | "selected": false, 1171 | "text": "10m", 1172 | "value": "10m" 1173 | }, 1174 | { 1175 | "selected": false, 1176 | "text": "30m", 1177 | "value": "30m" 1178 | }, 1179 | { 1180 | "selected": false, 1181 | "text": "1h", 1182 | "value": "1h" 1183 | }, 1184 | { 1185 | "selected": false, 1186 | "text": "6h", 1187 | "value": "6h" 1188 | }, 1189 | { 1190 | "selected": false, 1191 | "text": "12h", 1192 | "value": "12h" 1193 | }, 1194 | { 1195 | "selected": false, 1196 | "text": "1d", 1197 | "value": "1d" 1198 | }, 1199 | { 1200 | "selected": false, 1201 | "text": "7d", 1202 | "value": "7d" 1203 | }, 1204 | { 1205 | "selected": false, 1206 | "text": "14d", 1207 | "value": "14d" 1208 | }, 1209 | { 1210 | "selected": false, 1211 | "text": "30d", 1212 | "value": "30d" 1213 | } 1214 | ], 1215 | "query": "30s,1m,2m,3m,5m,7m,10m,30m,1h,6h,12h,1d,7d,14d,30d", 1216 | "refresh": 2, 1217 | "type": "interval" 1218 | }, 1219 | { 1220 | "allValue": null, 1221 | "current": { 1222 | "isNone": true, 1223 | "text": "None", 1224 | "value": "" 1225 | }, 1226 | "datasource": "Prometheus", 1227 | "hide": 0, 1228 | "includeAll": false, 1229 | "label": "Node", 1230 | "multi": true, 1231 | "name": "server", 1232 | "options": [], 1233 | "query": "label_values(node_boot_time, instance)", 1234 | "refresh": 1, 1235 | "regex": "/([^:]+):.*/", 1236 | "sort": 0, 1237 | "tagValuesQuery": null, 1238 | "tags": [], 1239 | "tagsQuery": null, 1240 | "type": "query", 1241 | "useTags": false 1242 | } 1243 | ] 1244 | }, 1245 | "time": { 1246 | "from": "now-5m", 1247 | "to": "now" 1248 | }, 1249 | "timepicker": { 1250 | "refresh_intervals": [ 1251 | "5s", 1252 | "10s", 1253 | "30s", 1254 | "1m", 1255 | "5m", 1256 | "15m", 1257 | "30m", 1258 | "1h", 1259 | "2h", 1260 | "1d" 1261 | ], 1262 | "time_options": [ 1263 | "5m", 1264 | "15m", 1265 | "1h", 1266 | "6h", 1267 | "12h", 1268 | "24h", 1269 | "2d", 1270 | "7d", 1271 | "30d" 1272 | ] 1273 | }, 1274 | "timezone": "browser", 1275 | "title": "Docker Monitoring", 1276 | "uid": "gM6IHN1ik", 1277 | "version": 1 1278 | } --------------------------------------------------------------------------------