Compare commits

..

8 Commits

Author SHA1 Message Date
oleg a0cf2531e6 progress 2024-07-17 09:14:22 -04:00
oleg ada2a74eb6 fix 2024-07-16 15:11:14 -04:00
oleg 7dec83b190 fix 2024-07-16 14:51:21 -04:00
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
oleg a7ad7f45f5 fix 2024-06-13 18:13:27 -04:00
5 changed files with 54 additions and 19 deletions
+36
View File
@@ -0,0 +1,36 @@
-------------------------------------
C R Y P T O M A R K E T D A T A
-------------------------------------
============
Exchanges
============
|
v
============
Databases
============
| TimescaleDB: cloud21
| TimescaleDB: cvttdata
v
================
Daily Archive
================
| created by crontabs:
| cvttdata:
| /home/cvtt/prod/utils/archive_yesterday_md.sh cloud21
| /home/cvtt/prod/utils/archive_yesterday_md.sh cvttdata
| stored in:
| /home/cvtt/prod/archive/md_archive/crypto/cloud21
| /home/cvtt/prod/archive/md_archive/crypto/cvttdata
|
v
==========
Storage
==========
| created by crontabs:
| cvttdata:
|
v
==========
Usage
==========
+1 -1
View File
@@ -1 +1 @@
0.8.2 0.8.8
+1 -1
View File
@@ -48,7 +48,7 @@ export PYTHONPATH=/home/cvtt/prod
export Python=/home/cvtt/.pyenv/python3.10-venv/bin/python3 export Python=/home/cvtt/.pyenv/python3.10-venv/bin/python3
export Config=http://cloud16.cvtt.vpn:6789/apps/minimal_md export Config=http://cloud16.cvtt.vpn:6789/apps/minimal_md
export PyScript=/home/cvtt/prod/cvttpy/exchanges/alpaca/hist_md/hist_md_bars.py export PyScript=/home/cvtt/prod/cvttpy/exchanges/alpaca/hist_md/hist_md_bars.py
export OutputDir=/home/cvtt/host_drive/alpaca_md # Local export OutputDir=/home/cvtt/prod/archive/equities/alpaca_md # Local
export LogDir=/home/cvtt/prod/logs/alpaca_md export LogDir=/home/cvtt/prod/logs/alpaca_md
# ----- T E M P # ----- T E M P
+5 -5
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/crypto/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/crypto/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."
@@ -21,7 +21,7 @@ fi
mkdir -p ${ArchiveRootDir} mkdir -p ${ArchiveRootDir}
yesterday=$(date -d "yesterday" +%Y%m%d) yesterday=$(date -d "yesterday" +%Y%m%d)
Schemas=${1} Schemas=${2}
if [ "${Schemas}" == "" ] if [ "${Schemas}" == "" ]
then then
Schemas="coinbase,bnbspot,bnbfut" Schemas="coinbase,bnbspot,bnbfut"
+11 -12
View File
@@ -38,18 +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}"
}
function space_alert() { function space_alert() {
ALERT_USAGE=75% ALERT_USAGE=75%
for metric in "${Metrics[@]}" for metric in "${Metrics[@]}"
@@ -103,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}
@@ -114,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