3 # Copyright (c) 2016-2017 Intel Corporation
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 INSTALL_NSB_BIN="/opt/nsb_bin"
19 if [ "$(whoami)" != "root" ]; then
20 echo "Must be root to run $0"
34 echo "Install required libraries to run collectd..."
35 pkg=(git flex bison build-essential pkg-config automake autotools-dev libltdl-dev librabbitmq-dev rabbitmq-server cmake libvirt-dev)
36 for i in "${pkg[@]}"; do
37 dpkg-query -W --showformat='${Status}\n' "${i}"|grep "install ok installed"
38 if [ "$?" -eq "1" ]; then
39 apt-get -y install "${i}";
44 if ldconfig -p | grep -q libpqos ; then
45 echo "Intel RDT library already installed. Done"
49 echo "Get intel_rdt repo and install..."
50 rm -rf intel-cmt-cat >/dev/null
51 git clone https://github.com/01org/intel-cmt-cat.git
53 (cd intel-cmt-cat; make install PREFIX=/usr)
59 if [[ -r /usr/lib/libdpdk.so ]]; then
60 echo "DPDK already installed. Done"
64 echo "Get dpdk and install..."
65 mkdir -p $INSTALL_NSB_BIN
68 mount -t hugetlbfs nodev /mnt/huge
69 sed -i 's/CONFIG_RTE_BUILD_SHARED_LIB=n/CONFIG_RTE_BUILD_SHARED_LIB=y/g' config/common_base
70 sed -i 's/CONFIG_RTE_EAL_PMD_PATH=""/CONFIG_RTE_EAL_PMD_PATH="\/usr\/lib\/dpdk-pmd\/"/g' config/common_base
72 echo "Build dpdk v16.07"
73 make config T=x86_64-native-linuxapp-gcc
75 sudo make install prefix=/usr
76 mkdir -p /usr/lib/dpdk-pmd
77 find /usr/lib -type f -name 'librte_pmd*' | while read path ; do ln -s $path /usr/lib/dpdk-pmd/`echo $path | grep -o 'librte_.*so'` ; done
80 echo 0 > /proc/sys/kernel/randomize_va_space
81 make install PREFIX=/usr
88 which $INSTALL_NSB_BIN/yajl > /dev/null
89 if [ -f "/usr/local/lib/libyajl.so.2.1.1" ]
91 echo "ovs stats libs already installed."
93 echo "installing ovs stats libraries"
97 git clone https://github.com/lloyd/yajl.git
107 ls $INSTALL_NSB_BIN/pmu-tools >/dev/null
110 echo "DPDK already installed. Done"
114 git clone https://github.com/andikleen/pmu-tools.git
117 sed -i -e 's/CFLAGS := -g -Wall -O2 -Wno-unused-result/CFLAGS := -g -Wall -O2 -Wno-unused-result -fPIC/g' Makefile
120 cd $INSTALL_NSB_BIN/pmu-tools
121 python event_download.py
125 which $INSTALL_NSB_BIN/collectd/collectd >/dev/null
128 echo "Collectd already installed. Done"
131 echo "Get collectd from repository and install..."
132 rm -rf collectd >/dev/null
133 git clone https://github.com/collectd/collectd.git
137 ./configure --with-libpqos=/usr/ --with-libdpdk=/usr --with-libyajl=/usr/local --with-libjevents=/usr/local --enable-debug --enable-dpdkstat --enable-virt --enable-ovs_stats --enable-intel_pmu --prefix=$INSTALL_NSB_BIN/collectd
138 make install > /dev/null
145 cp $INSTALL_NSB_BIN/collectd.conf /opt/collectd/etc/
146 sudo service rabbitmq-server restart
147 echo "Check if admin user already created"
148 rabbitmqctl list_users | grep '^admin$' > /dev/null
151 echo "'admin' user already created..."
153 echo "Creating 'admin' user for collectd data export..."
154 rabbitmqctl delete_user guest
155 rabbitmqctl add_user admin admin
156 rabbitmqctl authenticate_user admin admin
157 rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"