diff options
author | Dimitrios Apostolou <jimis@qt.io> | 2019-07-24 16:17:46 +0200 |
---|---|---|
committer | Dimitrios Apostolou <jimis@qt.io> | 2019-09-27 08:42:31 +0200 |
commit | fbe3a8d84e943b8e1ff89389bc6af9e09532722a (patch) | |
tree | 16feb9af6e1c6983e6a0c186ce1fcc6937d333c0 /coin/provisioning/common/shared/telegraf/telegraf-ioping.sh | |
parent | 0a0ec7ffe33d8d646ad700b2b7b26541ee910420 (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/shared/telegraf/telegraf-ioping.sh')
-rw-r--r-- | coin/provisioning/common/shared/telegraf/telegraf-ioping.sh | 26 |
1 files changed, 26 insertions, 0 deletions
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 |