Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ada2a74eb6 | |||
| 7dec83b190 | |||
| 2b2056171e | |||
| 913d971663 | |||
| 0f6d7874de | |||
| 769d8116d5 | |||
| a7ad7f45f5 | |||
| 0e6190f999 | |||
| 180e3f89cf | |||
| 80bbf47755 |
+1
-1
@@ -1 +1 @@
|
||||
0.7.9
|
||||
0.8.7
|
||||
|
||||
@@ -48,7 +48,7 @@ export PYTHONPATH=/home/cvtt/prod
|
||||
export Python=/home/cvtt/.pyenv/python3.10-venv/bin/python3
|
||||
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 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
|
||||
|
||||
# ----- T E M P
|
||||
|
||||
@@ -4,14 +4,14 @@ Python=/home/cvtt/.pyenv/python3.10-venv/bin/python3.10
|
||||
RootDir=/home/cvtt/prod
|
||||
export PYTHONPATH=${RootDir}
|
||||
|
||||
host=$(hostname)
|
||||
host=${1}
|
||||
if [ "${host}" == "cvttdata" ]
|
||||
then
|
||||
ArchiveRootDir=/home/cvtt/prod/archive/md_archive
|
||||
ArchiveRootDir=/home/cvtt/prod/archive/md_archive/cvttdata
|
||||
CredKey=TSDB_MD_CVTTDATA_RO
|
||||
elif [ "${host}" == "cloud21.cryptovaltrading.com" ]
|
||||
elif [ "${host}" == "cloud21" ]
|
||||
then
|
||||
ArchiveRootDir=/opt/store/cvtt/archive/md_archive
|
||||
ArchiveRootDir=/home/cvtt/prod/archive/md_archive/cloud21
|
||||
CredKey=TSDB_MD_CLD21_RO
|
||||
else
|
||||
echo "Unknown host ${host}. ${0} Aborted."
|
||||
@@ -21,7 +21,7 @@ fi
|
||||
mkdir -p ${ArchiveRootDir}
|
||||
|
||||
yesterday=$(date -d "yesterday" +%Y%m%d)
|
||||
Schemas=${1}
|
||||
Schemas=${2}
|
||||
if [ "${Schemas}" == "" ]
|
||||
then
|
||||
Schemas="coinbase,bnbspot,bnbfut"
|
||||
|
||||
@@ -34,14 +34,26 @@ Hosts="${Hosts} cvtt-prod-01.cvtt.vpn"
|
||||
Hosts="${Hosts} cvtt-prod-02.cvtt.vpn"
|
||||
Hosts="${Hosts} cvtt-prod-03.cvtt.vpn"
|
||||
|
||||
Metrics=()
|
||||
TempFiles=
|
||||
|
||||
function cleanup {
|
||||
echo Cleaing up temporary files: ${TempFiles}
|
||||
if [ "" != "${TempFiles}" ]; then
|
||||
rm -f ${TempFiles}
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
function space_alert() {
|
||||
ALERT_USAGE=75%
|
||||
for ln in "${Measurements[@]}"
|
||||
for metric in "${Metrics[@]}"
|
||||
do
|
||||
IFS=$' '; args=($ln); unset IFS
|
||||
IFS=$' '; args=($metric); unset IFS
|
||||
host=${args[0]}
|
||||
fs=${args[1]}
|
||||
space_used=${args[2]}
|
||||
|
||||
if [ ${space_used%?} -ge ${ALERT_USAGE%?} ]; then
|
||||
echo ":red_circle: Filesystem **${host}:${fs}** is using **${space_used}** :red_circle:"
|
||||
fi
|
||||
@@ -52,6 +64,7 @@ function storage_check() {
|
||||
|
||||
result_lines=()
|
||||
|
||||
declare -a SingleMeas
|
||||
for host in ${Hosts}
|
||||
do
|
||||
if [[ "${host}" == *"cryptovaltrading.com" ]]; then
|
||||
@@ -70,7 +83,12 @@ function storage_check() {
|
||||
do
|
||||
IFS=$' '; args=($ln); unset IFS
|
||||
res="${args[5]}| **${host}** | ***${args[6]}*** | *${args[5]}* |"
|
||||
|
||||
result_lines+=("$res")
|
||||
|
||||
fs=${args[6]}
|
||||
used=${args[5]}
|
||||
Metrics+=("$host $fs $used")
|
||||
done
|
||||
unset IFS
|
||||
done
|
||||
@@ -81,7 +99,11 @@ function storage_check() {
|
||||
}
|
||||
|
||||
tmpfile=$(mktemp)
|
||||
TempFiles="${TempFiles} ${tmpfile}"
|
||||
|
||||
tmpfile2=$(mktemp)
|
||||
TempFiles="${TempFiles} ${tmpfile2}"
|
||||
|
||||
storage_check > ${tmpfile2}
|
||||
|
||||
echo "## :card_file_box: STORAGE HEALTH CHECK" >> ${tmpfile}
|
||||
@@ -90,17 +112,15 @@ 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)
|
||||
TempFiles="${TempFiles} ${tmpfile}"
|
||||
|
||||
space_alert > ${tmpfile}
|
||||
cat ${tmpfile}
|
||||
if [ -s ${tmpfile} ]
|
||||
then
|
||||
(echo "### :card_file_box: STORAGE ALERTS" && cat ${tmpfile}) | ${Sender} ${AlertChannel}
|
||||
else
|
||||
echo File ${tmpfile} is empty
|
||||
echo "No Storage Alerts"
|
||||
fi
|
||||
rm ${tmpfile}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user