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