From 280a7577b3d44d96bebf7aa2e124ec3e1ece2858 Mon Sep 17 00:00:00 2001 From: Bryan Roessler Date: Wed, 20 Oct 2021 16:30:32 -0400 Subject: [PATCH] No /var/log/syslog on centos 7 --- script-install-banner | 124 +++++++++++++++++++++--------------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/script-install-banner b/script-install-banner index 36a31664..5f8b7476 100644 --- a/script-install-banner +++ b/script-install-banner @@ -95,76 +95,76 @@ for line in "${dfs[@]}"; do done EOF -# Disk health -cat <<- 'EOF' >> "$profiledir/motd.sh" -# config -MAX_TEMP=40 -# set column width -COLUMNS=2 -# colors -white="\e[39m" -green="\e[1;32m" -red="\e[1;31m" -dim="\e[2m" -undim="\e[0m" +# # Disk health +# cat <<- 'EOF' >> "$profiledir/motd.sh" +# # config +# MAX_TEMP=40 +# # set column width +# COLUMNS=2 +# # colors +# white="\e[39m" +# green="\e[1;32m" +# red="\e[1;31m" +# dim="\e[2m" +# undim="\e[0m" -# disks to check -disks=(sda sdb sdc sdd sde sdf sdg sdi) -disknames=(sda sdb sdc sdd sde sdf sdg sdi) +# # disks to check +# disks=(sda sdb sdc sdd sde sdf sdg sdi) +# disknames=(sda sdb sdc sdd sde sdf sdg sdi) -# hddtemp -hddtemp_host=localhost -hddtemp_port=7634 +# # hddtemp +# hddtemp_host=localhost +# hddtemp_port=7634 -# logfiles to check -logfiles='/var/log/syslog /var/log/syslog.1' +# # logfiles to check +# logfiles='/var/log/syslog /var/log/syslog.1' -# get all lines with smartd entries from syslog -lines=$(tac $logfiles | grep -hiP 'smartd\[[[:digit:]]+\]:' | grep -iP "previous self-test") -# use nc to query temps from hddtemp daemon -hddtemp=$(timeout 0.01 nc $hddtemp_host $hddtemp_port | sed 's/|//m' | sed 's/||/ \n/g') +# # get all lines with smartd entries from syslog +# lines=$(tac $logfiles | grep -hiP 'smartd\[[[:digit:]]+\]:' | grep -iP "previous self-test") +# # use nc to query temps from hddtemp daemon +# hddtemp=$(timeout 0.01 nc $hddtemp_host $hddtemp_port | sed 's/|//m' | sed 's/||/ \n/g') -out="" -for i in "${!disks[@]}"; do - disk=${disks[$i]} - # use disknames if given - diskname=${disknames[$i]} - if [ -z "${diskname}" ]; then - diskname=$disk - fi - uuid=$(blkid -s UUID -o value "/dev/${disk}") - status=$( (grep "${uuid}" <<< "${lines}") | grep -m 1 -oP "previous self-test.*" | awk '{ print $4 " " $5 }') - temp=$( (grep "${disk}" <<< "${hddtemp}") | awk -F'|' '{ print $3 }') +# out="" +# for i in "${!disks[@]}"; do +# disk=${disks[$i]} +# # use disknames if given +# diskname=${disknames[$i]} +# if [ -z "${diskname}" ]; then +# diskname=$disk +# fi +# uuid=$(blkid -s UUID -o value "/dev/${disk}") +# status=$( (grep "${uuid}" <<< "${lines}") | grep -m 1 -oP "previous self-test.*" | awk '{ print $4 " " $5 }') +# temp=$( (grep "${disk}" <<< "${hddtemp}") | awk -F'|' '{ print $3 }') - # color green if temp <= MAX_TEMP, else red - if [[ "${temp}" -gt "${MAX_TEMP}" ]]; then - color=$red - else - color=$green - fi - # add "C" if temp is numeric - if [[ "$temp" =~ ^[0-9]+$ ]]; then - temp="${temp}C" - fi - # color green if status is "without error", else red - if [[ "${status}" == "without error" ]]; then - status_color=$green - else - status_color=$red - fi +# # color green if temp <= MAX_TEMP, else red +# if [[ "${temp}" -gt "${MAX_TEMP}" ]]; then +# color=$red +# else +# color=$green +# fi +# # add "C" if temp is numeric +# if [[ "$temp" =~ ^[0-9]+$ ]]; then +# temp="${temp}C" +# fi +# # color green if status is "without error", else red +# if [[ "${status}" == "without error" ]]; then +# status_color=$green +# else +# status_color=$red +# fi - # print temp & smartd error - out+="${diskname}:,${color}${temp}${undim} | ${status_color}${status}${undim}," - # insert \n every $COLUMNS column - if [ $((($i+1) % $COLUMNS)) -eq 0 ]; then - out+="\n" - fi -done -out+="\n" +# # print temp & smartd error +# out+="${diskname}:,${color}${temp}${undim} | ${status_color}${status}${undim}," +# # insert \n every $COLUMNS column +# if [ $((($i+1) % $COLUMNS)) -eq 0 ]; then +# out+="\n" +# fi +# done +# out+="\n" -printf "\ndisk status:\n" -printf "$out" | column -ts $',' | sed -e 's/^/ /' -EOF +# printf "\ndisk status:\n" +# printf "$out" | column -ts $',' | sed -e 's/^/ /' +# EOF # Services