infra-role-icinga/files/node-canary-wrap.sh

14 lines
327 B
Bash

#!/usr/bin/env bash
set -o pipefail
# This is necessary because Icingaweb2 hates pipes in output
SCRIPT_DIR=$(cd `dirname $0` && pwd)
${SCRIPT_DIR}/node-canary $@ 2>&1 | sed 's/^[A-Z ]\+\[.*\] //'
EXIT_CODE=$?
if [[ ${EXIT_CODE} -ne 0 ]]; then
echo "Failed with args: $@"
echo "Exit code: ${EXIT_CODE}"
exit 2
fi