docs: README auf Reverse-Proxy+Token umgeschrieben; install.ps1 mit -Token und GPU

This commit is contained in:
mm committed 2026-09-13 20:19:58 +02:00
1 parent a19bd82189
commit 878e77542c
2 files changed
+67 -29

No files matched your search

+24 -8
View File
@@ -9,11 +9,19 @@
#>
param(
[string]$Name = $env:COMPUTERNAME.ToLower(),
[string]$Collector = "100.83.134.46",
# nvidia_smi-Input wird nur aktiv genutzt, wenn nvidia-smi installiert ist
[string]$Collector = "",
[string]$Token = "",
[string]$Version = "1.40.0",
[switch]$Uninstall
)
$ErrorActionPreference = "Stop"
if (-not $Token -and -not $Collector) { throw "Kein Token: -Token <Bearer-Token> angeben (siehe README)." }
if ($Collector) {
$PromUrl = "http://${Collector}:9090/api/v1/write"; $LokiUrl = "http://${Collector}:3100"; $Base = "http://${Collector}"
} else {
$PromUrl = "https://imac-prometheus.x05.idx.wf/api/v1/write"; $LokiUrl = "https://imac-loki.x05.idx.wf"; $Base = "https://imac-prometheus.x05.idx.wf"
}
$Dir = "C:\Program Files\Telegraf"
$Exe = "$Dir\telegraf.exe"
$Conf = "$Dir\telegraf.conf"
@@ -33,10 +41,13 @@ elseif (-not [Environment]::Is64BitOperatingSystem) { $arch = "i386" }
Write-Host "[netbird-telegraf] Node=$Name Arch=$arch Collector=$Collector"
try {
Invoke-WebRequest -UseBasicParsing -TimeoutSec 8 "http://${Collector}:9090/-/ready" | Out-Null
Write-Host "[netbird-telegraf] Collector erreichbar."
$h = @{}
if ($Token) { $h["Authorization"] = "Bearer $Token" }
$readyUrl = if ($Collector) { "$Base/-/ready" } else { "$Base/-/ready" }
Invoke-WebRequest -UseBasicParsing -TimeoutSec 10 -Headers $h $readyUrl | Out-Null
Write-Host "[netbird-telegraf] Collector erreichbar (auth ok)."
} catch {
Write-Warning "Collector http://${Collector}:9090 nicht erreichbar — NetBird verbunden? Installation läuft weiter, Telegraf puffert."
Write-Warning "Collector $PromUrl nicht erreichbar oder Token falsch — Installation läuft weiter, Telegraf puffert."
}
if (-not (Test-Path $Exe)) {
@@ -64,7 +75,7 @@ $cfg = @"
hostname = "$Name"
[[outputs.http]]
url = "http://${Collector}:9090/api/v1/write"
url = "$PromUrl"
data_format = "prometheusremotewrite"
timeout = "10s"
namedrop = ["win_eventlog"]
@@ -72,13 +83,18 @@ $cfg = @"
Content-Type = "application/x-protobuf"
Content-Encoding = "snappy"
X-Prometheus-Remote-Write-Version = "0.1.0"
Authorization = "Bearer $Token"
[[outputs.loki]]
domain = "http://${Collector}:3100"
domain = "$LokiUrl"
endpoint = "/loki/api/v1/push"
namepass = ["win_eventlog"]
sanitize_label_names = true
metric_name_label = ""
http_headers = { "Authorization" = "Bearer $Token" }
[[inputs.nvidia_smi]]
timeout = "10s"
[[inputs.cpu]]
percpu = false
@@ -109,5 +125,5 @@ Stop-Service telegraf -ErrorAction SilentlyContinue
Start-Service telegraf
Start-Sleep -Seconds 3
if ((Get-Service telegraf).Status -ne "Running") { throw "Dienst telegraf läuft nicht." }
Write-Host "[netbird-telegraf] OK — Node '$Name' liefert an http://${Collector}:9090 (Metriken) und :3100 (Eventlog Warn/Error)."
Write-Host "[netbird-telegraf] Grafana: http://${Collector}:3000 (nur im NetBird)"
Write-Host "[netbird-telegraf] OK — Node '$Name' liefert an $PromUrl (Metriken) und $LokiUrl (Eventlog Warn/Error)."
Write-Host "[netbird-telegraf] Grafana: http://100.83.134.46:3000 (nur im NetBird)"