diff --git a/release_version.txt b/release_version.txt index 5ee5d6a..100435b 100644 --- a/release_version.txt +++ b/release_version.txt @@ -1 +1 @@ -0.8.1.1 +0.8.2 diff --git a/scripts/healthcheck/storage_health_check.sh b/scripts/healthcheck/storage_health_check.sh index 421ac57..f32d76d 100755 --- a/scripts/healthcheck/storage_health_check.sh +++ b/scripts/healthcheck/storage_health_check.sh @@ -35,6 +35,20 @@ Hosts="${Hosts} cvtt-prod-02.cvtt.vpn" Hosts="${Hosts} cvtt-prod-03.cvtt.vpn" Metrics=() +TempFiles= + +function cleanup { + if [ "" != "${TempFiles}" ]; then + rm -f ${TempFiles} + fi +} +trap cleanup EXIT + + +function new_tempfile { + tmpfile=$(mktemp) + TempFiles="${TempFiles} ${tmpfile}" +} function space_alert() { ALERT_USAGE=75% @@ -45,8 +59,6 @@ function space_alert() { fs=${args[1]} space_used=${args[2]} - echo "if [ ${space_used%?} -ge ${ALERT_USAGE%?} ]; then" >&2 - if [ ${space_used%?} -ge ${ALERT_USAGE%?} ]; then echo ":red_circle: Filesystem **${host}:${fs}** is using **${space_used}** :red_circle:" fi @@ -91,8 +103,8 @@ function storage_check() { done } -tmpfile=$(mktemp) -tmpfile2=$(mktemp) +tmpfile=$(new_tempfile) +tmpfile2=$(new_tempfile) storage_check > ${tmpfile2} echo "## :card_file_box: STORAGE HEALTH CHECK" >> ${tmpfile} @@ -101,10 +113,9 @@ echo "| host | filesystem | usage |" >> ${tmpfile} echo "| --- | --- | --- |" >> ${tmpfile} cat ${tmpfile2} | sort -h -r | awk -F'%' '{printf "%s%%%s\n",$2,$3}' >> ${tmpfile} cat ${tmpfile} | ${Sender} ${StatusChannel} -rm ${tmpfile} ${tmpfile2} Measurements=() -tmpfile=$(mktemp) +tmpfile=$(new_tempfile) space_alert > ${tmpfile} cat ${tmpfile} if [ -s ${tmpfile} ] @@ -113,5 +124,4 @@ then else echo File ${tmpfile} is empty fi -rm ${tmpfile}