diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index dd84ea7..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] - -**Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/custom.md b/.github/ISSUE_TEMPLATE/custom.md deleted file mode 100644 index 48d5f81..0000000 --- a/.github/ISSUE_TEMPLATE/custom.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: Custom issue template -about: Describe this issue template's purpose here. -title: '' -labels: '' -assignees: '' - ---- - - diff --git a/20-memory b/20-memory index f795e6f..799e4e9 100755 --- a/20-memory +++ b/20-memory @@ -1,8 +1,8 @@ #!/bin/bash -mapfile -t mem < <( free --mega) +mapfile -t mem < <( free --mega | tail -n +2) -IFS=$'\n' mem=($(sort <<<"${mem[*]}" | tail -n +2)) +IFS=$'\n' mem=($(sort <<<"${mem[*]}")) unset IFS barWidth=38 diff --git a/21-zram b/21-zram new file mode 100755 index 0000000..201a25e --- /dev/null +++ b/21-zram @@ -0,0 +1,62 @@ +#!/bin/bash + +# Читаем данные из zramctl [cite: 1] +mapfile -t mem < <( zramctl -b | tail -n +2) + +IFS=$'\n' mem=($(sort <<<"${mem[*]}")) +unset IFS + +barWidth=38 +clear="\e[39m\e[0m" +usageColor="\e[33m" + +printf '\nZram:\n' + +for point in "${mem[@]}"; do + # Читаем устройство, алгоритм, размер, данные и общий сжатый объем + IFS=" " read -r DEV_PATH ALGO SIZE DATA TOTAL <<<$(echo "${point}" | awk {'print $1,$2,$3,$4,$6'}) + + DEV_NAME="${DEV_PATH##*/}" # Оставляем только zram0 + + # Расчеты в GiB с точностью 1 знак + usedGi=$(awk "BEGIN {printf \"%.1f\", $DATA/1024/1024/1024}") + totalGi=$(awk "BEGIN {printf \"%.1f\", $SIZE/1024/1024/1024}") + ratio=$(awk "BEGIN {if ($TOTAL>0) printf \"%.2f\", $DATA/$TOTAL; else print \"1.00\"}") + + # Расчет полоски (38 символов) [cite: 1, 4, 5] + usedBarWidth=$((barWidth*DATA/SIZE)) + barContent="${usageColor}" + for ((i=0; i/dev/null) + # Получаем «чистые» часы + hours=$(smartctl -a ${i} | grep "^ 9" | awk '{print $10}' | awk -F 'h' '{print $1}' 2>/dev/null) + + if [ -n "$hours" ]; then + # Расчеты: 1 год = 8760ч, 1 месяц = 730ч, 1 день = 24ч + y=$((hours / 8760)) + m=$(((hours % 8760) / 730)) + d=$(((hours % 730) / 24)) + + time_str="" + [ $y -gt 0 ] && time_str+="${y}y " + [ $m -gt 0 ] && time_str+="${m}m " + [ $d -gt 0 ] && time_str+="${d}d" + [ -z "$time_str" ] && time_str="${hours}h" + + out+=" $model...$time_str\n" + fi +done + +printf "$out" | column -ts '...' diff --git a/32-hdd-io b/32-hdd-io new file mode 100755 index 0000000..882126d --- /dev/null +++ b/32-hdd-io @@ -0,0 +1,48 @@ +#!/bin/bash + +if ! command -v iostat &> /dev/null; then exit 0; fi + +mapfile -t disks < <( ls /dev/sd[a-z] ) +out="" +dim="\e[43m" +label="\e[1;30m" +clear="\e[0m\e[39m" +COLUMNS=3 + +# Берем актуальный %util (вторая итерация iostat) +declare -A utils +while read -r dev util; do + utils[$dev]=$util +done < <(iostat -dx 1 2 | awk ' + BEGIN { col=0 } + /%util/ { for(i=1;i<=NF;i++) if($i=="%util") col=i } + col > 0 && $1 ~ /sd[a-z]$/ { data[$1]=$col } + END { for(d in data) print d, data[d] } +') + +k=0 +printf "\n HDD I/O Load:\n" + +for i in "${disks[@]}"; do + dev_name=$(basename "$i") + util="${utils[$dev_name]:-0}" + util_int=$(printf "%.0f" "$util" 2>/dev/null || echo 0) + + ((k++)) + + color="\e[42m" + [ "$util_int" -ge 60 ] && color="\e[41m" + [ "$util_int" -lt 60 ] && [ "$util_int" -ge 30 ] && color="\e[43m" + + # ФИКСИРОВАННАЯ ШИРИНА: + # %-4s (имя) + %4s (процент) + пробелы внутри тегов. + # Это сделает все плитки одинаковыми. + out+="$(printf "${dim}${label} %-3s ${clear}${color}\e[30m %3s%% ${clear}," "$dev_name" "$util_int")" + + if [ $(($k % $COLUMNS)) -eq 0 ]; then + out+="\n" + fi +done + +# Выводим с разделителем в 2 пробела между колонками +echo -e "$out" | column -ts $',' -o ' ' | sed -e 's/^/ /' diff --git a/40-services b/40-services index cd18d5a..4c7c543 100755 --- a/40-services +++ b/40-services @@ -31,10 +31,10 @@ for name in $names; do # color green if service is active, else red service_status=($(systemctl is-active "$name")) if [[ "${service_status}" == "active" ]]; then - _tmp=$(printf "%-13s %-16s," "${services[$name]}:" "${green}up${undim}") + _tmp=$(printf "%-13s %-16s," "${services[$name]}:" "${green}${undim}") out+="${_tmp}," else - _tmp=$(printf "%-13s %-16s," "${services[$name]}:" "${red}down${undim}") + _tmp=$(printf "%-13s %-16s," "${services[$name]}:" "${red}${undim}") out+="${_tmp}," fi # insert \n every $COLUMNS column diff --git a/config b/config new file mode 100755 index 0000000..6ef2e65 --- /dev/null +++ b/config @@ -0,0 +1,12 @@ +Width=40 + + +#Colors +White="\e[39m" +clear="\e[m" +GREEN="\e[32m" +undim="\e[0m" +RED="\e[31m" +YELLOW="\e[33m" +BLUE="\e[36m" +barclear=""