X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Fnetwork_services%2Fnfvi%2Fcollectd.sh;h=296c4a2131ed6e00d5c96de916621ffadeae1309;hb=a65eb4e43179dc4d75d0e2cf158cc73b9ad9a3b8;hp=7acb40431f888a1d845a8acba8d16be88f4d870b;hpb=ddb76faa5841997bd3eec4ed2f3d33f56e66d0c3;p=yardstick.git diff --git a/yardstick/network_services/nfvi/collectd.sh b/yardstick/network_services/nfvi/collectd.sh index 7acb40431..296c4a213 100755 --- a/yardstick/network_services/nfvi/collectd.sh +++ b/yardstick/network_services/nfvi/collectd.sh @@ -13,7 +13,6 @@ # 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. - INSTALL_NSB_BIN="/opt/nsb_bin" cd $INSTALL_NSB_BIN @@ -22,8 +21,18 @@ if [ "$(whoami)" != "root" ]; then exit 1; fi +echo "setup proxy..." +if [[ -n $1 ]]; then + export http_proxy=$1 + export https_proxy=$2 +fi + +if [[ -n $2 ]]; then + export https_proxy=$2 +fi + echo "Install required libraries to run collectd..." -pkg=(git flex bison build-essential pkg-config automake autotools-dev libltdl-dev librabbitmq-dev rabbitmq-server) +pkg=(git flex bison build-essential pkg-config automake autotools-dev libltdl-dev librabbitmq-dev rabbitmq-server cmake libvirt-dev) for i in "${pkg[@]}"; do dpkg-query -W --showformat='${Status}\n' "${i}"|grep "install ok installed" if [ "$?" -eq "1" ]; then @@ -32,9 +41,7 @@ dpkg-query -W --showformat='${Status}\n' "${i}"|grep "install ok installed" done echo "Done" -ldconfig -p | grep libpqos >/dev/null -if [ $? -eq 0 ] -then +if ldconfig -p | grep -q libpqos ; then echo "Intel RDT library already installed. Done" else pushd . @@ -42,8 +49,35 @@ else echo "Get intel_rdt repo and install..." rm -rf intel-cmt-cat >/dev/null git clone https://github.com/01org/intel-cmt-cat.git - pushd intel-cmt-cat - git checkout tags/v1.5 -b v1.5 + + (cd intel-cmt-cat; make install PREFIX=/usr) + + popd + echo "Done." +fi + +if [[ -r /usr/lib/libdpdk.so ]]; then + echo "DPDK already installed. Done" +else + pushd . + + echo "Get dpdk and install..." + mkdir -p $INSTALL_NSB_BIN + pushd dpdk-16.07 + mkdir -p /mnt/huge + mount -t hugetlbfs nodev /mnt/huge + sed -i 's/CONFIG_RTE_BUILD_SHARED_LIB=n/CONFIG_RTE_BUILD_SHARED_LIB=y/g' config/common_base + sed -i 's/CONFIG_RTE_EAL_PMD_PATH=""/CONFIG_RTE_EAL_PMD_PATH="\/usr\/lib\/dpdk-pmd\/"/g' config/common_base + + echo "Build dpdk v16.07" + make config T=x86_64-native-linuxapp-gcc + make + sudo make install prefix=/usr + mkdir -p /usr/lib/dpdk-pmd + 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 + + echo "Disable ASLR." + echo 0 > /proc/sys/kernel/randomize_va_space make install PREFIX=/usr popd @@ -51,7 +85,44 @@ else echo "Done." fi -which /opt/nsb_bin/collectd/collectd >/dev/null +which $INSTALL_NSB_BIN/yajl > /dev/null +if [ -f "/usr/local/lib/libyajl.so.2.1.1" ] +then + echo "ovs stats libs already installed." +else + echo "installing ovs stats libraries" + pushd . + + cd $INSTALL_NSB_BIN + git clone https://github.com/lloyd/yajl.git + pushd yajl + ./configure + make + make install + popd + + popd +fi + +ls $INSTALL_NSB_BIN/pmu-tools >/dev/null +if [ $? -eq 0 ] +then + echo "DPDK already installed. Done" +else + cd $INSTALL_NSB_BIN + + git clone https://github.com/andikleen/pmu-tools.git + cd pmu-tools + cd jevents + sed -i -e 's/CFLAGS := -g -Wall -O2 -Wno-unused-result/CFLAGS := -g -Wall -O2 -Wno-unused-result -fPIC/g' Makefile + make + sudo make install + cd $INSTALL_NSB_BIN/pmu-tools + python event_download.py +fi + +cd $INSTALL_NSB_BIN +which $INSTALL_NSB_BIN/collectd/collectd >/dev/null if [ $? -eq 0 ] then echo "Collectd already installed. Done" @@ -62,9 +133,8 @@ else git clone https://github.com/collectd/collectd.git pushd collectd git stash - git checkout -b collectd 43a4db3b3209f497a0ba408aebf8aee385c6262d ./build.sh - ./configure --with-libpqos=/usr/ + ./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 make install > /dev/null popd echo "Done." @@ -73,7 +143,7 @@ fi modprobe msr cp $INSTALL_NSB_BIN/collectd.conf /opt/collectd/etc/ - +sudo service rabbitmq-server restart echo "Check if admin user already created" rabbitmqctl list_users | grep '^admin$' > /dev/null if [ $? -eq 0 ];