Prometheus on a node with its own panel: scrape core through the agent

The installer pointed it at the node's own panel and left AGENT_METRICS_PORT
unset, so the agent refused /prom/… and core never saw it. A node's own panel
now ignores the local Prometheus and shows no install buttons.
This commit is contained in:
2026-10-30 00:30:31 +03:00
parent 86dabfe3a0
commit af357a0a6f
3 changed files with 22 additions and 5 deletions
+4 -3
View File
@@ -177,9 +177,10 @@ func (c *CLI) monitorInstall() {
if !reDebian.MatchString(osFamily()) {
mfail("Автоустановка поддерживает только Debian и Ubuntu. На другом дистрибутиве поставьте Prometheus сами и подключите его кнопкой в панели (токен метрик).")
}
// Нода без своей панели (в том числе сервер, с которого панель переехала): метрики панели
// Prometheus получает от агента, а тот — от core.
viaAgent := c.isNode && !contains(c.all, "ui")
// Нода: метрики панели Prometheus получает от агента, а тот — от core. Так и у ноды со своей
// панелью: Prometheus на машине один, и нужен он core — иначе core его не видит (агент
// отдаёт /prom/… только при AGENT_METRICS_PORT), а панель ноды обходится без «Монитора».
viaAgent := c.isNode
target, newPort := os.Getenv("UI_PORT"), false
if viaAgent {
if target = os.Getenv("AGENT_METRICS_PORT"); target == "" {