diff options
30 files changed, 686 insertions, 1 deletions
diff --git a/coin/provisioning/common/linux/devel_languages_go.SUSE_repo_key.pub b/coin/provisioning/common/linux/devel_languages_go.SUSE_repo_key.pub new file mode 100644 index 00000000..48162c56 --- /dev/null +++ b/coin/provisioning/common/linux/devel_languages_go.SUSE_repo_key.pub @@ -0,0 +1,19 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.5 (GNU/Linux) + +mQGiBEyvJq8RBAD64FtKbU3VFsZ4PAzcSi9rETc1qXZLVQYtrE38niriIJUuT/tC +kxGjkduD7ozP6rxL+M8fk9UdbbmzhHhXzQT2blyYy2iwpZP5+AFeQawz+oyMRVze +x6IY5qO31TiRu+aEBptk6nco4DULlKABlvtjKI+gJ4buJm+TumyrPaxe9wCgpFwl +O0fEjpOfQd+6Du0sCnPX7+8D/3xYVj9q5ILmrJ9zehBKjRYEcaP0rZVqudH51FUS +I0LQNHsJdzKLzhT+Zj7TJU4KnCN4sX7amfYL3GT9qyZEBDx2alubvEsI36wtNq0i +ewU4XmyZ+Rd7Q4mAPNoBGe5DsUA8wn/7iHGg9aJHu+GXvH7T3DVoUxW5W2KqPw+h +jzqGBACWGuuCefa683uf6aKqpTS3JB+01BDPf+sG9qJ+k7xcJOsEiXIe1X5vH9ov +kEvTM12kzY7SGwlsFsTDT1xioDl62g5nPlZMXErUBVnjoMtjl9bDwUPJY/vP1S9M +VaONBMoJEON3HRui9jhdEK25LTdrcFlFpRzJI3AgdXwy8aQyiLRGZGV2ZWw6bGFu +Z3VhZ2VzOmdvIE9CUyBQcm9qZWN0IDxkZXZlbDpsYW5ndWFnZXM6Z29AYnVpbGQu +b3BlbnN1c2Uub3JnPohmBBMRAgAmBQJc9DoCAhsDBQkUY8NTBgsJCAcDAgQVAggD +BBYCAwECHgECF4AACgkQr0z+TTB9e/lQZgCfXIjj30HyCPvUbSbSd6zOS0seAegA +n3DXayMpRphNmyJgLvl5qKfsX7f6iEYEExECAAYFAkyvJq8ACgkQOzARt2udZSOg +qQCeOba7kjk7CI+64GOkhhTGSdjnjdQAn2IC5tx+PW38XKwl3Jr5YVp0RyR0 +=AOj6 +-----END PGP PUBLIC KEY BLOCK----- diff --git a/coin/provisioning/common/linux/telegraf-coin.conf b/coin/provisioning/common/linux/telegraf-coin.conf new file mode 100644 index 00000000..33a9c6de --- /dev/null +++ b/coin/provisioning/common/linux/telegraf-coin.conf @@ -0,0 +1,47 @@ +[global_tags] +[agent] + interval = "10s" + round_interval = true + metric_batch_size = 100 + metric_buffer_limit = 10000 + collection_jitter = "0s" + flush_interval = "10s" + flush_jitter = "5s" + precision = "" + logfile = "/var/log/telegraf-coin.log" + hostname = "$COIN_UNIQUE_JOB_ID" + omit_hostname = false +[[outputs.influxdb]] + urls= ["https://qtinfluxdb01.intra.qt.io:8086"] + insecure_skip_verify = true + database = "coin_vms" + skip_database_creation = true + username = "coin_vms_writer" + password = "COIN_VMS_WRITER_PASS" +[[inputs.cpu]] + percpu = true + totalcpu = true + collect_cpu_time = false + report_active = false +[[inputs.disk]] + ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"] +[[inputs.diskio]] +[[inputs.kernel]] +[[inputs.mem]] +[[inputs.processes]] +[[inputs.swap]] +[[inputs.system]] +[[inputs.kernel_vmstat]] # linux-only +[[inputs.netstat]] + + +# Monitor Coin process +[[inputs.procstat]] + exe = "coin-" + pid_finder = "native" + + +# Monitor I/O latency +[[inputs.exec]] + data_format = "influx" + commands = [ "/usr/bin/telegraf-ioping.sh /" ] diff --git a/coin/provisioning/common/macos/telegraf-coin.conf b/coin/provisioning/common/macos/telegraf-coin.conf new file mode 100644 index 00000000..24440a05 --- /dev/null +++ b/coin/provisioning/common/macos/telegraf-coin.conf @@ -0,0 +1,51 @@ +[global_tags] +[agent] + interval = "10s" + round_interval = true + metric_batch_size = 100 + metric_buffer_limit = 10000 + collection_jitter = "0s" + flush_interval = "10s" + flush_jitter = "5s" + precision = "" + logfile = "/var/log/telegraf-coin.log" + hostname = "$COIN_UNIQUE_JOB_ID" + omit_hostname = false +[[outputs.influxdb]] + urls= ["https://qtinfluxdb01.intra.qt.io:8086"] + insecure_skip_verify = true + database = "coin_vms" + skip_database_creation = true + username = "coin_vms_writer" + password = "COIN_VMS_WRITER_PASS" +#[[inputs.cpu]] # linux-only +# percpu = true +# totalcpu = true +# collect_cpu_time = false +# report_active = false +[[inputs.disk]] + ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"] +#[[inputs.diskio]] # linux-only +[[inputs.kernel]] +[[inputs.mem]] +[[inputs.processes]] +[[inputs.swap]] +[[inputs.system]] +#[[inputs.kernel_vmstat]] # linux-only +[[inputs.netstat]] + + +# Monitor Coin process +[[inputs.procstat]] + exe = "coin-" + # Buggy on macOS if using the "native" pid_finder, see: + # https://github.com/influxdata/telegraf/issues/6265 + # Tested 1.12.1 version that "native" pid_finder has been fixed, + # but it is slow and times out frequently + pid_finder = "pgrep" + + +# Monitor I/O latency +[[inputs.exec]] + data_format = "influx" + commands = [ "/usr/bin/telegraf-ioping.sh /" ] diff --git a/coin/provisioning/common/shared/telegraf/influxdb.repo_key.pub b/coin/provisioning/common/shared/telegraf/influxdb.repo_key.pub new file mode 100644 index 00000000..c97d5933 --- /dev/null +++ b/coin/provisioning/common/shared/telegraf/influxdb.repo_key.pub @@ -0,0 +1,52 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1 + +mQINBFYJmwQBEADCw7mob8Vzk+DmkYyiv0dTU/xgoSlp4SQwrTzat8MB8jxmx60l +QjmhqEyuB8ho4zzZF9KV+gJWrG6Rj4t69JMTJWM7jFz+0B1PC7kJfNM+VcBmkTnj +fP+KJjqz50ETnsF0kQTG++UJeRYjG1dDK0JQNQJAM6NQpIWJI339lcDf15vzrMnb +OgIlNxV6j1ZZqkle4fvScF1NQxYScRiL+sRgVx92SI4SyD/xZnVGD/szB+4OCzah ++0Q/MnNGV6T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fl9LpJi5H8300cC7UyG94MUYbrXijbLTbnFTfNr1tGx4a1T/7Yyxx/wZGrT +H/X8cvNybkl33SxDdlQQ9kx3lFOwC41e3TkGsUWxn3TCfvDh8VdA6Py6JeSPFGOb +MEO2/q7oUgvjfV+ivN5ayZi9bWgeqm1sgtmTHHQ4RqwwKrAb5ynXpn1b9QrkevgT +b91uzMA22Prl4DuzKiaMYDcZOQ3vtf0eFBP0GOSSgUKS4bQ3dGgi1JmQ7VuAM4uj ++Ug5TnGoLwclTwLksc7v89C5MMPgm2vVXvCUDzyzQA7bIHFeX+Rziby4nymec4Nr +eeXYNBJWrEp8XR7UNWmEgroXRoN1x9/6esh5pnoUXGAIWuKzSLQM70/wWxS67+v2 +aC1GNb+pXXAzYeIIiyLWaZwCSr8sWMvshFT9REk2+lnb6sAeJswQtfTUWI00mVqZ +dvI3Wys2h0IyIejuwetTUvGhr9VgpqiLLfGzGlt/y2sg27wdHzSJbMh0VrVAK26/ +BlvEwWDCFT0ZJUMG9Lvre25DD0ycbougLsRYjzmGb/3k3UktS3XTCxyBa/k3TPw3 +vqIHrEqk446nGPDqJPS5 +=9iF7 +-----END PGP PUBLIC KEY BLOCK----- diff --git a/coin/provisioning/common/shared/telegraf/telegraf-ioping.sh b/coin/provisioning/common/shared/telegraf/telegraf-ioping.sh new file mode 100644 index 00000000..ad95eadc --- /dev/null +++ b/coin/provisioning/common/shared/telegraf/telegraf-ioping.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# Measure I/O latency once, return data in InfluxDB format +# +# Run one ioping command for read, and one for write. +# Each one sends 3 requests and reports the minimum time, in nanoseconds. +# (Because of limitations of ioping, we can't just send one request and get +# the number back in the batch format. Additionally, the number seems to be +# fluctuating quite a bit so taking the smallest number out of 3 requests is +# stabilising it a bit.) + + +set -e + +[ x"$1" = x ] && echo "$0 takes a path as a first argument" && exit 1 + +# Try to run in high priority to avoid slow-downs because of +# factors other than I/O. +renice -n -10 -p $$ >/dev/null 2>&1 || true + + +rlatency="$(ioping -B -k -c 3 -i 0.1 "$1" | cut -d " " -f 5)" +wlatency="$(ioping -B -k -c 3 -i 0.1 -W "$1" | cut -d " " -f 5)" + +printf "ioping,path=$1 read_latency_ns=%u,write_latency_ns=%u\n" \ + $rlatency $wlatency diff --git a/coin/provisioning/common/shared/telegraf/telegraf_packages.sha256.txt b/coin/provisioning/common/shared/telegraf/telegraf_packages.sha256.txt new file mode 100644 index 00000000..7d1cdada --- /dev/null +++ b/coin/provisioning/common/shared/telegraf/telegraf_packages.sha256.txt @@ -0,0 +1,6 @@ +https://dl.influxdata.com/telegraf/releases/telegraf-1.12.1_windows_i386.zip d2dea67a28fd7a9e21395d14f0b7ce1b6413e85cc9ffd89cc7ff8f35e8af5837 +https://dl.influxdata.com/telegraf/releases/telegraf-1.12.1_windows_amd64.zip 88d8c8146b561f43726e61688b42d0b5ab88fc22607b94df5a2c8245bbb27e29 +https://dl.influxdata.com/telegraf/releases/telegraf-1.12.1_darwin_amd64.tar.gz 58a2b294c1b6408c396b5526719cf7cad557f7075fed10ff0b2a74141ea2d629 +https://dl.influxdata.com/telegraf/releases/telegraf-1.12.1_linux_amd64.tar.gz 070a76800d1a5f33413b8948286f75caa55ebd924f6fb6996a753b9979799ef5 +https://dl.influxdata.com/telegraf/releases/telegraf-1.12.1_linux_i386.tar.gz 964077b6846708f579a100d7ea6090e2d8350ace75ec735d539bc452bc551038 +https://dl.influxdata.com/telegraf/releases/telegraf-1.12.1-static_linux_amd64.tar.gz bb03814c99c037ce0758e3884660910f2f6fd78f3d49a8e1ef531693b3cfe25d diff --git a/coin/provisioning/common/unix/common.sourced.sh b/coin/provisioning/common/unix/common.sourced.sh new file mode 100644 index 00000000..a52880b2 --- /dev/null +++ b/coin/provisioning/common/unix/common.sourced.sh @@ -0,0 +1,139 @@ +#!/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$ +## +############################################################################# + + +# Script to be sourced from everywhere you need a common environment. Defines: +export PROVISIONING_DIR +export PROVISIONING_OS +export PROVISIONING_OS_ID +export PROVISIONING_ARCH +export CMD_PKG_INSTALL +export CMD_PKG_LOCALINSTALL +export CMD_INSTALL + + + +if [ x"$IS_PROVISIONING_COMMON_SOURCED" != x ] +then + echo "common.sourced.sh has already been sourced, re-sourcing skipped" + return +fi + +# Do not export; you want children to re-source, because they only inherit the +# variables but not the functions +IS_PROVISIONING_COMMON_SOURCED=1 + + +fatal () { + echo "$1" 1>&2 + if [ x"$2" != x ] + then exit "$2" + else exit + fi +} + +is_script_executed () { + [ x"$(basename "$0")" = x"$1" ] +} + + +is_script_executed common.sourced.sh \ + && fatal "Script common.sourced.sh should always be sourced, not executed" + + +set_common_environment () { + # Unfortunately we can't find the provisioning directory from a sourced + # script in a portable way + # PROVISIONING_DIR="$(dirname "$0")/../../" + + [ x"$PROVISIONING_DIR" = x ] \ + && fatal "PROVISIONING_DIR variable needs to be set before calling set_common_environment" + + uname_s="$(uname -s)" + case "$uname_s" in + Linux) + PROVISIONING_OS=linux + . /etc/os-release + PROVISIONING_OS_ID="$ID" + case "$PROVISIONING_OS_ID" in + suse|sles|opensuse*) + CMD_PKG_INSTALL="sudo zypper -nq install" + CMD_PKG_LOCALINSTALL="sudo zypper --no-gpg-checks -nq install" + ;; + debian|ubuntu) + CMD_PKG_INSTALL="sudo apt -y install" + CMD_PKG_LOCALINSTALL="sudo apt -y install" + ;; + rhel|centos|fedora) + CMD_PKG_INSTALL="sudo yum -y install" + CMD_PKG_LOCALINSTALL="sudo yum -y --nogpgcheck localinstall" + ;; + *) fatal "Unknown ID in /etc/os-release: $PROVISIONING_OS_ID" ;; + esac + ;; + Darwin) + PROVISIONING_OS=macos + PROVISIONING_OS_ID=macos + CMD_PKG_INSTALL="brew install" + CMD_PKG_LOCALINSTALL="echo 'TODO how to install a package file on macOS'" + ;; + *) + fatal "Unknown system in uname: $uname_s" 42 + ;; + esac + + uname_m="$(uname -m)" + case "$uname_m" in + x86_64|amd64) PROVISIONING_ARCH=amd64 ;; + i[3456]86) PROVISIONING_ARCH=x86 ;; + *) fatal "Unknown architecture in uname: $uname_m" 43 ;; + esac + + CMD_INSTALL="sudo install" +} + +set_common_environment + +set_dry_run () { + if [ x"$PROVISIONING_DRY_RUN" != x ] + then + CMD_PKG_INSTALL="echo DRYRUN: $CMD_PKG_INSTALL" + CMD_PKG_LOCALINSTALL="echo DRYRUN: $CMD_PKG_LOCALINSTALL" + CMD_INSTALL="echo DRYRUN: $CMD_INSTALL" + fi +} + +set_dry_run diff --git a/coin/provisioning/common/unix/telegraf_install.sh b/coin/provisioning/common/unix/telegraf_install.sh new file mode 100755 index 00000000..1412650e --- /dev/null +++ b/coin/provisioning/common/unix/telegraf_install.sh @@ -0,0 +1,98 @@ +#!/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$ +## +############################################################################# + + +# This script installs telegraf and ioping and our script telegraf-ioping.sh +# to the /usr/bin directory. +# +# The reasons we don't install to /usr/local/bin are: +# 1. On SLES and RHEL, the PATH of sudo (secure_path setting in /etc/sudoers) +# does not include /usr/local/bin. +# 2. On macOS /usr/local/bin does not even exist early in provisioning. + + +######################## BOILERPLATE ########################### +set -e + + +PROVISIONING_DIR="$(dirname "$0")/../../" +. "$PROVISIONING_DIR"/common/unix/common.sourced.sh + +. "$PROVISIONING_DIR"/common/unix/DownloadURL.sh + +is_script_executed telegraf_install.sh \ + || fatal "Script telegraf_install.sh should be executed, not sourced" + +################################################################ + + +[ "$PROVISIONING_OS" = linux ] \ + && ioping_sha256=259abf04bcb84f4126ff97c04b6651e1cf5ea6d8a9ff364c769a26c95b6eeb44 \ + || ioping_sha256=55de6a2f1a5343e0ce8df31d82d47a9e79c7e612edbc6dfb39b5fc6fb358b2e3 +DownloadURL "http://ci-files01-hki.intra.qt.io/input/ioping/ioping.${PROVISIONING_OS}-${PROVISIONING_ARCH}" \ + '' "$ioping_sha256" ioping +$CMD_INSTALL -m 755 ./ioping /usr/bin/ +rm -f ioping + +# 2. Install custom ioping monitoring script +$CMD_INSTALL -m 755 "$PROVISIONING_DIR"/common/shared/telegraf/telegraf-ioping.sh /usr/bin/ + +# 3. Download and install telegraf + +[ x"$PROVISIONING_OS" = xmacos ] && os=darwin || os=linux +[ x"$PROVISIONING_ARCH" = xx86 ] && arch=i386 || arch=amd64 +package_filename=telegraf-1.12.1_${os}_${arch}.tar.gz +package_sha256_list="$PROVISIONING_DIR"/common/shared/telegraf/telegraf_packages.sha256.txt +package_sha256=$(sed -n "s/.*$package_filename *//p" "$package_sha256_list") + +DownloadURL \ + http://ci-files01-hki.intra.qt.io/input/telegraf/"$package_filename" \ + https://dl.influxdata.com/telegraf/releases/"$package_filename" \ + "$package_sha256" \ + telegraf.tar.gz + +tar -xzf ./telegraf.tar.gz -C /tmp +telegraf_binary=$(find /tmp/telegraf* -name telegraf -type f | grep /bin/ | head -1) +$CMD_INSTALL -m 755 "$telegraf_binary" /usr/bin/ +rm -rf /tmp/telegraf* + +# 4. Edit config file with passwords +"$PROVISIONING_DIR"/common/unix/telegraf_password.sh + +# 5. Start telegraf in background (-b) and with retaining the environment (-E) +# in order to report as hostname = $COIN_UNIQUE_JOB_ID. +/usr/bin/sudo -b -E telegraf --config /etc/telegraf-coin.conf >/dev/null 2>&1 + +echo DONE: "Installed and started telegraf: $package_filename" 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 diff --git a/coin/provisioning/common/windows/helpers.ps1 b/coin/provisioning/common/windows/helpers.ps1 index 0f39beed..3ccb42ac 100644 --- a/coin/provisioning/common/windows/helpers.ps1 +++ b/coin/provisioning/common/windows/helpers.ps1 @@ -3,7 +3,7 @@ function Verify-Checksum Param ( [string]$File=$(throw("You must specify a filename to get the checksum of.")), [string]$Expected=$(throw("Checksum required")), - [ValidateSet("sha1","md5")][string]$Algorithm="sha1" + [ValidateSet("sha256","sha1","md5")][string]$Algorithm="sha1" ) Write-Host "Verifying checksum of $File" $fs = new-object System.IO.FileStream $File, "Open" diff --git a/coin/provisioning/common/windows/install_telegraf.ps1 b/coin/provisioning/common/windows/install_telegraf.ps1 new file mode 100644 index 00000000..258c6c59 --- /dev/null +++ b/coin/provisioning/common/windows/install_telegraf.ps1 @@ -0,0 +1,68 @@ +############################################################################# +## +## 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$ +## +############################################################################# + +. "$PSScriptRoot\..\..\common\windows\helpers.ps1" + + +# Install a specific version of Telegraf +# https://github.com/influxdata/telegraf/releases + +$version = "1.12.1" + +if (Is64BitWinHost) { + $arch = "amd64" + $sha256 = "88d8c8146b561f43726e61688b42d0b5ab88fc22607b94df5a2c8245bbb27e29" +} else { + $arch = "i386" + $sha256 = "d2dea67a28fd7a9e21395d14f0b7ce1b6413e85cc9ffd89cc7ff8f35e8af5837" +} + +$filename = "telegraf-" + $version + "_windows_" + $arch + ".zip" + +$url_cache = "\\ci-files01-hki.intra.qt.io\provisioning\windows\" + $filename +$url_official = "https://dl.influxdata.com/telegraf/releases/" + $filename +$tempfile = "C:\Windows\Temp\" + $filename + +Write-Host "Fetching Telegraf $version..." +Download $url_official $url_cache $tempfile +Verify-Checksum $tempfile $sha256 sha256 + +Write-Host "Installing telegraf.exe under C:\Utils\telegraf" +Extract-7Zip $tempfile C:\Utils "telegraf" +Copy-Item "$PSScriptRoot\..\..\common\windows\telegraf-coin.conf" C:\telegraf-coin.conf + +. "$PSScriptRoot\telegraf_password.ps1" + +Start-Process -FilePath C:\Utils\telegraf\telegraf.exe -ArgumentList "--config C:\telegraf-coin.conf" + +Write-Output "Telegraf = $version" >> ~\versions.txt diff --git a/coin/provisioning/common/windows/telegraf-coin.conf b/coin/provisioning/common/windows/telegraf-coin.conf new file mode 100644 index 00000000..9a4d22e8 --- /dev/null +++ b/coin/provisioning/common/windows/telegraf-coin.conf @@ -0,0 +1,41 @@ +[global_tags] +[agent] + interval = "10s" + round_interval = true + metric_batch_size = 100 + metric_buffer_limit = 10000 + collection_jitter = "0s" + flush_interval = "10s" + flush_jitter = "5s" + precision = "" + logfile = "C:\\telegraf-coin.log" + hostname = "$COIN_UNIQUE_JOB_ID" + omit_hostname = false +[[outputs.influxdb]] + urls= ["https://qtinfluxdb01.intra.qt.io:8086"] + insecure_skip_verify = true + database = "coin_vms" + skip_database_creation = true + username = "coin_vms_writer" + password = "COIN_VMS_WRITER_PASS" +[[inputs.cpu]] + percpu = true + totalcpu = true + collect_cpu_time = false + report_active = false +[[inputs.disk]] + ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"] +[[inputs.diskio]] +[[inputs.kernel]] +[[inputs.mem]] +#[[inputs.processes]] +[[inputs.swap]] +[[inputs.system]] +#[[inputs.kernel_vmstat]] # linux-only +[[inputs.netstat]] + + +# Monitor Coin process +[[inputs.procstat]] + exe = "coin-" + pid_finder = "native" diff --git a/coin/provisioning/common/windows/telegraf_password.ps1 b/coin/provisioning/common/windows/telegraf_password.ps1 new file mode 100644 index 00000000..11d04dbc --- /dev/null +++ b/coin/provisioning/common/windows/telegraf_password.ps1 @@ -0,0 +1,39 @@ +############################################################################# +## +## 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$ +## +############################################################################# + + +$colon_file = Get-Content "C:\Users\qt\work\influxdb\coin_vms_writer.auth" +$influxdb_password = $colon_file.Substring($colon_file.LastIndexOf(':') + 1) +$telegraf_conf = "C:\telegraf-coin.conf" +(Get-Content $telegraf_conf) | ForEach-Object { $_.Replace("COIN_VMS_WRITER_PASS", $influxdb_password) } | Out-File -Encoding UTF8 $telegraf_conf +Remove-Item "C:\Users\qt\work\influxdb\coin_vms_writer.auth" diff --git a/coin/provisioning/qtci-linux-RHEL-6.6-x86_64/04-install_telegraf.sh b/coin/provisioning/qtci-linux-RHEL-6.6-x86_64/04-install_telegraf.sh new file mode 100755 index 00000000..729f9003 --- /dev/null +++ b/coin/provisioning/qtci-linux-RHEL-6.6-x86_64/04-install_telegraf.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +"$(dirname "$0")"/../common/unix/telegraf_install.sh diff --git a/coin/provisioning/qtci-linux-RHEL-7.4-x86_64/04-install_telegraf.sh b/coin/provisioning/qtci-linux-RHEL-7.4-x86_64/04-install_telegraf.sh new file mode 100755 index 00000000..729f9003 --- /dev/null +++ b/coin/provisioning/qtci-linux-RHEL-7.4-x86_64/04-install_telegraf.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +"$(dirname "$0")"/../common/unix/telegraf_install.sh diff --git a/coin/provisioning/qtci-linux-SLES-12-x86_64/04-install_telegraf.sh b/coin/provisioning/qtci-linux-SLES-12-x86_64/04-install_telegraf.sh new file mode 100755 index 00000000..729f9003 --- /dev/null +++ b/coin/provisioning/qtci-linux-SLES-12-x86_64/04-install_telegraf.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +"$(dirname "$0")"/../common/unix/telegraf_install.sh diff --git a/coin/provisioning/qtci-linux-SLES-15-x86_64/04-install_telegraf.sh b/coin/provisioning/qtci-linux-SLES-15-x86_64/04-install_telegraf.sh new file mode 100755 index 00000000..729f9003 --- /dev/null +++ b/coin/provisioning/qtci-linux-SLES-15-x86_64/04-install_telegraf.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +"$(dirname "$0")"/../common/unix/telegraf_install.sh diff --git a/coin/provisioning/qtci-linux-Ubuntu-16.04-x86/04-install_telegraf.sh b/coin/provisioning/qtci-linux-Ubuntu-16.04-x86/04-install_telegraf.sh new file mode 100755 index 00000000..729f9003 --- /dev/null +++ b/coin/provisioning/qtci-linux-Ubuntu-16.04-x86/04-install_telegraf.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +"$(dirname "$0")"/../common/unix/telegraf_install.sh diff --git a/coin/provisioning/qtci-linux-Ubuntu-16.04-x86_64/04-install_telegraf.sh b/coin/provisioning/qtci-linux-Ubuntu-16.04-x86_64/04-install_telegraf.sh new file mode 100755 index 00000000..729f9003 --- /dev/null +++ b/coin/provisioning/qtci-linux-Ubuntu-16.04-x86_64/04-install_telegraf.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +"$(dirname "$0")"/../common/unix/telegraf_install.sh diff --git a/coin/provisioning/qtci-linux-Ubuntu-18.04-x86_64/04-install_telegraf.sh b/coin/provisioning/qtci-linux-Ubuntu-18.04-x86_64/04-install_telegraf.sh new file mode 100755 index 00000000..729f9003 --- /dev/null +++ b/coin/provisioning/qtci-linux-Ubuntu-18.04-x86_64/04-install_telegraf.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +"$(dirname "$0")"/../common/unix/telegraf_install.sh diff --git a/coin/provisioning/qtci-linux-openSUSE-42.3-x86_64/04-install_telegraf.sh b/coin/provisioning/qtci-linux-openSUSE-42.3-x86_64/04-install_telegraf.sh new file mode 100755 index 00000000..729f9003 --- /dev/null +++ b/coin/provisioning/qtci-linux-openSUSE-42.3-x86_64/04-install_telegraf.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +"$(dirname "$0")"/../common/unix/telegraf_install.sh diff --git a/coin/provisioning/qtci-macos-10.12-x86_64/26-install_telegraf.sh b/coin/provisioning/qtci-macos-10.12-x86_64/26-install_telegraf.sh new file mode 100755 index 00000000..729f9003 --- /dev/null +++ b/coin/provisioning/qtci-macos-10.12-x86_64/26-install_telegraf.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +"$(dirname "$0")"/../common/unix/telegraf_install.sh diff --git a/coin/provisioning/qtci-macos-10.13-x86_64/26-install_telegraf.sh b/coin/provisioning/qtci-macos-10.13-x86_64/26-install_telegraf.sh new file mode 100755 index 00000000..729f9003 --- /dev/null +++ b/coin/provisioning/qtci-macos-10.13-x86_64/26-install_telegraf.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +"$(dirname "$0")"/../common/unix/telegraf_install.sh diff --git a/coin/provisioning/qtci-macos-10.14-x86_64/26-install_telegraf.sh b/coin/provisioning/qtci-macos-10.14-x86_64/26-install_telegraf.sh new file mode 100755 index 00000000..729f9003 --- /dev/null +++ b/coin/provisioning/qtci-macos-10.14-x86_64/26-install_telegraf.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +"$(dirname "$0")"/../common/unix/telegraf_install.sh diff --git a/coin/provisioning/qtci-windows-10-x86/05-install_telegraf.ps1 b/coin/provisioning/qtci-windows-10-x86/05-install_telegraf.ps1 new file mode 100644 index 00000000..77fa8cbf --- /dev/null +++ b/coin/provisioning/qtci-windows-10-x86/05-install_telegraf.ps1 @@ -0,0 +1 @@ +. "$PSScriptRoot\..\common\windows\install_telegraf.ps1" diff --git a/coin/provisioning/qtci-windows-10-x86_64/05-install_telegraf.ps1 b/coin/provisioning/qtci-windows-10-x86_64/05-install_telegraf.ps1 new file mode 100644 index 00000000..77fa8cbf --- /dev/null +++ b/coin/provisioning/qtci-windows-10-x86_64/05-install_telegraf.ps1 @@ -0,0 +1 @@ +. "$PSScriptRoot\..\common\windows\install_telegraf.ps1" diff --git a/coin/provisioning/qtci-windows-7-x86/05-install_telegraf.ps1 b/coin/provisioning/qtci-windows-7-x86/05-install_telegraf.ps1 new file mode 100644 index 00000000..77fa8cbf --- /dev/null +++ b/coin/provisioning/qtci-windows-7-x86/05-install_telegraf.ps1 @@ -0,0 +1 @@ +. "$PSScriptRoot\..\common\windows\install_telegraf.ps1" diff --git a/coin/provisioning/qtci-windows-7-x86_64/05-install_telegraf.ps1 b/coin/provisioning/qtci-windows-7-x86_64/05-install_telegraf.ps1 new file mode 100644 index 00000000..77fa8cbf --- /dev/null +++ b/coin/provisioning/qtci-windows-7-x86_64/05-install_telegraf.ps1 @@ -0,0 +1 @@ +. "$PSScriptRoot\..\common\windows\install_telegraf.ps1" diff --git a/coin/provisioning/qtci-windows-8.1-x86/05-install_telegraf.ps1 b/coin/provisioning/qtci-windows-8.1-x86/05-install_telegraf.ps1 new file mode 100644 index 00000000..77fa8cbf --- /dev/null +++ b/coin/provisioning/qtci-windows-8.1-x86/05-install_telegraf.ps1 @@ -0,0 +1 @@ +. "$PSScriptRoot\..\common\windows\install_telegraf.ps1" diff --git a/coin/provisioning/qtci-windows-8.1-x86_64/05-install_telegraf.ps1 b/coin/provisioning/qtci-windows-8.1-x86_64/05-install_telegraf.ps1 new file mode 100644 index 00000000..77fa8cbf --- /dev/null +++ b/coin/provisioning/qtci-windows-8.1-x86_64/05-install_telegraf.ps1 @@ -0,0 +1 @@ +. "$PSScriptRoot\..\common\windows\install_telegraf.ps1" |