Rework for modular system
Autoadd disks to temps (only for sd*, and works on smartmontools) Some cosmetic changes
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
figlet -k -f slant "$(hostname)"
|
||||
color="\e[1;33m"
|
||||
clear="\e[m"
|
||||
echo -e ${color}
|
||||
figlet -k -f slant $(hostname)
|
||||
echo -e ${clear}
|
||||
|
||||
19
20-sysinfo
19
20-sysinfo
@@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
# get load averages
|
||||
IFS=" " read LOAD1 LOAD5 LOAD15 <<<$(/bin/cat /proc/loadavg | awk '{ print $1,$2,$3 }')
|
||||
# get free memory
|
||||
IFS=" " read USED FREE TOTAL <<<$(free -htm | grep "Mem" | awk {'print $3,$4,$2'})
|
||||
# get processes
|
||||
@@ -11,16 +9,13 @@ PROCESS_ROOT=`echo "$PROCESS"| grep root | awk {'print $2'}`
|
||||
PROCESS_USER=`echo "$PROCESS"| grep -v root | awk {'print $2'} | awk '{ SUM += $1} END { print SUM }'`
|
||||
|
||||
W="\e[0;39m"
|
||||
G="\e[1;32m"
|
||||
G="\e[1;33m"
|
||||
|
||||
echo -e "
|
||||
${W}system info:
|
||||
$W Distro......: $W`cat /etc/*release | grep "PRETTY_NAME" | cut -d "=" -f 2- | sed 's/"//g'`
|
||||
$W Kernel......: $W`uname -sr`
|
||||
|
||||
$W Uptime......: $W`uptime -p`
|
||||
$W Load........: $G$LOAD1$W (1m), $G$LOAD5$W (5m), $G$LOAD15$W (15m)
|
||||
$W Processes...:$W $G$PROCESS_ROOT$W (root), $G$PROCESS_USER$W (user) | $G$PROCESS_ALL$W (total)
|
||||
|
||||
$W CPU.........: $W`cat /proc/cpuinfo | grep "model name" | cut -d ' ' -f3- | awk {'print $0'} | head -1`
|
||||
$W Memory......: $G$USED$W used, $G$FREE$W free, $G$TOTAL$W in total$W"
|
||||
$W Uptime.: $W`uptime -p | awk '{if ($1 != "test") printf("%s %s %s %s\n", $2, $3, $4, $5); }' | sed 's/,//g'`
|
||||
$W Distro.: $W`cat /etc/*release | grep "PRETTY_NAME" | cut -d "=" -f 2- | sed 's/"//g'`
|
||||
$W Kernel.: $W`uname -sr`
|
||||
$W Proc...: $W$G$PROCESS_ROOT$W (r), $G$PROCESS_USER$W (u) | $G$PROCESS_ALL$W (t)
|
||||
$W CPU....:$W`cat /proc/cpuinfo | grep "name" | cut -d : -f2 | uniq | cut -f1 -d"@" | sed 's/(TM)//;s/(R)//;s/CPU//'`
|
||||
$W Memory.: $G$USED$W used | $G$TOTAL$W in total$W"
|
||||
|
||||
12
30-hdd-free
12
30-hdd-free
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
mountpoints=('/mnt/sdb1' '/' '/mnt/backup/')
|
||||
barWidth=50
|
||||
mountpoints=('/dev/sdf1' '/dev/vg1/downloads' '/dev/sdb1')
|
||||
barWidth=34
|
||||
maxDiscUsage=90
|
||||
clear="\e[39m\e[0m"
|
||||
dim="\e[2m"
|
||||
@@ -10,10 +10,11 @@ echo
|
||||
echo 'HDD free:'
|
||||
for point in "${mountpoints[@]}"; do
|
||||
line=$(df -hl "${point}")
|
||||
label=$(lsblk -o label "${point}")
|
||||
usagePercent=$(echo "$line"|tail -n1|awk '{print $5;}'|sed 's/%//')
|
||||
usedBarWidth=$((($usagePercent*$barWidth)/100))
|
||||
barContent=""
|
||||
color="\e[32m"
|
||||
color="\e[33m"
|
||||
if [ "${usagePercent}" -ge "${maxDiscUsage}" ]; then
|
||||
color="\e[31m"
|
||||
fi
|
||||
@@ -26,7 +27,8 @@ for point in "${mountpoints[@]}"; do
|
||||
barContent="${barContent}-"
|
||||
done
|
||||
bar="[${barContent}${clear}]"
|
||||
echo "${line}" | awk '{if ($1 != "Filesystem") printf("%-30s%+3s used out of %+5s\n", $1, $3, $2); }' | sed -e 's/^/ /'
|
||||
echo -e "${bar}" | sed -e 's/^/ /'
|
||||
echo "${label}" | awk '{if ($1 != "LABEL") printf("%-10s", $1); }'
|
||||
echo "${line}" | awk '{if ($1 != "Filesystem") printf("%+8s used out of %+5s\n", $3, $2); }'
|
||||
echo -e "${bar}"
|
||||
|
||||
done
|
||||
|
||||
27
30-hdd-temp
27
30-hdd-temp
@@ -1,23 +1,30 @@
|
||||
#!/bin/bash
|
||||
sd=(sda)
|
||||
disks=${disks:-()}
|
||||
out=""
|
||||
dim="\e[43m"
|
||||
white="\e[31m"
|
||||
label="\e[1;30m"
|
||||
COLUMNS=3
|
||||
clear="\e[0m\e[39m"
|
||||
|
||||
my_target_temp=45
|
||||
for i in ${!sd[@]}; do
|
||||
temp=$(smartctl -a /dev/${sd[$i]} | grep Temperature_Celsius | grep 194 | awk '{print $10}' 2> /dev/null)
|
||||
k=0
|
||||
|
||||
for i in {a..z}; do
|
||||
temp=$(smartctl -a /dev/sd${i} | grep Temperature_Celsius | grep 194 | awk '{print $10}' 2> /dev/null)
|
||||
color="\e[42m"
|
||||
((k++))
|
||||
if [ -z "$temp" ]; then
|
||||
out+=""
|
||||
else
|
||||
if [ "$temp" -ge "${my_target_temp}" ]; then
|
||||
color="\e[41m"
|
||||
fi
|
||||
out+="${sd[$i]} \e[30m $color $temp $clear ,"
|
||||
c=i+1
|
||||
if [ $((($i+1) % $COLUMNS)) -eq 0 ]; then
|
||||
out+="${dim}${white}${label} sd${i} \e[30m$color $temp $clear,"
|
||||
if [ $(($k % $COLUMNS)) -eq 0 ]; then
|
||||
out+="\n"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
out+="\n"
|
||||
echo -e "
|
||||
HDD Temps:"
|
||||
printf "$out" | column -c $c -ts $',' | sed -e 's/^/ /'
|
||||
echo -e "HDD Temps:"
|
||||
printf "$out" | column -c $k -ts $',' | sed -e 's/^/ /'
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
export LANG='en_US.UTF-8'
|
||||
# set column width
|
||||
COLUMNS=3
|
||||
COLUMNS=2
|
||||
# colors
|
||||
green="\e[1;32m"
|
||||
red="\e[1;31m"
|
||||
undim="\e[0m"
|
||||
services=( "smartd" "plexmediaserver" "docker" "smdb")
|
||||
services=( "smartd" "plexmediaserver" "docker" "smbd")
|
||||
# sort services
|
||||
IFS=$'\n' services=($(sort <<<"${services[*]}"))
|
||||
unset IFS
|
||||
@@ -20,9 +21,9 @@ done
|
||||
for i in ${!services[@]}; do
|
||||
# color green if service is active, else red
|
||||
if [[ "${service_status[$i]}" == "active" ]]; then
|
||||
out+="${services[$i]}:,${green}${service_status[$i]}${undim},"
|
||||
out+="${services[$i]}:,${green}▲${undim},"
|
||||
else
|
||||
out+="${services[$i]}:,${red}${service_status[$i]}${undim},"
|
||||
out+="${services[$i]}:,${red}▼${undim},"
|
||||
fi
|
||||
# insert \n every $COLUMNS column
|
||||
if [ $((($i+1) % $COLUMNS)) -eq 0 ]; then
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
export LANG='en_US.UTF-8'
|
||||
# set column width
|
||||
COLUMNS=2
|
||||
# colors
|
||||
@@ -17,9 +18,9 @@ for i in "${!containers[@]}"; do
|
||||
IFS=" " read name status <<< ${containers[i]}
|
||||
# color green if service is active, else red
|
||||
if [[ "${status}" == "Up" ]]; then
|
||||
out+="${name}:,${green}${status,,}${undim},"
|
||||
out+="${name}:,${green}▲${undim},"
|
||||
else
|
||||
out+="${name}:,${red}${status,,}${undim},"
|
||||
out+="${name}:,${red}▼${undim},"
|
||||
fi
|
||||
# insert \n every $COLUMNS column
|
||||
if [ $((($i+1) % $COLUMNS)) -eq 0 ]; then
|
||||
|
||||
Reference in New Issue
Block a user