From 6c502325f052d1fcd4fc4ef791b8ab4262d23a04 Mon Sep 17 00:00:00 2001 From: Gordon Kelly Date: Thu, 11 Jan 2018 16:59:19 +0000 Subject: docker: rename barometer image and update documentation Rename the barometer image from barometer to barometer-collectd to align with naming convention of other barometer images and move relevant files to new barometer-collectd directory.Docker userguide also updated accordingly Change-Id: Id866baf41bc38d3db8575ee00abfc64e97c7259b Signed-off-by: gordonkelly --- docker/Dockerfile | 22 ------ docker/README | 106 -------------------------- docker/barometer-collectd/Dockerfile | 22 ++++++ docker/barometer-collectd/README | 106 ++++++++++++++++++++++++++ docker/barometer-collectd/run_collectd.sh | 15 ++++ docker/run_collectd.sh | 15 ---- docs/release/userguide/docker.userguide.rst | 113 ++++++++++++++++------------ 7 files changed, 208 insertions(+), 191 deletions(-) delete mode 100644 docker/Dockerfile delete mode 100644 docker/README create mode 100644 docker/barometer-collectd/Dockerfile create mode 100644 docker/barometer-collectd/README create mode 100644 docker/barometer-collectd/run_collectd.sh delete mode 100644 docker/run_collectd.sh diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index dd3a8c0b..00000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -FROM centos:7 -RUN yum update -y -RUN yum install -y which sudo -RUN yum install -y git -ENV DOCKER y -ENV repos_dir /src -ENV openstack_plugins /src/barometer/src/collectd-openstack-plugins -RUN git config --global http.sslVerify false - -WORKDIR ${repos_dir} -RUN git clone https://gerrit.opnfv.org/gerrit/barometer -WORKDIR ${repos_dir}/barometer/systems -RUN sh ./build_base_machine.sh - -RUN useradd -ms /bin/bash collectd_exec -RUN echo "collectd_exec ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers - -WORKDIR ${openstack_plugins} -RUN make - -COPY run_collectd.sh /run_collectd.sh -RUN chmod +x /run_collectd.sh diff --git a/docker/README b/docker/README deleted file mode 100644 index 7f5633ac..00000000 --- a/docker/README +++ /dev/null @@ -1,106 +0,0 @@ -============================================================================== -Readme for collectd docker container in barometer project -============================================================================== - -This text file includes information about environment preparation and -deployment collectd in docker container - -Table of content: -1. DESCRIPTION -2. SYSTEM REQUIREMENTS -3. INSTALLATION NOTES -4. ADDITIONAL STEPS - ------------------------------------------------------------------------------- -1. DESCRIPTION - -This Dockerfile provides instruction for building collect in isolated container - ------------------------------------------------------------------------------- -2. SYSTEM REQUIREMENTS - - Docker >= 17.06.0-ce - ------------------------------------------------------------------------------- -3. INSTALLATION NOTES - -To build docker container run -sudo docker build -f ./docker/Dockerfile . -from barometer folder. - -To run builded image run -sudo docker images -Get docker image id -sudo docker run -ti --net=host -v `pwd`/../src/collectd_sample_configs:/opt/collectd/etc/collectd.d \ --v /var/run:/var/run -v /tmp:/tmp --privileged /run_collectd.sh - -To make some changes run -sudo docker run -ti --net=host -v `pwd`/../collectd_sample_configs:/opt/collectd/etc/collectd.d \ - -v /var/run:/var/run --privileged /bin/bash - -/opt/collectd/sbin/collectd -f - ------------------------------------------------------------------------------- -4. ADDITIONAL STEPS - -To check if container works properly additional packages should be installed -on host system. - -MCELOG -To simulate mcelog message use instruction in http://artifacts.opnfv.org/barometer/docs/index.html#mcelog-plugin - -git clone https://github.com/andikleen/mce-inject -cd mce-inject/ -make -sudo make install -modprobe mce-inject - -go to mcelog folder -sudo make test - -if runs multiple times mcelog service shoud be restarted(cause mcelog make test exits closes mcelog) - -VIRT -http://artifacts.opnfv.org/barometer/docs/index.html#virt-plugin -Check that libvirtd is running on the remote host -systemctl status libvirtd -virsh list -virsh perf instance-00000003 -sudo virsh perf instance-00000003 --enable cpu_cycles --live -sudo virsh perf instance-00000003 --enable cmt --live -sudo virsh perf instance-00000003 --enable mbmt --live -sudo virsh perf instance-00000003 --enable mbml --live -sudo virsh perf instance-00000003 --enable instructions --live -sudo virsh perf instance-00000003 --enable cache_references --live -sudo virsh perf instance-00000003 --enable cache_mises --live -sudo virsh perf instance-00000003 --enable cache_misses --live - -OVS -To successfuly run ovs plugins in Docker you need an ovs instance to connect to - -sudo yum install -y openvswitch-switch -sudo service openvswitch-switch start -sudo ovs-vsctl set-manager ptcp:6640 - -Alternatively you can build ovs from source -yum -y install make gcc openssl-devel autoconf automake rpm-build \ - redhat-rpm-config python-devel openssl-devel kernel-devel \ - kernel-debug-devel libtool wget python-six selinux-policy-devel -mkdir -p ~/rpmbuild/SOURCES -cd ~/rpmbuild/SOURCES -wget http://openvswitch.org/releases/openvswitch-2.5.3.tar.gz -tar xfz openvswitch-2.5.3.tar.gz -sed 's/openvswitch-kmod, //g' rhel/openvswitch.spec > rhel/openvswitch_no_kmod.spec -rpmbuild -bb --nocheck rhel/openvswitch_no_kmod.spec -cd ../RPMS/x86_64/ -yum install -y openvswitch-2.5.3-1.x86_64.rpm -sudo systemctl start openvswitch.service -sudo ovs-vsctl set-manager ptcp:6640 - -To check if connection is successfull please check -sudo ovs-vsctl show -319efc53-b321-49a9-b628-e8d70f9bd8a9 - Manager "ptcp:6640" - is_connected: true - can be a marker that ovs plugins successfully connected - ovs_version: "2.5.3" -on the host. diff --git a/docker/barometer-collectd/Dockerfile b/docker/barometer-collectd/Dockerfile new file mode 100644 index 00000000..dd3a8c0b --- /dev/null +++ b/docker/barometer-collectd/Dockerfile @@ -0,0 +1,22 @@ +FROM centos:7 +RUN yum update -y +RUN yum install -y which sudo +RUN yum install -y git +ENV DOCKER y +ENV repos_dir /src +ENV openstack_plugins /src/barometer/src/collectd-openstack-plugins +RUN git config --global http.sslVerify false + +WORKDIR ${repos_dir} +RUN git clone https://gerrit.opnfv.org/gerrit/barometer +WORKDIR ${repos_dir}/barometer/systems +RUN sh ./build_base_machine.sh + +RUN useradd -ms /bin/bash collectd_exec +RUN echo "collectd_exec ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers + +WORKDIR ${openstack_plugins} +RUN make + +COPY run_collectd.sh /run_collectd.sh +RUN chmod +x /run_collectd.sh diff --git a/docker/barometer-collectd/README b/docker/barometer-collectd/README new file mode 100644 index 00000000..4936ad8c --- /dev/null +++ b/docker/barometer-collectd/README @@ -0,0 +1,106 @@ +============================================================================== +Readme for collectd docker container in barometer project +============================================================================== + +This text file includes information about environment preparation and +deployment collectd in docker container + +Table of content: +1. DESCRIPTION +2. SYSTEM REQUIREMENTS +3. INSTALLATION NOTES +4. ADDITIONAL STEPS + +------------------------------------------------------------------------------ +1. DESCRIPTION + +This Dockerfile provides instruction for building collect in isolated container + +------------------------------------------------------------------------------ +2. SYSTEM REQUIREMENTS + + Docker >= 17.06.0-ce + +------------------------------------------------------------------------------ +3. INSTALLATION NOTES + +To build docker container run +sudo docker build -f ./docker/barometer-collectd/Dockerfile . +from barometer folder. + +To run builded image run +sudo docker images +Get docker image id +sudo docker run -ti --net=host -v `pwd`/../src/collectd_sample_configs:/opt/collectd/etc/collectd.d \ +-v /var/run:/var/run -v /tmp:/tmp --privileged /run_collectd.sh + +To make some changes run +sudo docker run -ti --net=host -v `pwd`/../collectd_sample_configs:/opt/collectd/etc/collectd.d \ + -v /var/run:/var/run --privileged /bin/bash + +/opt/collectd/sbin/collectd -f + +------------------------------------------------------------------------------ +4. ADDITIONAL STEPS + +To check if container works properly additional packages should be installed +on host system. + +MCELOG +To simulate mcelog message use instruction in http://artifacts.opnfv.org/barometer/docs/index.html#mcelog-plugin + +git clone https://github.com/andikleen/mce-inject +cd mce-inject/ +make +sudo make install +modprobe mce-inject + +go to mcelog folder +sudo make test + +if runs multiple times mcelog service shoud be restarted(cause mcelog make test exits closes mcelog) + +VIRT +http://artifacts.opnfv.org/barometer/docs/index.html#virt-plugin +Check that libvirtd is running on the remote host +systemctl status libvirtd +virsh list +virsh perf instance-00000003 +sudo virsh perf instance-00000003 --enable cpu_cycles --live +sudo virsh perf instance-00000003 --enable cmt --live +sudo virsh perf instance-00000003 --enable mbmt --live +sudo virsh perf instance-00000003 --enable mbml --live +sudo virsh perf instance-00000003 --enable instructions --live +sudo virsh perf instance-00000003 --enable cache_references --live +sudo virsh perf instance-00000003 --enable cache_mises --live +sudo virsh perf instance-00000003 --enable cache_misses --live + +OVS +To successfuly run ovs plugins in Docker you need an ovs instance to connect to + +sudo yum install -y openvswitch-switch +sudo service openvswitch-switch start +sudo ovs-vsctl set-manager ptcp:6640 + +Alternatively you can build ovs from source +yum -y install make gcc openssl-devel autoconf automake rpm-build \ + redhat-rpm-config python-devel openssl-devel kernel-devel \ + kernel-debug-devel libtool wget python-six selinux-policy-devel +mkdir -p ~/rpmbuild/SOURCES +cd ~/rpmbuild/SOURCES +wget http://openvswitch.org/releases/openvswitch-2.5.3.tar.gz +tar xfz openvswitch-2.5.3.tar.gz +sed 's/openvswitch-kmod, //g' rhel/openvswitch.spec > rhel/openvswitch_no_kmod.spec +rpmbuild -bb --nocheck rhel/openvswitch_no_kmod.spec +cd ../RPMS/x86_64/ +yum install -y openvswitch-2.5.3-1.x86_64.rpm +sudo systemctl start openvswitch.service +sudo ovs-vsctl set-manager ptcp:6640 + +To check if connection is successfull please check +sudo ovs-vsctl show +319efc53-b321-49a9-b628-e8d70f9bd8a9 + Manager "ptcp:6640" + is_connected: true - can be a marker that ovs plugins successfully connected + ovs_version: "2.5.3" +on the host. diff --git a/docker/barometer-collectd/run_collectd.sh b/docker/barometer-collectd/run_collectd.sh new file mode 100644 index 00000000..001cce1a --- /dev/null +++ b/docker/barometer-collectd/run_collectd.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# Copyright 2017 OPNFV +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +/opt/collectd/sbin/collectd -f diff --git a/docker/run_collectd.sh b/docker/run_collectd.sh deleted file mode 100644 index 001cce1a..00000000 --- a/docker/run_collectd.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -# Copyright 2017 OPNFV -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -/opt/collectd/sbin/collectd -f diff --git a/docs/release/userguide/docker.userguide.rst b/docs/release/userguide/docker.userguide.rst index fe0ea5ac..ace38f8d 100644 --- a/docs/release/userguide/docker.userguide.rst +++ b/docs/release/userguide/docker.userguide.rst @@ -11,8 +11,8 @@ OPNFV Barometer Docker User Guide :local: The intention of this user guide is to outline how to install and test the -barometer, Influxdb and Grafana docker images that can be built from the Dockerfiles -available in the barometer repository. +Barometer projects Collectd, Influxdb and Grafana docker images which can be built from the Dockerfiles +available within the barometer repository. Barometer docker images description @@ -23,11 +23,11 @@ Barometer docker images description Barometer Collectd Image ^^^^^^^^^^^^^^^^^^^^^^^^ -The barometer Collectd docker image gives you a collectd installation that includes all +The barometer collectd docker image gives you a collectd installation that includes all the barometer plugins. .. note:: - The Dockerfile is available in the docker/ directory in the barometer repo. + The Dockerfile is available in the docker/barometer-collectd directory in the barometer repo. The Dockerfile builds a CentOS 7 docker image. The container MUST be run as a privileged container. @@ -35,10 +35,10 @@ Collectd is a daemon which collects system performance statistics periodically and provides a variety of mechanisms to publish the collected metrics. It supports more than 90 different input and output plugins. Input plugins retrieve metrics and publish them to the collectd deamon, while output plugins -publish the data they receive to an end point. collectd also has infrastructure +publish the data they receive to an end point. Collectd also has infrastructure to support thresholding and notification. -Barometer docker image has enabled the following collectd plugins (in addition +Collectd docker image has enabled the following collectd plugins (in addition to the standard collectd plugins): * hugepages plugin @@ -64,8 +64,8 @@ InfluxDB + Grafana Images ^^^^^^^^^^^^^^^^^^^^^^^^^ The Barometer project's InfluxDB and Grafana docker images are 2 docker images that database and graph -statistics reported by the Barometer Collectd docker. InfluxDB is an open-source time series database -tool which stores the data from Collectd for future analysis via Grafana, which is a open-source +statistics reported by the Barometer collectd docker. InfluxDB is an open-source time series database +tool which stores the data from collectd for future analysis via Grafana, which is a open-source metrics anlytics and visualisation suite which can be accessed through any browser. Installing Docker @@ -222,14 +222,14 @@ To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash -Build the barometer docker image +Build the collectd docker image ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code:: bash $ git clone https://gerrit.opnfv.org/gerrit/barometer - $ cd barometer/docker - $ sudo docker build -t opnfv/barometer --build-arg http_proxy=`echo $http_proxy` \ + $ cd barometer/docker/barometer-collectd + $ sudo docker build -t opnfv/barometer-collectd --build-arg http_proxy=`echo $http_proxy` \ --build-arg https_proxy=`echo $https_proxy` -f Dockerfile . .. note:: @@ -242,35 +242,35 @@ Check the docker images: $ sudo docker images -Output should contain a barometer image: +Output should contain a barometer-collectd image: .. code:: - REPOSITORY TAG IMAGE ID CREATED SIZE - opnfv/barometer latest 05f2a3edd96b 3 hours ago 1.2GB - centos 7 196e0ce0c9fb 4 weeks ago 197MB - centos latest 196e0ce0c9fb 4 weeks ago 197MB - hello-world latest 05a3bd381fc2 4 weeks ago 1.84kB + REPOSITORY TAG IMAGE ID CREATED SIZE + opnfv/barometer-collectd latest 05f2a3edd96b 3 hours ago 1.2GB + centos 7 196e0ce0c9fb 4 weeks ago 197MB + centos latest 196e0ce0c9fb 4 weeks ago 197MB + hello-world latest 05a3bd381fc2 4 weeks ago 1.84kB -Download the barometer docker image +Download the collectd docker image ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If you want to use a pre-built barometer image, you can pull the barometer -image from https://hub.docker.com/r/opnfv/barometer/ +image from https://hub.docker.com/r/opnfv/barometer-collectd/ .. code:: bash - $ docker pull opnfv/barometer + $ docker pull opnfv/barometer-collectd -Run the barometer docker image +Run the collectd docker image ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code:: bash $ sudo docker run -tid --net=host -v `pwd`/../src/collectd_sample_configs:/opt/collectd/etc/collectd.conf.d \ - -v /var/run:/var/run -v /tmp:/tmp --privileged opnfv/barometer /run_collectd.sh + -v /var/run:/var/run -v /tmp:/tmp --privileged opnfv/barometer-collectd /run_collectd.sh .. note:: - The docker barometer image contains configuration for all the collectd plugins. In the command + The docker collectd image contains configuration for all the collectd plugins. In the command above we are overriding /opt/collectd/etc/collectd.conf.d by mounting a host directory `pwd`/../src/collectd_sample_configs that contains only the sample configurations we are interested in running. *It's important to do this if you don't have DPDK, or RDT installed on the host*. @@ -281,7 +281,7 @@ To make some changes when the container is running run: .. code:: bash - sudo docker exec -ti opnfv/barometer /bin/bash + sudo docker exec -ti opnfv/barometer-collectd /bin/bash Check your docker image is running @@ -291,6 +291,20 @@ Check your docker image is running Build the influxdb + Grafana docker images ------------------------------------------ +Download the InfluxDB and Grafana docker image +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +If you wish to use pre-built barometer project's influxdb and grafana images, you can pull the +images from https://hub.docker.com/r/opnfv/barometer-influxdb/ and https://hub.docker.com/r/opnfv/barometer-grafana/ + +.. note:: + If your preference is to build images locally please see sections `Build the InfluxDB Image`_ and + `Build the Grafana Image`_ + +.. code:: bash + + $ docker pull opnfv/barometer-influxdb + $ docker pull opnfv/barometer-grafana + Build the InfluxDB Image ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -299,7 +313,7 @@ Build influxdb image from Dockerfile .. code:: bash $ cd barometer/docker/barometer-influxdb - $ sudo docker build -t barometer-influxdb --build-arg http_proxy=`echo $http_proxy` \ + $ sudo docker build -t opnfv/barometer-influxdb --build-arg http_proxy=`echo $http_proxy` \ --build-arg https_proxy=`echo $https_proxy` -f Dockerfile . .. note:: @@ -316,9 +330,8 @@ Output should contain an influxdb image: .. code:: - REPOSITORY TAG IMAGE ID CREATED SIZE - barometer-influxdb latest 1e4623a59fe5 3 days ago 191MB - + REPOSITORY TAG IMAGE ID CREATED SIZE + opnfv/barometer-influxdb latest 1e4623a59fe5 3 days ago 191MB Build the Grafana Image ^^^^^^^^^^^^^^^^^^^^^^^ @@ -328,7 +341,7 @@ Build Grafana image from Dockerfile .. code:: bash $ cd barometer/docker/barometer-grafana - $ sudo docker build -t barometer-grafana --build-arg http_proxy=`echo $http_proxy` \ + $ sudo docker build -t opnfv/barometer-grafana --build-arg http_proxy=`echo $http_proxy` \ --build-arg https_proxy=`echo $https_proxy` -f Dockerfile . .. note:: @@ -344,41 +357,45 @@ Output should contain an influxdb image: .. code:: - REPOSITORY TAG IMAGE ID CREATED SIZE - barometer-grafana latest 05f2a3edd96b 3 hours ago 1.2GB + REPOSITORY TAG IMAGE ID CREATED SIZE + opnfv/barometer-grafana latest 05f2a3edd96b 3 hours ago 1.2GB +Run the Influxdb and Grafana Images +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Run the InfluxDB docker image +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. code:: bash -Download the InfluxDB and Grafana docker image -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -If you wish to use pre-built barometer project's influxdb and grafana images, you can pull the -images from https://hub.docker.com/r/opnfv/barometer-influxdb/ and https://hub.docker.com/r/opnfv/barometer-grafana/ + $ sudo docker run -tid --net=host -v /var/lib/influxdb:/var/lib/influxdb -p 8086:8086 opnfv/barometer-influxdb -.. note:: - If your preference is to build images locally please see sections `Build the InfluxDB Image`_ and - `Build the Grafana Image`_ +To make some changes when the container is running run: .. code:: bash - $ docker pull opnfv/barometer-influxdb - $ docker pull opnfv/barometer-grafana + sudo docker exec -ti opnfv/barometer-influxdb /bin/bash -Run the Influxdb and Grafana Images -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Check your docker image is running -Launch containers: +.. code:: bash + sudo docker ps +Run the Grafana docker image +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code:: bash - $ cd barometer/docker/ - $ sudo docker-compose up -d + $ sudo docker run -tid --net=host -v /var/lib/grafana:/var/lib/grafana -p 3000:3000 opnfv/barometer-grafana -Check your docker images are running +To make some changes when the container is running run: .. code:: bash - $ sudo docker ps + sudo docker exec -ti opnfv/barometer-grafana /bin/bash -Connect to :3000 with a browser and log into grafana: admin/admin +Check your docker image is running + +.. code:: bash + + sudo docker ps Testing the docker image ^^^^^^^^^^^^^^^^^^^^^^^^ -- cgit