hard-panel / monitor /
@Eugene Sukhodolskiy Eugene Sukhodolskiy authored 16 hours ago
..
.env.example feat: stage 2 — hard-monitor agent with install.sh and systemd unit 18 hours ago
README.md feat: stage 2 — hard-monitor agent with install.sh and systemd unit 18 hours ago
deploy.sh feat: deploy.sh — one-command agent rollout over SSH (+ README guide) 16 hours ago
hard-monitor.service feat: stage 2 — hard-monitor agent with install.sh and systemd unit 18 hours ago
hard_monitor.py feat: stage 2 — hard-monitor agent with install.sh and systemd unit 18 hours ago
install.sh feat: stage 2 — hard-monitor agent with install.sh and systemd unit 18 hours ago
requirements.txt feat: stage 2 — hard-monitor agent with install.sh and systemd unit 18 hours ago
README.md

hard-monitor

Агент GHard Monitor для серверов. Stateless: только собирает факты (CPU, RAM, диски, сеть, топ процессов, docker, температуры) и POST-ит их на панель по PANEL_URL с ключом SERVER_KEY. Вся логика — пороги, ивенты, расчёт МБ/с — на панели.

Установка (Linux + systemd)

  1. В панели: Servers → добавить сервер → скопируй ключ (ghm_..., показывается один раз)
  2. На сервере:
sudo ./install.sh https://panel.example.com ghm_xxxxxxxxxxxxxxxx 30

или одной командой с raw-скриптом:

curl -fsSL https://git.gnexus.space/root/hard-panel/raw/branch/master/monitor/install.sh | \
    sudo bash -s -- https://panel.example.com ghm_xxxxxxxxxxxxxxxx 30

Устанавливает всё в /opt/hard-monitor (venv + psutil + requests), пишет .env (права 600), ставит systemd-юнит hard-monitor и запускает. Повторный запуск — обновление агента с рестартом сервиса.

Конфиг

.env (перекрывается переменными окружения):

PANEL_URL=https://panel.example.com
SERVER_KEY=ghm_...
INTERVAL=30

Ручной запуск / отладка

./hard_monitor.py --dry-run   # собрать и напечатать пакет, не отправляя
./hard_monitor.py --once      # один пакет на панель
./hard_monitor.py             # штатный цикл (обычно через systemd)
journalctl -u hard-monitor -f  # логи сервиса

Зависимости: python3.8+, psutil, requests. Docker-метрики собираются автоматически, если есть доступ к docker-сокету (иначе тихо пропускаются).