Compare commits

...

4 Commits

Author SHA1 Message Date
oleg 2b2056171e progress 2024-07-16 14:37:46 -04:00
oleg 913d971663 progress 2024-07-16 12:11:37 -04:00
oleg 0f6d7874de progress 2024-06-13 19:40:49 -04:00
oleg 769d8116d5 fix 2024-06-13 18:17:13 -04:00
3 changed files with 16 additions and 18 deletions
+1 -1
View File
@@ -1 +1 @@
0.8.2.1 0.8.5
+4 -4
View File
@@ -4,14 +4,14 @@ Python=/home/cvtt/.pyenv/python3.10-venv/bin/python3.10
RootDir=/home/cvtt/prod RootDir=/home/cvtt/prod
export PYTHONPATH=${RootDir} export PYTHONPATH=${RootDir}
host=$(hostname) host=${1}
if [ "${host}" == "cvttdata" ] if [ "${host}" == "cvttdata" ]
then then
ArchiveRootDir=/home/cvtt/prod/archive/md_archive ArchiveRootDir=/home/cvtt/prod/archive/md_archive/cvttdata
CredKey=TSDB_MD_CVTTDATA_RO CredKey=TSDB_MD_CVTTDATA_RO
elif [ "${host}" == "cloud21.cryptovaltrading.com" ] elif [ "${host}" == "cloud21" ]
then then
ArchiveRootDir=/opt/store/cvtt/archive/md_archive ArchiveRootDir=/home/cvtt/prod/archive/md_archive/cloud21
CredKey=TSDB_MD_CLD21_RO CredKey=TSDB_MD_CLD21_RO
else else
echo "Unknown host ${host}. ${0} Aborted." echo "Unknown host ${host}. ${0} Aborted."
+11 -13
View File
@@ -38,19 +38,13 @@ Metrics=()
TempFiles= TempFiles=
function cleanup { function cleanup {
echo Cleaing up temporary files: ${TempFiles}
if [ "" != "${TempFiles}" ]; then if [ "" != "${TempFiles}" ]; then
rm -f ${TempFiles} rm -f ${TempFiles}
fi fi
} }
trap cleanup EXIT trap cleanup EXIT
function new_tempfile {
tmpfile=$(mktemp)
TempFiles="${TempFiles} ${tmpfile}"
echo ${tmpfile}
}
function space_alert() { function space_alert() {
ALERT_USAGE=75% ALERT_USAGE=75%
for metric in "${Metrics[@]}" for metric in "${Metrics[@]}"
@@ -104,8 +98,12 @@ function storage_check() {
done done
} }
tmpfile=$(new_tempfile) tmpfile=$(mktemp)
tmpfile2=$(new_tempfile) TempFiles="${TempFiles} ${tmpfile}"
tmpfile2=$(mktemp)
TempFiles="${TempFiles} ${tmpfile2}"
storage_check > ${tmpfile2} storage_check > ${tmpfile2}
echo "## :card_file_box: STORAGE HEALTH CHECK" >> ${tmpfile} echo "## :card_file_box: STORAGE HEALTH CHECK" >> ${tmpfile}
@@ -115,14 +113,14 @@ echo "| --- | --- | --- |" >> ${tmpfile}
cat ${tmpfile2} | sort -h -r | awk -F'%' '{printf "%s%%%s\n",$2,$3}' >> ${tmpfile} cat ${tmpfile2} | sort -h -r | awk -F'%' '{printf "%s%%%s\n",$2,$3}' >> ${tmpfile}
cat ${tmpfile} | ${Sender} ${StatusChannel} cat ${tmpfile} | ${Sender} ${StatusChannel}
Measurements=() tmpfile=$(mktemp)
tmpfile=$(new_tempfile) TempFiles="${TempFiles} ${tmpfile}"
space_alert > ${tmpfile} space_alert > ${tmpfile}
cat ${tmpfile}
if [ -s ${tmpfile} ] if [ -s ${tmpfile} ]
then then
(echo "### :card_file_box: STORAGE ALERTS" && cat ${tmpfile}) | ${Sender} ${AlertChannel} (echo "### :card_file_box: STORAGE ALERTS" && cat ${tmpfile}) | ${Sender} ${AlertChannel}
else else
echo File ${tmpfile} is empty echo "No Storage Alerts"
fi fi