1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3 .. (c) <optionally add copywriters name>
5 ===================================
6 OPNFV Barometer Docker User Guide
7 ===================================
13 Barometer docker image description
14 -----------------------------------
15 .. Describe the specific features and how it is realised in the scenario in a brief manner
16 .. to ensure the user understand the context for the user guide instructions to follow.
18 The intention of this user guide is to outline how to install and test the
19 barometer docker image that can be built from the Dockerfile available in the
23 The Dockerfile is available in the docker/ directory in the barometer repo.
24 The Dockerfile builds a CentOS 7 docker image.
26 The barometer docker image gives you a collectd installation that includes all
27 the barometer plugins.
30 The container MUST be run as a privileged container.
32 Collectd is a daemon which collects system performance statistics periodically
33 and provides a variety of mechanisms to publish the collected metrics. It
34 supports more than 90 different input and output plugins. Input plugins
35 retrieve metrics and publish them to the collectd deamon, while output plugins
36 publish the data they receive to an end point. collectd also has infrastructure
37 to support thresholding and notification.
39 Barometer docker image has enabled the following collectd plugins (in addition
40 to the standard collectd plugins):
43 * Open vSwitch events Plugin
44 * Open vSwitch stats Plugin
51 Plugins and third party applications in Barometer repository that will be available in the
54 * Open vSwitch PMD stats
55 * ONAP VES application
63 .. Describe the specific capabilities and usage for <XYZ> feature.
64 .. Provide enough information that a user will be able to operate the feature on a deployed scenario.
69 * sudo permissions are required to install docker.
70 * These instructions are for Ubuntu 16.10
76 $ sudo apt-get install curl
77 $ sudo curl -fsSL https://get.docker.com/ | sh
78 $ sudo usermod -aG docker <username>
79 $ sudo systemctl status docker
81 Replace <username> above with an appropriate user name.
86 * sudo permissions are required to install docker.
87 * These instructions are for CentOS 7
93 $ sudo yum remove docker docker-common docker-selinux docker-engine
94 $ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
95 $ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
96 $ sudo yum-config-manager --enable docker-ce-edge
97 $ sudo yum-config-manager --enable docker-ce-test
98 $ sudo yum install docker-ce
99 $ sudo usermod -aG docker <username>
100 $ sudo systemctl status docker
102 Replace <username> above with an appropriate user name.
105 If this is the first time you are installing a package from a recently added
106 repository, you will be prompted to accept the GPG key, and the key’s
107 fingerprint will be shown. Verify that the fingerprint is correct, and if so,
108 accept the key. The fingerprint should match060A 61C5 1B55 8A7F 742B 77AA C52F
111 Retrieving key from https://download.docker.com/linux/centos/gpg
112 Importing GPG key 0x621E9F35:
113 Userid : "Docker Release (CE rpm) <docker@docker.com>"
114 Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
115 From : https://download.docker.com/linux/centos/gpg
121 This applies for both CentOS and Ubuntu.
123 If you are behind an HTTP or HTTPS proxy server, you will need to add this
124 configuration in the Docker systemd service file.
126 1. Create a systemd drop-in directory for the docker service:
130 $ sudo mkdir -p /etc/systemd/system/docker.service.d
133 called /etc/systemd/system/docker.service.d/http-proxy.conf that adds
134 the HTTP_PROXY environment variable:
139 Environment="HTTP_PROXY=http://proxy.example.com:80/"
141 Or, if you are behind an HTTPS proxy server, create a file
142 called /etc/systemd/system/docker.service.d/https-proxy.conf that adds
143 the HTTPS_PROXY environment variable:
148 Environment="HTTPS_PROXY=https://proxy.example.com:443/"
150 Or create a single file with all the proxy configurations:
151 /etc/systemd/system/docker.service.d/proxy.conf
156 Environment="HTTP_PROXY=http://proxy.example.com:80/"
157 Environment="HTTPS_PROXY=https://proxy.example.com:443/"
158 Environment="FTP_PROXY=ftp://proxy.example.com:443/"
159 Environment="NO_PROXY=localhost"
165 $ sudo systemctl daemon-reload
171 $ sudo systemctl restart docker
173 5. Check docker environment variables:
177 sudo systemctl show --property=Environment docker
179 Test docker installation
180 ^^^^^^^^^^^^^^^^^^^^^^^^
182 This applies for both CentOS and Ubuntu.
186 $ sudo docker run hello-world
188 The output should be something like:
192 Unable to find image 'hello-world:latest' locally
193 latest: Pulling from library/hello-world
194 5b0f327be733: Pull complete
195 Digest: sha256:07d5f7800dfe37b8c2196c7b1c524c33808ce2e0f74e7aa00e603295ca9a0972
196 Status: Downloaded newer image for hello-world:latest
199 This message shows that your installation appears to be working correctly.
201 To generate this message, Docker took the following steps:
202 1. The Docker client contacted the Docker daemon.
203 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
204 3. The Docker daemon created a new container from that image which runs the
205 executable that produces the output you are currently reading.
206 4. The Docker daemon streamed that output to the Docker client, which sent it
209 To try something more ambitious, you can run an Ubuntu container with:
213 $ docker run -it ubuntu bash
215 Build the barometer docker image
216 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
221 $ sudo docker build -t barometer_image --build-arg http_proxy=`echo $http_proxy` \
222 --build-arg https_proxy=`echo $https_proxy` -f docker/Dockerfile .
224 Check the docker images:
230 Output should contain a barometer image:
234 REPOSITORY TAG IMAGE ID CREATED SIZE
235 barometer_image latest 05f2a3edd96b 3 hours ago 1.2GB
236 centos 7 196e0ce0c9fb 4 weeks ago 197MB
237 centos latest 196e0ce0c9fb 4 weeks ago 197MB
238 hello-world latest 05a3bd381fc2 4 weeks ago 1.84kB
240 Run the barometer docker image:
244 $ sudo docker run -tid --net=host -v `pwd`/../src/collectd_sample_configs:/opt/collectd/etc/collectd.conf.d \
245 -v /var/run:/var/run -v /tmp:/tmp --privileged barometer_image /run_collectd.sh
248 The docker barometer image contains configuration for all the collectd plugins. In the command
249 above we are overriding /opt/collectd/etc/collectd.conf.d by mounting a host directory
250 `pwd`/../src/collectd_sample_configs thta contains only the sample configurations we are interested
253 To make some changes run:
257 sudo docker exec -tid barometer_image /bin/bash
259 Check your docker image is running
265 Build the influxdb + Grafana docker images
266 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
268 Start by installing docker compose:
272 $ sudo curl -L https://github.com/docker/compose/releases/download/1.17.0/docker-compose-`uname -s`-`uname -m` -o /usr/bin/docker-compose
275 Use the latest Compose release number in the download command. The above command is an example,
276 and it may become out-of-date. To ensure you have the latest version, check the Compose repository
277 release page on GitHub.
279 2. Apply executable permissions to the binary:
283 $ sudo chmod +x /usr/bin/docker-compose
285 3. Test the installation.
289 $ sudo docker-compose --version
291 4. Run the get_types_db.sh script in barometer/docker
293 5. Run the docker containers:
297 $ sudo docker-compose up -d
299 6. Check your docker images are running
305 7. Run the script to create the CPU dashboard barometer/docker:
309 $ ./configure_grafana.sh
311 8. Connect to <host_ip>:3000 with a browser and log into grafana: admin/admin
313 Testing the docker image
314 ^^^^^^^^^^^^^^^^^^^^^^^^
320 .. [1] https://docs.docker.com/engine/admin/systemd/#httphttps-proxy
321 .. [2] https://docs.docker.com/engine/installation/linux/docker-ce/centos/#install-using-the-repository
322 .. [3] https://docs.docker.com/engine/userguide/