P42-S.M.: Server-Monitoring-Agent als Docker-Container
Misst CPU, RAM, Swap, Platten, Netzwerk, Temperaturen und Prozesse des Hosts und liefert sie als JSON-API (/api/metrics, /api/history) für das P42-Dashboard. Nur Python-Standardbibliothek, Token-geschützt, Container ohne Root und mit schreibgeschütztem Dateisystem. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
c6eef176a2
11 files changed
+727
No files matched your search
+25
@@ -0,0 +1,25 @@
|
||||
# P42-S.M. – liefert die Auslastung des Host-Servers als JSON-API (nur Python-Standardbibliothek).
|
||||
FROM python:3.13-slim
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
TZ=Europe/Berlin \
|
||||
HOST=0.0.0.0 \
|
||||
PORT=9142 \
|
||||
HOST_PROC=/host/proc \
|
||||
HOST_SYS=/sys \
|
||||
HOST_ROOT=/host/root
|
||||
|
||||
WORKDIR /app
|
||||
COPY app ./app
|
||||
|
||||
# Ohne Root-Rechte laufen (UID über SM_UID in .env änderbar, siehe README)
|
||||
RUN useradd --uid 1000 --no-create-home --shell /usr/sbin/nologin sm
|
||||
USER 1000
|
||||
|
||||
EXPOSE 9142
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||
CMD python -c "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:9142/api/health', timeout=4).status == 200 else 1)"
|
||||
|
||||
CMD ["python", "-m", "app"]
|
||||
Reference in new issue
Block a user