zarya/cmd/net.sh
2026-10-31 14:30:03 +03:00

33 lines
1.2 KiB
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -uo pipefail
ZARYA_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
source "${ZARYA_DIR}/lib/common.sh"
echo -e "${BLUE}=== СЕТЕВОЙ РАДАР ИНФРАСТРУКТУРЫ (Таймаут 1 сек) ===${NC}"
printf "%-22s %-20s %-12s %s\n" "УЗЕЛ" "АДРЕС" "СТАТУС" "ЗАДЕРЖКА"
echo "------------------------------------------------------------------"
check_target() {
local name="$1"
local host="$2"
local port="$3"
local start end dur
start=$(date +%s%N)
if nc -z -w 1 "${host}" "${port}" 2>/dev/null; then
end=$(date +%s%N)
dur=$(( (end - start) / 1000000 ))
printf "%-22s %-20s \033[32m%-12s\033[0m %d ms\n" "${name}" "${host}:${port}" "UP" "${dur}"
else
printf "%-22s %-20s \033[31m%-12s\033[0m -\n" "${name}" "${host}:${port}" "DOWN"
fi
}
check_target "Proxmox" "192.168.1.177" 8006
check_target "Vyos" "192.168.1.2" 22
check_target "DNS" "10.0.10.11" 53
check_target "Vault" "10.0.10.12" 8200
check_target "Git" "10.0.10.13" 3000
check_target "NAS" "10.0.10.14" 2049
check_target "Traefik" "10.0.30.200" 443
check_target "Kontur" "153.76.194.24" 443