diff --git a/Dockerfile b/Dockerfile index 3a65e82..b70cd68 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.10-slim +FROM python:3.13.3-slim WORKDIR /app @@ -7,5 +7,6 @@ RUN pip install --no-cache-dir -r requirements.txt COPY watcher.py . COPY config.yaml . +COPY templates . CMD ["python", "-u", "watcher.py"] diff --git a/config.yaml b/config.yaml index d5ebf9c..493e400 100644 --- a/config.yaml +++ b/config.yaml @@ -11,7 +11,7 @@ email: username: brass@relay.poloinformatico.it password: DMKqP9vUYn8s to: paciotti@poloinformatico.it - from: brass@poloinformatico.it + from: brass@relay.poloinformatico.it webui: enabled: true diff --git a/docker-compose.yml b/docker-compose.yml index 4539935..c7b3ebc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,7 @@ services: ports: - "48080:8080" volumes: - - ./config.yaml:/app/config.yml + - ./config.yaml:/app/config.yaml - /zucchetti/infinity:/mnt/tenants:ro + - ./templates:/app/templates:ro restart: unless-stopped diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..81f50a6 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,140 @@ + + +
+ +| Tenant | +Used (GB) | +Limit (GB) | +Usage % | +Status | +
|---|---|---|---|---|
| {{ folder }} | +{{ "%.2f"|format(data.used_gb) }} | +{{ "%.2f"|format(data.limit_gb) }} | ++ + {{ percent }}% + | ++ {{ 'Exceeded' if data.exceeded else 'OK' }} + | +
| Tenant | Used (GB) | Limit (GB) | Status |
|---|---|---|---|
| {{ folder }} | -{{ "%.2f"|format(data.used_gb) }} | -{{ "%.2f"|format(data.limit_gb) }} | -{{ 'Exceeded' if data.exceeded else 'OK' }} | -
Last updated: {{ now }}
- - - """ import datetime - return render_template_string(html, results=results, now=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + return render_template("index.html", results=results, now=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + if __name__ == "__main__": - interval = config.get("schedule", {}).get("seconds", 300) # default 5 minutes + interval = config.get("schedule", {}).get("seconds", 86400) # default 5 minutes print(f"[INFO] Starting scheduled checks every {interval} seconds.") schedule_check(interval)