Add Prometheus and Grafana monitoring instructions
Build and Deploy Gateway / build-and-push (push) Successful in 13s
Build and Deploy Gateway / deploy (push) Successful in 7s

This commit is contained in:
2026-08-08 01:28:53 +03:00
parent c26d4cb43b
commit 10888ac012
12 changed files with 906 additions and 9 deletions
+25 -1
View File
@@ -1,4 +1,6 @@
export function instructionBlocks({ isGateway, host, port }) {
import { grafanaDashboardJson, prometheusScrapeConfig } from './prometheus.js';
export function instructionBlocks({ isGateway, host, port, controlHost }) {
const httpProxy = `http://${host}:${port}`;
const socksProxy = `socks5://${host}:${port}`;
@@ -82,6 +84,28 @@ export function instructionBlocks({ isGateway, host, port }) {
`Для отката верните в это поле локальный адрес самого роутера вместо ${host}.`,
],
note: 'Gateway и устройства должны находиться в одной локальной сети. Сначала проверьте настройку на одном устройстве вручную.',
}, {
id: 'prometheus',
label: 'Мониторинг',
title: 'Prometheus и Grafana',
summary: 'Готовые traffic metrics и dashboard для Gateway и отдельных устройств.',
paragraphs: [
`Prometheus забирает накопленные Harbor counters с http://${controlHost}/metrics. Ручка читает готовый snapshot и не запускает новый сбор трафика.`,
'Harbor обновляет traffic snapshot раз в 15 секунд, поэтому начальный scrape interval и refresh dashboard в 30 секунд не создают лишних одинаковых выборок.',
'Dashboard показывает общий объём и скорость, источники Gateway/Proxy, список устройств и выбранных клиентов по имени. В статистику входит только трафик, учтённый Harbor.',
],
steps: [
'Добавьте блок ниже в prometheus.yml и перезагрузите Prometheus.',
'В Grafana добавьте этот Prometheus как data source.',
'Скопируйте dashboard JSON, откройте Dashboards → New → Import и вставьте его.',
],
code: prometheusScrapeConfig(controlHost),
multilineCode: true,
copies: [
{ id: 'prometheus-config', label: 'prometheus.yml', text: prometheusScrapeConfig(controlHost) },
{ id: 'grafana-dashboard', label: 'Grafana dashboard', text: grafanaDashboardJson },
],
note: 'Имя устройства берётся из заданного вами названия, затем из hostname или IP. Переименование не сбрасывает traffic series: счётчик привязан к стабильному device ID.',
}] : []),
];
}