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.
17 INSTALL_NSB_BIN="/opt/nsb_bin"
20 if [ "$(whoami)" != "root" ]; then
21 echo "Must be root to run $0"
25 echo "Install required libraries to run collectd..."
26 pkg=(git flex bison build-essential pkg-config automake autotools-dev libltdl-dev librabbitmq-dev rabbitmq-server)
27 for i in "${pkg[@]}"; do
28 dpkg-query -W --showformat='${Status}\n' "${i}"|grep "install ok installed"
29 if [ "$?" -eq "1" ]; then
30 apt-get -y install "${i}";
35 ldconfig -p | grep libpqos >/dev/null
38 echo "Intel RDT library already installed. Done"
42 echo "Get intel_rdt repo and install..."
43 rm -rf intel-cmt-cat >/dev/null
44 git clone https://github.com/01org/intel-cmt-cat.git
46 git checkout tags/v1.5 -b v1.5
47 make install PREFIX=/usr
54 which /opt/nsb_bin/collectd/collectd >/dev/null
57 echo "Collectd already installed. Done"
60 echo "Get collectd from repository and install..."
61 rm -rf collectd >/dev/null
62 git clone https://github.com/collectd/collectd.git
65 git checkout -b collectd 43a4db3b3209f497a0ba408aebf8aee385c6262d
67 ./configure --with-libpqos=/usr/
68 make install > /dev/null
75 cp $INSTALL_NSB_BIN/collectd.conf /opt/collectd/etc/
77 echo "Check if admin user already created"
78 rabbitmqctl list_users | grep '^admin$' > /dev/null
81 echo "'admin' user already created..."
83 echo "Creating 'admin' user for collectd data export..."
84 rabbitmqctl delete_user guest
85 rabbitmqctl add_user admin admin
86 rabbitmqctl authenticate_user admin admin
87 rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"