2
# Commands to be run on a juju controller apiserver to enable system
7
collectd_config_file=$1
8
runner_script_output_path=$2
10
cat <<EOF > ${runner_script_output_path}
11
password=`sudo grep oldpassword /var/lib/juju/agents/machine-*/agent.conf | cut -d" " -f2`
12
mongostat --host=127.0.0.1:37017 \
13
--authenticationDatabase admin \
15
--sslAllowInvalidCertificates \
16
--username \"admin\" \
17
--password \"\$password\" \
18
--noheaders 5 > /tmp/mongodb-stats.log 2> /tmp/mongodb-error.log
21
sudo apt-get install -y collectd-core
22
sudo mkdir /etc/collectd/collectd.conf.d
23
sudo cp ${collectd_config_file} /etc/collectd/collectd.conf
24
sudo /etc/init.d/collectd restart
26
sudo echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/testing multiverse" | sudo tee /etc/apt/sources.list.d/mongo-org.list
28
sudo apt-get install --yes --allow-unauthenticated mongodb-org-tools=3.2.10~rc2 daemon
29
sudo chmod +x ${runner_script_output_path}