aboutsummaryrefslogtreecommitdiffstats
path: root/coin/provisioning/common/unix/telegraf_password.sh
diff options
context:
space:
mode:
authorDimitrios Apostolou <jimis@qt.io>2019-07-24 16:17:46 +0200
committerDimitrios Apostolou <jimis@qt.io>2019-09-27 08:42:31 +0200
commitfbe3a8d84e943b8e1ff89389bc6af9e09532722a (patch)
tree16feb9af6e1c6983e6a0c186ce1fcc6937d333c0 /coin/provisioning/common/unix/telegraf_password.sh
parent0a0ec7ffe33d8d646ad700b2b7b26541ee910420 (diff)
Install telegraf on all provisioned VMs
Install binaries as early as possible in the provisioning process, and start them, in order to monitor provisioning too. To achieve this, some OS auto-detection logic is introduced in shell script common.sourced.sh. The script can be sourced and used in all kind of other generic scripts. ioping is also installed from custom-compiled binaries in order to monitor the disk latency of the VMs. Reason we don't use ioping from the repositories, is that the units differ between ioping versions (new ioping reports latencies in nanoseconds, old in microseconds). Fixes: QTQAINFRA-3092 Change-Id: I9d9afb791955725d4bd0b32dae97dfc0bd4a76a3 Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
Diffstat (limited to 'coin/provisioning/common/unix/telegraf_password.sh')
-rwxr-xr-xcoin/provisioning/common/unix/telegraf_password.sh60
1 files changed, 60 insertions, 0 deletions
diff --git a/coin/provisioning/common/unix/telegraf_password.sh b/coin/provisioning/common/unix/telegraf_password.sh
new file mode 100755
index 00000000..efbed142
--- /dev/null
+++ b/coin/provisioning/common/unix/telegraf_password.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+#############################################################################
+##
+## Copyright (C) 2019 The Qt Company Ltd.
+## Contact: http://www.qt.io/licensing/
+##
+## This file is part of the provisioning scripts of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:LGPL21$
+## Commercial License Usage
+## Licensees holding valid commercial Qt licenses may use this file in
+## accordance with the commercial license agreement provided with the
+## Software or, alternatively, in accordance with the terms contained in
+## a written agreement between you and The Qt Company. For licensing terms
+## and conditions see http://www.qt.io/terms-conditions. For further
+## information use the contact form at http://www.qt.io/contact-us.
+##
+## GNU Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 2.1 or version 3 as published by the Free
+## Software Foundation and appearing in the file LICENSE.LGPLv21 and
+## LICENSE.LGPLv3 included in the packaging of this file. Please review the
+## following information to ensure the GNU Lesser General Public License
+## requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+##
+## As a special exception, The Qt Company gives you certain additional
+## rights. These rights are described in The Qt Company LGPL Exception
+## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+
+######################## BOILERPLATE ###########################
+set -e
+
+
+PROVISIONING_DIR="$(dirname "$0")/../../"
+. "$PROVISIONING_DIR"/common/unix/common.sourced.sh
+
+is_script_executed telegraf_password.sh \
+ || fatal "Script telegraf_password.sh should be executed, not sourced, to avoid leaking secrets in the logs"
+# Avoid leaking secrets in the logs
+set +x
+################################################################
+
+
+# Provisioning should run even without the secrets repository
+influxdb_password=$(cut -d : -f 2 ~qt/work/influxdb/coin_vms_writer.auth) \
+ || influxdb_password=no_password_provided
+
+rm -f ~qt/work/influxdb/coin_vms_writer.auth
+sed "s|COIN_VMS_WRITER_PASS|$influxdb_password|" \
+ "$PROVISIONING_DIR"/common/"$PROVISIONING_OS"/telegraf-coin.conf \
+ > .telegraf-coin.conf.final
+$CMD_INSTALL -m 600 .telegraf-coin.conf.final /etc/telegraf-coin.conf
+rm -f .telegraf-coin.conf.final