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 The intention of this user guide is to outline how to install and test the
14 barometer, Influxdb and Grafana docker images that can be built from the Dockerfiles
15 available in the barometer repository.
18 Barometer docker images description
19 -----------------------------------
21 .. Describe the specific features and how it is realised in the scenario in a brief manner
22 .. to ensure the user understand the context for the user guide instructions to follow.
24 Barometer Collectd Image
25 ^^^^^^^^^^^^^^^^^^^^^^^^
26 The barometer Collectd docker image gives you a collectd installation that includes all
27 the barometer plugins.
30 The Dockerfile is available in the docker/ directory in the barometer repo.
31 The Dockerfile builds a CentOS 7 docker image.
32 The container MUST be run as a privileged container.
34 Collectd is a daemon which collects system performance statistics periodically
35 and provides a variety of mechanisms to publish the collected metrics. It
36 supports more than 90 different input and output plugins. Input plugins
37 retrieve metrics and publish them to the collectd deamon, while output plugins
38 publish the data they receive to an end point. collectd also has infrastructure
39 to support thresholding and notification.
41 Barometer docker image has enabled the following collectd plugins (in addition
42 to the standard collectd plugins):
45 * Open vSwitch events Plugin
46 * Open vSwitch stats Plugin
54 Plugins and third party applications in Barometer repository that will be available in the
57 * Open vSwitch PMD stats
58 * ONAP VES application
63 InfluxDB + Grafana Images
64 ^^^^^^^^^^^^^^^^^^^^^^^^^
66 The Barometer project's InfluxDB and Grafana docker images are 2 docker images that database and graph
67 statistics reported by the Barometer Collectd docker. InfluxDB is an open-source time series database
68 tool which stores the data from Collectd for future analysis via Grafana, which is a open-source
69 metrics anlytics and visualisation suite which can be accessed through any browser.
73 .. Describe the specific capabilities and usage for <XYZ> feature.
74 .. Provide enough information that a user will be able to operate the feature on a deployed scenario.
79 * sudo permissions are required to install docker.
80 * These instructions are for Ubuntu 16.10
86 $ sudo apt-get install curl
87 $ sudo curl -fsSL https://get.docker.com/ | sh
88 $ sudo usermod -aG docker <username>
89 $ sudo systemctl status docker
91 Replace <username> above with an appropriate user name.
96 * sudo permissions are required to install docker.
97 * These instructions are for CentOS 7
103 $ sudo yum remove docker docker-common docker-selinux docker-engine
104 $ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
105 $ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
106 $ sudo yum-config-manager --enable docker-ce-edge
107 $ sudo yum-config-manager --enable docker-ce-test
108 $ sudo yum install docker-ce
109 $ sudo usermod -aG docker <username>
110 $ sudo systemctl status docker
112 Replace <username> above with an appropriate user name.
115 If this is the first time you are installing a package from a recently added
116 repository, you will be prompted to accept the GPG key, and the key’s
117 fingerprint will be shown. Verify that the fingerprint is correct, and if so,
118 accept the key. The fingerprint should match060A 61C5 1B55 8A7F 742B 77AA C52F
121 Retrieving key from https://download.docker.com/linux/centos/gpg
122 Importing GPG key 0x621E9F35:
123 Userid : "Docker Release (CE rpm) <docker@docker.com>"
124 Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
125 From : https://download.docker.com/linux/centos/gpg
131 This applies for both CentOS and Ubuntu.
133 If you are behind an HTTP or HTTPS proxy server, you will need to add this
134 configuration in the Docker systemd service file.
136 1. Create a systemd drop-in directory for the docker service:
140 $ sudo mkdir -p /etc/systemd/system/docker.service.d
143 called /etc/systemd/system/docker.service.d/http-proxy.conf that adds
144 the HTTP_PROXY environment variable:
149 Environment="HTTP_PROXY=http://proxy.example.com:80/"
151 Or, if you are behind an HTTPS proxy server, create a file
152 called /etc/systemd/system/docker.service.d/https-proxy.conf that adds
153 the HTTPS_PROXY environment variable:
158 Environment="HTTPS_PROXY=https://proxy.example.com:443/"
160 Or create a single file with all the proxy configurations:
161 /etc/systemd/system/docker.service.d/proxy.conf
166 Environment="HTTP_PROXY=http://proxy.example.com:80/"
167 Environment="HTTPS_PROXY=https://proxy.example.com:443/"
168 Environment="FTP_PROXY=ftp://proxy.example.com:443/"
169 Environment="NO_PROXY=localhost"
175 $ sudo systemctl daemon-reload
181 $ sudo systemctl restart docker
183 5. Check docker environment variables:
187 sudo systemctl show --property=Environment docker
189 Test docker installation
190 ^^^^^^^^^^^^^^^^^^^^^^^^
192 This applies for both CentOS and Ubuntu.
196 $ sudo docker run hello-world
198 The output should be something like:
202 Unable to find image 'hello-world:latest' locally
203 latest: Pulling from library/hello-world
204 5b0f327be733: Pull complete
205 Digest: sha256:07d5f7800dfe37b8c2196c7b1c524c33808ce2e0f74e7aa00e603295ca9a0972
206 Status: Downloaded newer image for hello-world:latest
209 This message shows that your installation appears to be working correctly.
211 To generate this message, Docker took the following steps:
212 1. The Docker client contacted the Docker daemon.
213 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
214 3. The Docker daemon created a new container from that image which runs the
215 executable that produces the output you are currently reading.
216 4. The Docker daemon streamed that output to the Docker client, which sent it
219 To try something more ambitious, you can run an Ubuntu container with:
223 $ docker run -it ubuntu bash
225 Build the barometer docker image
226 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
230 $ git clone https://gerrit.opnfv.org/gerrit/barometer
231 $ cd barometer/docker
232 $ sudo docker build -t opnfv/barometer --build-arg http_proxy=`echo $http_proxy` \
233 --build-arg https_proxy=`echo $https_proxy` -f Dockerfile .
236 In the above mentioned ``docker build`` command, http_proxy & https_proxy arguments needs to be
237 passed only if system is behind an HTTP or HTTPS proxy server.
239 Check the docker images:
245 Output should contain a barometer image:
249 REPOSITORY TAG IMAGE ID CREATED SIZE
250 opnfv/barometer latest 05f2a3edd96b 3 hours ago 1.2GB
251 centos 7 196e0ce0c9fb 4 weeks ago 197MB
252 centos latest 196e0ce0c9fb 4 weeks ago 197MB
253 hello-world latest 05a3bd381fc2 4 weeks ago 1.84kB
255 Download the barometer docker image
256 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
257 If you want to use a pre-built barometer image, you can pull the barometer
258 image from https://hub.docker.com/r/opnfv/barometer/
262 $ docker pull opnfv/barometer
265 Run the barometer docker image
266 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
269 $ sudo docker run -tid --net=host -v `pwd`/../src/collectd_sample_configs:/opt/collectd/etc/collectd.conf.d \
270 -v /var/run:/var/run -v /tmp:/tmp --privileged opnfv/barometer /run_collectd.sh
273 The docker barometer image contains configuration for all the collectd plugins. In the command
274 above we are overriding /opt/collectd/etc/collectd.conf.d by mounting a host directory
275 `pwd`/../src/collectd_sample_configs that contains only the sample configurations we are interested
276 in running. *It's important to do this if you don't have DPDK, or RDT installed on the host*.
277 Sample configurations can be found at:
278 https://github.com/opnfv/barometer/tree/master/src/collectd/collectd_sample_configs
280 To make some changes when the container is running run:
284 sudo docker exec -ti opnfv/barometer /bin/bash
286 Check your docker image is running
292 Build the influxdb + Grafana docker images
293 ------------------------------------------
294 Build the InfluxDB Image
295 ^^^^^^^^^^^^^^^^^^^^^^^^^
297 Build influxdb image from Dockerfile
301 $ cd barometer/docker/barometer-influxdb
302 $ sudo docker build -t barometer-influxdb --build-arg http_proxy=`echo $http_proxy` \
303 --build-arg https_proxy=`echo $https_proxy` -f Dockerfile .
306 In the above mentioned ``docker build`` command, http_proxy & https_proxy arguments needs to
307 be passed only if system is behind an HTTP or HTTPS proxy server.
309 Check the docker images:
315 Output should contain an influxdb image:
319 REPOSITORY TAG IMAGE ID CREATED SIZE
320 barometer-influxdb latest 1e4623a59fe5 3 days ago 191MB
323 Build the Grafana Image
324 ^^^^^^^^^^^^^^^^^^^^^^^
326 Build Grafana image from Dockerfile
330 $ cd barometer/docker/barometer-grafana
331 $ sudo docker build -t barometer-grafana --build-arg http_proxy=`echo $http_proxy` \
332 --build-arg https_proxy=`echo $https_proxy` -f Dockerfile .
335 In the above mentioned ``docker build`` command, http_proxy & https_proxy arguments needs to be passed only if system is behind an HTTP or HTTPS proxy server.
337 Check the docker images:
343 Output should contain an influxdb image:
347 REPOSITORY TAG IMAGE ID CREATED SIZE
348 barometer-grafana latest 05f2a3edd96b 3 hours ago 1.2GB
351 Download the InfluxDB and Grafana docker image
352 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
353 If you wish to use pre-built barometer project's influxdb and grafana images, you can pull the
354 images from https://hub.docker.com/r/opnfv/barometer-influxdb/ and https://hub.docker.com/r/opnfv/barometer-grafana/
357 If your preference is to build images locally please see sections `Build the InfluxDB Image`_ and
358 `Build the Grafana Image`_
362 $ docker pull opnfv/barometer-influxdb
363 $ docker pull opnfv/barometer-grafana
365 Run the Influxdb and Grafana Images
366 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
372 $ cd barometer/docker/
373 $ sudo docker-compose up -d
375 Check your docker images are running
381 Connect to <host_ip>:3000 with a browser and log into grafana: admin/admin
383 Testing the docker image
384 ^^^^^^^^^^^^^^^^^^^^^^^^
390 .. [1] https://docs.docker.com/engine/admin/systemd/#httphttps-proxy
391 .. [2] https://docs.docker.com/engine/installation/linux/docker-ce/centos/#install-using-the-repository
392 .. [3] https://docs.docker.com/engine/userguide/