Monitor update
Deploy / deploy (push) Successful in 8s

This commit is contained in:
2026-08-31 22:42:40 +05:00
parent 47ea18d020
commit 28702bd029
13 changed files with 434 additions and 217 deletions
+3 -2
View File
@@ -1,7 +1,8 @@
#!/bin/sh
# Суммарная загрузка CPU в процентах 0-100 (mac + linux).
# CPU: процент загрузки + число ядер. Linux + mac.
# Контракт мониторов: 1-я строка — процент, дальше — key=value.
case "$(uname)" in
Darwin) cores=$(sysctl -n hw.ncpu) ;;
*) cores=$(nproc) ;;
esac
ps -A -o %cpu | awk -v c="$cores" '{s+=$1} END {printf "%d", s/c}'
ps -A -o %cpu | awk -v c="$cores" '{s+=$1} END {printf "%d\nядер=%d\n", s/c, c}'