Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a7ad7f45f5 | |||
| 0e6190f999 | |||
| 180e3f89cf | |||
| 80bbf47755 | |||
| e295aa8dff | |||
| 60d2327b7e | |||
| a0b41cad8e |
+1
-1
@@ -1 +1 @@
|
||||
0.7.6
|
||||
0.8.2.1
|
||||
|
||||
@@ -5,6 +5,7 @@ declare -A git_repo_arr
|
||||
|
||||
git_repo_arr[cvttpy]=git@cloud21.cvtt.vpn:/opt/store/git/cvttpy.git
|
||||
git_repo_arr[ops]=git@cloud21.cvtt.vpn:/opt/store/git/ops.git
|
||||
git_repo_arr[research]=git@cloud21.cvtt.vpn:/opt/store/git/research.git
|
||||
|
||||
default_project=cvttpy
|
||||
default_branch=master
|
||||
@@ -63,6 +64,13 @@ else
|
||||
fi
|
||||
|
||||
tmp_dir=$(mktemp -d)
|
||||
function cleanup {
|
||||
cd ${HOME}
|
||||
rm -rf ${tmp_dir}
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
|
||||
prj_dir="${tmp_dir}/${prj}"
|
||||
|
||||
cmd_arr=()
|
||||
@@ -149,7 +157,4 @@ do
|
||||
pwd && echo ${cmd} && eval ${cmd}
|
||||
done
|
||||
|
||||
cd ${HOME}
|
||||
rm -rf ${tmp_dir}
|
||||
|
||||
echo "$0 Done ${project} ${release_version}"
|
||||
|
||||
@@ -15,7 +15,6 @@ Sender=${RootDir}/ops/utils/send_mmost.sh
|
||||
|
||||
Hosts=
|
||||
Hosts="${Hosts} cloud11.cvtt.vpn"
|
||||
Hosts="${Hosts} cloud14.cvtt.vpn"
|
||||
Hosts="${Hosts} cloud15.cvtt.vpn"
|
||||
Hosts="${Hosts} cloud16.cvtt.vpn"
|
||||
Hosts="${Hosts} cloud17.cvtt.vpn"
|
||||
@@ -23,26 +22,44 @@ Hosts="${Hosts} cloud21.cvtt.vpn"
|
||||
Hosts="${Hosts} cloud22.cryptovaltrading.com"
|
||||
|
||||
Hosts="${Hosts} cvttdata.cvtt.vpn"
|
||||
Hosts="${Hosts} cryptoval1.cvtt.vpn"
|
||||
Hosts="${Hosts} cryptoval2.cvtt.vpn"
|
||||
Hosts="${Hosts} cryptoval3.cvtt.vpn"
|
||||
|
||||
Hosts="${Hosts} homestore.cvtt.vpn"
|
||||
Hosts="${Hosts} nsbackup.cvtt.vpn"
|
||||
Hosts="${Hosts} nsbackup.sheynin.home"
|
||||
Hosts="${Hosts} dtvmhost.cvtt.vpn"
|
||||
Hosts="${Hosts} ops-server.cvtt.vpn"
|
||||
|
||||
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 {
|
||||
if [ "" != "${TempFiles}" ]; then
|
||||
rm -f ${TempFiles}
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
|
||||
function new_tempfile {
|
||||
tmpfile=$(mktemp)
|
||||
TempFiles="${TempFiles} ${tmpfile}"
|
||||
echo ${tmpfile}
|
||||
}
|
||||
|
||||
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
|
||||
@@ -53,6 +70,7 @@ function storage_check() {
|
||||
|
||||
result_lines=()
|
||||
|
||||
declare -a SingleMeas
|
||||
for host in ${Hosts}
|
||||
do
|
||||
if [[ "${host}" == *"cryptovaltrading.com" ]]; then
|
||||
@@ -71,7 +89,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,8 +104,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}
|
||||
@@ -91,10 +114,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} ]
|
||||
@@ -103,5 +125,4 @@ then
|
||||
else
|
||||
echo File ${tmpfile} is empty
|
||||
fi
|
||||
rm ${tmpfile}
|
||||
|
||||
|
||||
+13
-11
@@ -1,5 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
# ----- Settings
|
||||
LocalSoftwareDir=${HOME}/software/cvtt2
|
||||
|
||||
ProdDir=${HOME}/prod
|
||||
|
||||
ReleaseHosts=("cloud21.cvtt.vpn")
|
||||
ReleasePorts=("22")
|
||||
ReleaseUsers=("cvttdist")
|
||||
ReleaseDir=("/home/cvttdist/software/cvtt2")
|
||||
# ----- Settings
|
||||
|
||||
function usage() {
|
||||
echo "Usage: ${0} <project> <version>"
|
||||
exit 1
|
||||
@@ -18,17 +30,6 @@ then
|
||||
Version=latest
|
||||
fi
|
||||
|
||||
# ----- Settings
|
||||
LocalSoftwareDir=${HOME}/software/cvtt2
|
||||
|
||||
ProdDir=${HOME}/prod
|
||||
|
||||
ReleaseHosts=("cloud21.cvtt.vpn")
|
||||
ReleasePorts=("22")
|
||||
ReleaseUsers=("cvttdist")
|
||||
ReleaseDir=("/home/cvttdist/software/cvtt2")
|
||||
# ----- Settings
|
||||
|
||||
function rsync_load_version() {
|
||||
for idx in "${!ReleaseHosts[@]}"
|
||||
do
|
||||
@@ -68,6 +69,7 @@ function rsync_load_version() {
|
||||
}
|
||||
|
||||
mkdir -p ${LocalSoftwareDir}
|
||||
mkdir -p ${ProdDir}
|
||||
|
||||
# exists and not empty
|
||||
rsync_load_version
|
||||
|
||||
Reference in New Issue
Block a user