progress
This commit is contained in:
parent
83cc1cd509
commit
e2c2377e41
31
doc/CVTT Hosts Map.drawio
Normal file
31
doc/CVTT Hosts Map.drawio
Normal file
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
0.4.1
|
||||
0.4.2
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
#!/bin/sh
|
||||
echo $0 $* | /usr/bin/ts '[%Y-%m-%d %H:%M:%S]'
|
||||
|
||||
# RootDir=/home/oleg/develop/cvtt2
|
||||
RootDir="${HOME}/prod"
|
||||
|
||||
export PYTHONPATH=${RootDir}
|
||||
@ -11,6 +10,9 @@ StatusChannel=Status-CVTT
|
||||
AlertChannel=Alerts-CVTT
|
||||
Sender=${RootDir}/ops/utils/send_mmost.sh
|
||||
|
||||
# Sender=cat
|
||||
# StatusChannel=
|
||||
|
||||
Hosts=
|
||||
Hosts="${Hosts} cloud11.cvtt.vpn"
|
||||
Hosts="${Hosts} cloud14.cvtt.vpn"
|
||||
@ -30,8 +32,6 @@ Hosts="${Hosts} nsbackup.cvtt.vpn"
|
||||
Hosts="${Hosts} dtvmhost.cvtt.vpn"
|
||||
Hosts="${Hosts} ops-server.cvtt.vpn"
|
||||
|
||||
|
||||
|
||||
function space_alert() {
|
||||
ALERT_USAGE=75%
|
||||
for ln in "${Measurements[@]}"
|
||||
@ -48,10 +48,8 @@ function space_alert() {
|
||||
|
||||
function storage_check() {
|
||||
|
||||
echo "## :card_file_box: STORAGE HEALTH CHECK"
|
||||
echo
|
||||
echo "| host | filesystem | usage |"
|
||||
echo "| --- | --- | --- |"
|
||||
result_lines=()
|
||||
|
||||
for host in ${Hosts}
|
||||
do
|
||||
Cmd="ssh $host"
|
||||
@ -64,19 +62,30 @@ function storage_check() {
|
||||
for ln in $lines
|
||||
do
|
||||
IFS=$' '; args=($ln); unset IFS
|
||||
echo "| **${host}** | ***${args[6]}*** | *${args[5]}* |"
|
||||
Measurements+=("${host} ${args[6]} ${args[5]}")
|
||||
res="${args[5]}| **${host}** | ***${args[6]}*** | *${args[5]}* |"
|
||||
result_lines+=("$res")
|
||||
done
|
||||
unset IFS
|
||||
echo "| | | |"
|
||||
done
|
||||
for ln in "${result_lines[@]}"
|
||||
do
|
||||
echo "${ln}"
|
||||
done
|
||||
}
|
||||
|
||||
Measurements=()
|
||||
tmpfile=$(mktemp)
|
||||
storage_check > ${tmpfile}
|
||||
cat ${tmpfile} | ${Sender} ${StatusChannel}
|
||||
tmpfile2=$(mktemp)
|
||||
storage_check > ${tmpfile2}
|
||||
|
||||
echo "## :card_file_box: STORAGE HEALTH CHECK" >> ${tmpfile}
|
||||
echo >> ${tmpfile}
|
||||
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)
|
||||
space_alert > ${tmpfile}
|
||||
cat ${tmpfile}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user