Compare commits
6 Commits
699ab199a0
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 13ae2903f8 | |||
| 4746fb9c04 | |||
| 6ae9960091 | |||
| 9179423a62 | |||
| d1b6f355f1 | |||
| f71c630006 |
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -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.
|
||||
10
.github/ISSUE_TEMPLATE/custom.md
vendored
10
.github/ISSUE_TEMPLATE/custom.md
vendored
@@ -1,10 +0,0 @@
|
||||
---
|
||||
name: Custom issue template
|
||||
about: Describe this issue template's purpose here.
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
|
||||
62
21-zram
Executable file
62
21-zram
Executable file
@@ -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<usedBarWidth; i++)); do barContent="${barContent}―"; done
|
||||
barContent="${barContent}${clear}"
|
||||
for ((i=0; i<(barWidth-usedBarWidth); i++)); do barContent="${barContent}―"; done
|
||||
bar="${barContent}${clear}"
|
||||
|
||||
# --- ИДЕАЛЬНОЕ ВЫРАВНИВАНИЕ ---
|
||||
|
||||
# Строка 1: "zram0" слева, остальное справа.
|
||||
# Считаем длину правой части без цветовых кодов:
|
||||
# "used " (5) + usedGi (например "3.6" = 3) + " Gi of " (7) + totalGi ("125.0" = 5) + " Gi" (3) = 23
|
||||
right_text="used ${usedGi} Gi of ${totalGi} Gi"
|
||||
right_len=${#right_text}
|
||||
|
||||
# Считаем, сколько нужно пробелов между "zram0" (7 симв) и текстом, чтобы в сумме было 38
|
||||
# 38 - 7 (имя) - длина текста
|
||||
padding_len=$((38 - 7 - right_len))
|
||||
padding=""
|
||||
for ((i=0; i<padding_len; i++)); do padding="${padding} "; done
|
||||
|
||||
# Вывод первой строки: 2 пробела + имя + пробелы + текст (с цветом внутри)
|
||||
printf " %-7s%sused ${usageColor}%s${clear} Gi of %s Gi\n" "$DEV_NAME" "$padding" "$usedGi" "$totalGi"
|
||||
|
||||
# Строка 2: Ratio и Algo. Считаем длину, чтобы прижать вправо.
|
||||
info_text="Ratio: ${ratio} Algo: ${ALGO}"
|
||||
info_len=${#info_text}
|
||||
info_padding_len=$((38 - info_len))
|
||||
info_padding=""
|
||||
for ((i=0; i<info_padding_len; i++)); do info_padding="${info_padding} "; done
|
||||
|
||||
printf " %s%s\n" "$info_padding" "$info_text"
|
||||
|
||||
# Линия (2 пробела + 38 символов)
|
||||
echo -e " ${bar}"
|
||||
done
|
||||
28
31-hdd-hours
Executable file
28
31-hdd-hours
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
mapfile -t disks < <( ls /dev/sd[a-z] )
|
||||
out=""
|
||||
printf "\nHDD Power On Hours:\n"
|
||||
|
||||
for i in ${disks[@]}; do
|
||||
model=$(smartctl -a ${i} | grep "^Device Model:" | awk -F ':' '{print $2}' | xargs 2>/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 '...'
|
||||
48
32-hdd-io
Executable file
48
32-hdd-io
Executable file
@@ -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/^/ /'
|
||||
@@ -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
|
||||
|
||||
88
60-docker
88
60-docker
@@ -1,64 +1,60 @@
|
||||
#!/bin/bash
|
||||
|
||||
export LANG='en_US.UTF-8'
|
||||
# set column width
|
||||
COLUMNS=1
|
||||
# colors
|
||||
|
||||
green="\e[1;32m"
|
||||
red="\e[1;31m"
|
||||
yellow="\e[1;33m"
|
||||
undim="\e[0m"
|
||||
|
||||
docker_format='docker ps --format "{{.Names}} {{.Status}}" -a'
|
||||
game_label='eval "$docker_format" --filter "label=game_server"'
|
||||
traker='eval "$docker_format" --filter "label=traker"'
|
||||
combined='(eval "$docker_format" --filter "label=traker" && eval "$docker_format" --filter "label=game_server") | sort'
|
||||
|
||||
mapfile -t containers < <( comm -2 -3 <( eval "$docker_format" | sort) <( eval "$combined") | sed '/^\s*$/d' | tail -n +1)
|
||||
mapfile -t game_servers < <( eval "$game_label" | sort | sed '/^\s*$/d'| tail -n +1)
|
||||
mapfile -t trakers < <( eval "$traker" | sort | sed '/^\s*$/d'| tail -n +1)
|
||||
raw_data=$(docker ps -a --format "{{.Names}}\t{{.Status}}\t{{.Labels}}")
|
||||
|
||||
check_status() {
|
||||
IFS=" " read name status <<< $1
|
||||
replica=$( echo ${name} | sed 's/\([^.]*\)\.\([^.]*\)\.\([^.]*\)/\2/')
|
||||
name=$( echo ${name} | sed 's/\([^.]*\)\.\([^.]*\)\.\([^.]*\)/\1/')
|
||||
local full_name="$1"
|
||||
local status="$2"
|
||||
[ -z "$full_name" ] && return
|
||||
|
||||
if [[ "${status}" == *"healthy"* ]]; then
|
||||
_status="${green}healthy${undim}"
|
||||
local name=$(echo "$full_name" | sed -E 's/\.[a-z0-9]{25,26}//g' | sed -E 's/\.[0-9]+$//')
|
||||
|
||||
elif [[ "${status}" == *"Restarting"* ]]; then
|
||||
_status="${yellow}restarting${undim}"
|
||||
|
||||
elif [[ "${status}" == *"Paused"* ]]; then
|
||||
_status="${yellow}paused${undim}"
|
||||
|
||||
elif [[ "${status}" == *"Up"* ]]; then
|
||||
_status="${green}up${undim}"
|
||||
|
||||
elif [[ "${status}" == *"Created"* ]]; then
|
||||
_status="${yellow}created${undim}"
|
||||
|
||||
elif [[ "${status}" == *"Exited"* ]]; then
|
||||
_status="${red}exited${undim}"
|
||||
local label="unknown"
|
||||
local color=$red
|
||||
|
||||
if [[ "$status" == *"Paused"* ]]; then
|
||||
label="paused"
|
||||
color=$yellow
|
||||
elif [[ "$status" == *"Restarting"* ]]; then
|
||||
label="restarting"
|
||||
color=$yellow
|
||||
elif [[ "$status" == *"Created"* ]]; then
|
||||
label="created"
|
||||
color=$yellow
|
||||
elif [[ "$status" == *"healthy"* ]] || [[ "$status" == *"Up"* ]]; then
|
||||
label="up"
|
||||
color=$green
|
||||
elif [[ "$status" == *"Exited"* ]]; then
|
||||
label="exited"
|
||||
color=$red
|
||||
fi
|
||||
|
||||
_line=${name},${_status}
|
||||
echo -e "${name} ${_status}" | awk '{printf(" %-20s %+20s\n", $1, $2); }'
|
||||
printf " %-29s %b%8s%b\n" "$name" "$color" "$label" "$undim"
|
||||
}
|
||||
|
||||
printf "\nDocker status:\n Game Servers:\n"
|
||||
for i in "${!game_servers[@]}"; do
|
||||
check_status "${game_servers[$i]}"
|
||||
done
|
||||
|
||||
printf "\n Tracker:\n"
|
||||
for i in "${!trakers[@]}"; do
|
||||
check_status "${trakers[$i]}"
|
||||
done
|
||||
process_group() {
|
||||
local data="$1"
|
||||
echo "$data" | sort | while IFS=$'\t' read -r name status labels; do
|
||||
check_status "$name" "$status"
|
||||
done
|
||||
}
|
||||
|
||||
printf "\nDocker status:\n"
|
||||
|
||||
printf " Game Servers:\n"
|
||||
process_group "$(echo "$raw_data" | grep "game_server")"
|
||||
|
||||
|
||||
printf "\n Media:\n"
|
||||
process_group "$(echo "$raw_data" | grep "media")"
|
||||
|
||||
printf "\n Other:\n"
|
||||
for i in "${!containers[@]}"; do
|
||||
check_status "${containers[$i]}"
|
||||
done
|
||||
printf ""
|
||||
process_group "$(echo "$raw_data" | grep -vE "game_server|media")"
|
||||
|
||||
printf "\n"
|
||||
|
||||
@@ -17,7 +17,8 @@ It just Messange Of The Day for linux ssh and terminal.
|
||||
- Needed for working module 60-lxd
|
||||
* ssed
|
||||
- Needed for working module 70-vpn-active
|
||||
|
||||
* zramctl
|
||||
- Needed for working module 21-zram
|
||||
|
||||
# Screenshot
|
||||

|
||||
@@ -34,6 +35,10 @@ sudo cp * /etc/update-motd.d/
|
||||
sudo update-motd
|
||||
```
|
||||
|
||||
# Update 23.02.2026
|
||||
* Added modules for show zram, hdd io, hdd hours info
|
||||
|
||||
|
||||
# Update 08.09.2021
|
||||
* Added module for track Openvpn keys (i use easyrsa for generating keys) and active connections
|
||||
|
||||
|
||||
12
config
Executable file
12
config
Executable file
@@ -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=""
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 85 KiB |
Reference in New Issue
Block a user