blob: bdc5abd032a611b3055b4ee55d57b696da6f9bc9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
#!/bin/bash
#
# Copyright (c) 2016-2017 Intel Corporation
#
# 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.
INSTALL_NSB_BIN="/opt/nsb_bin"
cd $INSTALL_NSB_BIN
if [ "$(whoami)" != "root" ]; then
echo "Must be root to run $0"
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 cmake libvirt-dev)
for i in "${pkg[@]}"; do
dpkg-query -W --showformat='${Status}\n' "${i}"|grep "install ok installed"
if [ "$?" -eq "1" ]; then
apt-get -y install "${i}";
fi
done
echo "Done"
if ldconfig -p | grep -q libpqos ; then
echo "Intel RDT library already installed. Done"
else
pushd .
echo "Get intel_rdt repo and install..."
rm -rf intel-cmt-cat >/dev/null
git clone https://github.com/01org/intel-cmt-cat.git
(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
popd
echo "Done."
fi
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"
else
pushd .
echo "Get collectd from repository and install..."
rm -rf collectd >/dev/null
git clone https://github.com/collectd/collectd.git
pushd collectd
git stash
./build.sh
./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."
popd
fi
modprobe msr
# we overwrite the config file during _start_collectd so don't copy it
#cp $INSTALL_NSB_BIN/collectd.conf /opt/nsb_bin/collectd/etc/
sudo service rabbitmq-server restart
echo "Check if admin user already created"
rabbitmqctl list_users | grep '^admin$' > /dev/null
if [ $? -eq 0 ];
then
echo "'admin' user already created..."
else
echo "Creating 'admin' user for collectd data export..."
rabbitmqctl delete_user guest
rabbitmqctl add_user admin admin
rabbitmqctl authenticate_user admin admin
rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
echo "Done"
fi
|