This commit is contained in:
2023-04-26 18:28:51 -05:00
parent 3e83f00868
commit 34ffc4eb5e
2 changed files with 23 additions and 27 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
VERS='4.3.28-04262023' VERS='4.4.2-04262023'
NODETYPES=PW NODETYPES=PW
NODETYPES=MYSQL,LB,WEB,NC,WPD,LPD,PW NODETYPES=MYSQL,LB,WEB,NC,WPD,LPD,PW

View File

@@ -563,44 +563,40 @@ STATUS(){
[ "${ST_ACTION}" != "check" ] && echo -en " ${idsCL[LightCyan]}Getting drives from server ... ${idsCL[Default]}" [ "${ST_ACTION}" != "check" ] && echo -en " ${idsCL[LightCyan]}Getting drives from server ... ${idsCL[Default]}"
declare -A partitions declare -A partitions
partitions=`${NCMD} df -hBM | grep -vE '^Filesystem|tmpfs|cdrom|loop|overlay|shm|-volume|Music|media-data|Software|ram|Backups' | awk '{ print $5 " " $1 }' | while read output; do echo $output | awk '{ print $2 }'; done;` DRIVEINFO=$(ssh root@${host_ip[$hostid]} df -BM | grep -vE '^Filesystem|tmpfs|cdrom|@|ram|loop|udev|veeamimage|nvme|localhost|shm|mmcblk|overlay|-volume|Music|Software' | awk '{ print $1 " " $2 " " $4 }')
partitions2=`echo ${partitions[*]}` DRIVEINFO=(${DRIVEINFO})
partitions3=(${partitions2})
echo -en "\e[1A"; echo -en "\e[1A";
echo -e "\e[0K\r" echo -e "\e[0K\r"qqqaqq
for partition in "${partitions3[@]}"; do NUMDRIVES=$((${#DRIVEINFO[@]} / 3))
if [ "${partition}" != "udev" ] && [ "${partition}" != "/dev/sda1" ]; then for ((i = 0 ; i <= $((${NUMDRIVES}-1)) ; i++)); do
pname=`echo "${partition}" | awk -F'/' ' { print $NF } '` >/dev/null 2>&1 ii=$((${i}*3))
pname=${pname#*vg-} pname=`echo "${DRIVEINFO[${ii}]}" | awk -F'/' ' { print $NF } '` >/dev/null 2>&1
if [ "${ST_ACTION}" != "check" ]; then pname=${pname#*vg-}
c=0; cw=20; spc=''
spc1=${cw}-${#pname} if [ ${DRIVEINFO[$((${ii}+1))]//M/} -gt 1024 ]; then
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done freespace=${DRIVEINFO[$((${ii}+2))]}
echo -en " ${pname}$spc: " if [[ ${freespace} -gt 1024 ]]; then
fsdsp=$(bc <<< "scale=2; ${freespace}/1024")
fsdsp="${fsdsp} GB"
else
fsdsp="${freespace} MB"
fi fi
if [ "${freespace}" -le "1024" ]; then
[[ "${partition}" == *"root"* ]] && prt="/" || prt=${partition}
freespace=`${NCMD} df -hPBM ${prt} | awk '{print $4}' |tail -1|sed 's/M$//g'` >/dev/null 2>&1
if [ "${freespace}" -le "1000" ]; then
fs_status='error' fs_status='error'
fs_status_color='Red' fs_status_color='Red'
SENDNOTICE "Free Space Critical: '${NM_NODETYPES[$NTYPE]}-Node${nid}'" "${partition} : ${freespace} MB free" 1 SENDNOTICE "Free Space Critical: '${NM_NODETYPES[$NTYPE]}-Node${nid}'" "${partition} : ${fsdsp} free" 1
elif [ "${freespace}" -le "5120" ]; then
elif [ "${freespace}" -le "5000" ]; then
fs_status='warn' fs_status='warn'
fs_status_color='Yellow' fs_status_color='Yellow'
SENDNOTICE "Free Space Warning: '${NM_NODETYPES[$NTYPE]}-Node${nid}'" "${partition} : ${freespace} MB free" SENDNOTICE "Free Space Warning: '${NM_NODETYPES[$NTYPE]}-Node${nid}'" "${partition} : ${fsdsp} free"
else else
fs_status='' fs_status=''
fs_status_color='Green' fs_status_color='Green'
fi fi
if [ "${ST_ACTION}" != "check" ]; then if [ "${ST_ACTION}" != "check" ]; then
if [[ ${freespace} -gt 1000 ]]; then if [[ ${freespace} -gt 1024 ]]; then
fsgb=$(bc <<< "scale=2; ${freespace}/1000") fsgb=$(bc <<< "scale=2; ${freespace}/1024")
fsdsp="${fsgb} GB" fsdsp="${fsgb} GB"
else else
fsdsp="${freespace} MB" fsdsp="${freespace} MB"