llama-swap-Telemetrie als Nutzer-Instanz (Knoten ohne sudo)
Warum: llama-swap laeuft als Nutzer-Unit. Der System-Telegraf liest das Systemjournal mit priority>=warning und liest damit keine einzige llama-swap-INFO-Zeile - Loki hatte fuer den ROG null Zeilen. Ausserdem kann die System-Instanz auf einem Knoten ohne sudo nicht erweitert werden. - scripts/llamaswap-telemetrie.py: Token/Anfragen je Modell aus llama-swaps Statistik-API plus llama.cpp /metrics je laufendem Profil (Ports sind dynamisch, deshalb kein statischer Scrape) - scripts/llamaswap-logs.py: Nutzer-Journal (llama-swap, kalina-backends) nach Loki, gleiche Zeilenform wie journal-tail.sh - telegraf/llamaswap-user.conf + .service: Zugangsdaten per EnvironmentFile=/etc/default/telegraf, keine Token-Kopie - scripts/install-llamaswap-user.sh: idempotente Installation mit --dry-run und Konfigurationspruefung
This commit is contained in:
1 parent
59ab6a9a22
commit
235cbc68dc
6 files changed
+646
No files matched your search
@@ -0,0 +1,82 @@
|
||||
# llama-swap-Telemetrie des ROG — Nutzer-Instanz von Telegraf.
|
||||
#
|
||||
# Warum eine zweite Instanz und nicht /etc/telegraf/telegraf.d:
|
||||
# Auf dem ROG gibt es kein sudo. llama-swap und kalina-backends laufen als
|
||||
# Nutzer-Units; ihre Logs stehen im Nutzer-Journal und werden von der
|
||||
# System-Instanz (journal-tail.sh, priority>=warning) verworfen. Eine
|
||||
# Nutzer-Instanz darf --user-unit lesen und braucht keinen root.
|
||||
#
|
||||
# Zugangsdaten NICHT hier: das Systemd-Unit setzt
|
||||
# EnvironmentFile=/etc/default/telegraf, Telegraf expandiert ${PROM_URL},
|
||||
# ${LOKI_URL}, ${TELEGRAF_TOKEN} beim Laden. Eine Quelle fuer alle Knoten.
|
||||
#
|
||||
# Aufruf: telegraf --config /home/mm/.config/telegraf-llamaswap/telegraf.conf
|
||||
|
||||
[global_tags]
|
||||
node = "ROG"
|
||||
|
||||
[agent]
|
||||
interval = "15s"
|
||||
flush_interval = "15s"
|
||||
metric_batch_size = 1000
|
||||
metric_buffer_limit = 20000
|
||||
hostname = "ROG"
|
||||
omit_hostname = false
|
||||
round_interval = true
|
||||
skip_processors_after_aggregators = true
|
||||
|
||||
# ---- Metriken → Prometheus Remote Write (imac) ----
|
||||
[[outputs.http]]
|
||||
url = "${PROM_URL}"
|
||||
data_format = "prometheusremotewrite"
|
||||
timeout = "10s"
|
||||
namedrop = ["journal"]
|
||||
[outputs.http.headers]
|
||||
Content-Type = "application/x-protobuf"
|
||||
Content-Encoding = "snappy"
|
||||
X-Prometheus-Remote-Write-Version = "0.1.0"
|
||||
Authorization = "Bearer ${TELEGRAF_TOKEN}"
|
||||
|
||||
# ---- Logs → Loki (imac) ----
|
||||
[[outputs.loki]]
|
||||
domain = "${LOKI_URL}"
|
||||
endpoint = "/loki/api/v1/push"
|
||||
timeout = "10s"
|
||||
namepass = ["journal"]
|
||||
sanitize_label_names = true
|
||||
metric_name_label = ""
|
||||
http_headers = { "Authorization" = "Bearer ${TELEGRAF_TOKEN}" }
|
||||
|
||||
# ---- 1. llama-swap selbst: System- und GPU-Werte ----
|
||||
# /metrics liefert llama-swap nativ (CPU, RAM, Netz, GPU-Auslastung, VRAM,
|
||||
# Temperatur, Leistungsaufnahme). Namen sind schon llamaswap_*.
|
||||
[[inputs.prometheus]]
|
||||
urls = ["http://192.168.188.184:9300/metrics"]
|
||||
metric_version = 2
|
||||
interval = "30s"
|
||||
timeout = "10s"
|
||||
[inputs.prometheus.tags]
|
||||
app = "llama-swap"
|
||||
|
||||
# ---- 2. Token-/Request-Zaehler je Modell ----
|
||||
# Ein exec statt fester Ports: llama-swap vergibt die Upstream-Ports dynamisch
|
||||
# (${PORT}, startPort 9340) und nur laufende Modelle haben ueberhaupt eine
|
||||
# /metrics. Das Skript fragt llama-swap selbst und ergaenzt das model-Label.
|
||||
[[inputs.exec]]
|
||||
commands = [["/home/mm/bin/llamaswap-telemetrie.py"]]
|
||||
data_format = "prometheus"
|
||||
interval = "60s"
|
||||
timeout = "25s"
|
||||
[inputs.exec.tags]
|
||||
app = "llama-swap"
|
||||
|
||||
# ---- 3. Logs der Nutzer-Units (llama-swap, kalina-backends) ----
|
||||
# Gleiche Zeilenform wie journal-tail.sh (measurement journal), damit die
|
||||
# bestehenden Log-Panels ohne Sonderfall greifen.
|
||||
[[inputs.exec]]
|
||||
commands = [["/home/mm/bin/llamaswap-logs.py"]]
|
||||
data_format = "influx"
|
||||
interval = "30s"
|
||||
timeout = "20s"
|
||||
[inputs.exec.tags]
|
||||
app = "llama-swap"
|
||||
@@ -0,0 +1,22 @@
|
||||
[Unit]
|
||||
Description=Telegraf — llama-swap-Telemetrie (ROG, Nutzer-Instanz)
|
||||
Documentation=https://github.com/influxdata/telegraf
|
||||
# Ohne llama-swap gibt es nichts zu holen; die Unit startet trotzdem, damit
|
||||
# ein spaeterer llama-swap-Start nicht am Logger scheitert (After statt Requires).
|
||||
After=network-online.target llama-swap.service
|
||||
Wants=llama-swap.service
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
NotifyAccess=all
|
||||
# Dieselben Zugangsdaten wie die System-Instanz: eine Quelle pro Knoten,
|
||||
# keine Kopie des Tokens in dieser Unit oder im Conf.
|
||||
EnvironmentFile=/etc/default/telegraf
|
||||
ExecStart=/usr/bin/telegraf --config /home/mm/.config/telegraf-llamaswap/telegraf.conf
|
||||
Restart=on-failure
|
||||
RestartForceExitStatus=SIGPIPE
|
||||
KillMode=mixed
|
||||
LimitMEMLOCK=8M:8M
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
Reference in new issue
Block a user