zarya/cmd/net.sh

33 lines
1.3 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 Host (PVE)" "192.168.1.177" 8006
check_target "Edge Router (VyOS)" "192.168.1.2" 22
check_target "Technitium DNS" "10.0.10.11" 53
check_target "OpenBao Vault" "10.0.10.12" 8200
check_target "Forgejo GitOps" "10.0.10.13" 3000
check_target "NFS Storage (NAS)" "10.0.10.14" 2049
check_target "Traefik L2 VIP" "10.0.30.200" 443
check_target "Perimeter VPS" "153.76.194.24" 443