Skip to content
Snippets Groups Projects
install.sh 2.34 KiB
#!/bin/bash
#/////////////////////////////////////////////////////////////////////////
#//
#// (c) University of Southampton IT Innovation Centre, 2017
#//
#// Copyright in this software belongs to University of Southampton
#// IT Innovation Centre of Gamma House, Enterprise Road,
#// Chilworth Science Park, Southampton, SO16 7NS, UK.
#//
#// This software may not be used, sold, licensed, transferred, copied
#// or reproduced in whole or in part in any manner or form or in or
#// on any media by any person other than in accordance with the terms
#// of the Licence Agreement supplied with the software, or otherwise
#// without the prior written consent of the copyright owners.
#//
#// This software is distributed WITHOUT ANY WARRANTY, without even the
#// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
#// PURPOSE, except where stated in the Licence Agreement supplied with
#// the software.
#//
#//      Created By :            Michael Boniface
#//      Created Date :          13/12/2017
#//      Created for Project :   FLAME
#//
#/////////////////////////////////////////////////////////////////////////

# Force fail on command fail
set -euo pipefail

apt-get update
apt-get install wget -y

echo "Installing Telegraf agent"

TELEGRAF_VERSION=1.8.0~2736fa0-0
#TELEGRAF_VERSION=1.7.0~5618bb0-0

TELEGRAF_CHECKSUM=dc24932fa1aef9392582880c077dd2493b9f2c66babd7733a0654540bbb5003b

# Install telegraf
## wget https://dl.influxdata.com/telegraf/releases/telegraf_${TELEGRAF_VERSION}_amd64.deb 2> /dev/null

# load the runtime configuration for the artefact repository
if [ ! -f ${REPO_ROOT}/reporc ]; then
    echo "Cannot download telegraf binary: reporc file containing artefact repository credentials does not exist in ${REPO_ROOT}/reporc"
    exit 1
fi
source ${REPO_ROOT}/reporc

wget --user ${REPO_USER} --password ${REPO_PASS} https://flame-nexus.it-innovation.soton.ac.uk/repository/flame-general/it-innovation/telegraf/${TELEGRAF_VERSION}/telegraf-${TELEGRAF_VERSION}.deb -O telegraf-${TELEGRAF_VERSION}.deb


dpkg -i telegraf-${TELEGRAF_VERSION}.deb

# add telegraf to run as root for systemctl input plugin
# this should not be required as the "systemctl status" command is available to no priviledged users
# issued raised 
sed -i s/User=telegraf/User=root/g /lib/systemd/system/telegraf.service
systemctl daemon-reload
systemctl restart telegraf.service