# arxknight/diskwarden architecture

> Architecture diagram of the GitHub repository arxknight/diskwarden, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arxknight/diskwarden
- Repository: https://github.com/arxknight/diskwarden
- Video tour (about a minute): https://gitdiagram.com/arxknight/diskwarden/video

## Overview

DiskWarden is a Flask-based disk health monitor. Users view the dashboard or configure alert settings; the disk-health endpoint runs HDSentinel, parses its output, returns disk metrics, and sends threshold-triggered Discord and email alerts. The README documents dashboard metrics and notification options; the sampled app.py shows their runtime flow. Templates and static assets are present in the tree but were not sampled, so their interactions are not asserted.

Main entry points: [`app.py`](https://github.com/arxknight/diskwarden/blob/main/app.py) (Health Endpoint), [`settings.json`](https://github.com/arxknight/diskwarden/blob/main/settings.json) (JSON Settings), [`templates/index.html`](https://github.com/arxknight/diskwarden/blob/main/templates/index.html) (Dashboard View), [`templates/settings.html`](https://github.com/arxknight/diskwarden/blob/main/templates/settings.html) (Settings View)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web Interface"]
  node_flask["Flask Routes<br/>[app.py]"]
  node_dashboard["Dashboard View<br/>[index.html]"]
  node_settings_view["Settings View<br/>[settings.html]"]
  node_config["JSON Settings<br/>[settings.json]"]
end

subgraph group_monitor["Disk Monitoring"]
  node_health_api["Health Endpoint<br/>[app.py]"]
  node_hdsentinel["HDSentinel"]
  node_parser["Output Parser<br/>[app.py]"]
  node_disk_data["Disk Metrics<br/>[app.py]"]
end

subgraph group_alerts["Notifications"]
  node_threshold["Threshold Check<br/>[app.py]"]
  node_discord["Discord Webhook"]
  node_smtp["SMTP Email"]
  node_mail_sender["Email Sender<br/>[app.py]"]
  node_discord_sender["Discord Sender<br/>[app.py]"]
end

node_user(("Operator"))

node_user -->|"uses"| node_flask
node_flask -->|"renders"| node_dashboard
node_flask -->|"renders"| node_settings_view
node_flask -->|"loads and updates"| node_config
node_user -->|"requests metrics"| node_health_api
node_health_api -->|"runs"| node_hdsentinel
node_health_api -->|"parses output"| node_parser
node_parser -->|"extracts metrics"| node_disk_data
node_health_api -->|"reads settings"| node_config
node_health_api -->|"checks health"| node_threshold
node_threshold -->|"dispatches alert"| node_discord_sender
node_threshold -->|"dispatches alert"| node_mail_sender
node_discord_sender -->|"posts webhook"| node_discord
node_mail_sender -->|"sends email"| node_smtp
node_user -->|"configures alerts"| node_flask

click node_flask "https://github.com/arxknight/diskwarden/blob/main/app.py"
click node_dashboard "https://github.com/arxknight/diskwarden/blob/main/templates/index.html"
click node_settings_view "https://github.com/arxknight/diskwarden/blob/main/templates/settings.html"
click node_config "https://github.com/arxknight/diskwarden/blob/main/settings.json"
click node_health_api "https://github.com/arxknight/diskwarden/blob/main/app.py"
click node_parser "https://github.com/arxknight/diskwarden/blob/main/app.py"
click node_disk_data "https://github.com/arxknight/diskwarden/blob/main/app.py"
click node_threshold "https://github.com/arxknight/diskwarden/blob/main/app.py"
click node_mail_sender "https://github.com/arxknight/diskwarden/blob/main/app.py"
click node_discord_sender "https://github.com/arxknight/diskwarden/blob/main/app.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_flask,node_dashboard,node_settings_view,node_config toneBlue
class node_health_api,node_hdsentinel,node_parser,node_disk_data toneAmber
class node_threshold,node_discord,node_smtp,node_mail_sender,node_discord_sender toneMint
class node_user toneIndigo
```

## Components

### Web Interface

- [Flask Routes](https://github.com/arxknight/diskwarden/blob/main/app.py): `app.py`
- [Dashboard View](https://github.com/arxknight/diskwarden/blob/main/templates/index.html): `templates/index.html`
- [Settings View](https://github.com/arxknight/diskwarden/blob/main/templates/settings.html): `templates/settings.html`
- [JSON Settings](https://github.com/arxknight/diskwarden/blob/main/settings.json): `settings.json`

### Disk Monitoring

- [Health Endpoint](https://github.com/arxknight/diskwarden/blob/main/app.py): `app.py`
- **HDSentinel**
- [Output Parser](https://github.com/arxknight/diskwarden/blob/main/app.py): `app.py`
- [Disk Metrics](https://github.com/arxknight/diskwarden/blob/main/app.py): `app.py`

### Notifications

- [Threshold Check](https://github.com/arxknight/diskwarden/blob/main/app.py): `app.py`
- **Discord Webhook**
- **SMTP Email**
- [Email Sender](https://github.com/arxknight/diskwarden/blob/main/app.py): `app.py`
- [Discord Sender](https://github.com/arxknight/diskwarden/blob/main/app.py): `app.py`

### Other components

- **Operator**

## Connections

- Operator → Flask Routes: uses (evidence: `README.md`)
- Flask Routes → Dashboard View: renders (evidence: `app.py`)
- Flask Routes → Settings View: renders (evidence: `app.py`)
- Flask Routes → JSON Settings: loads and updates (evidence: `app.py`)
- Operator → Health Endpoint: requests metrics (evidence: `README.md`)
- Health Endpoint → HDSentinel: runs (evidence: `app.py`)
- Health Endpoint → Output Parser: parses output (evidence: `app.py`)
- Output Parser → Disk Metrics: extracts metrics (evidence: `app.py`)
- Health Endpoint → JSON Settings: reads settings (evidence: `app.py`)
- Health Endpoint → Threshold Check: checks health (evidence: `app.py`)
- Threshold Check → Discord Sender: dispatches alert (evidence: `app.py`)
- Threshold Check → Email Sender: dispatches alert (evidence: `app.py`)
- Discord Sender → Discord Webhook: posts webhook (evidence: `app.py`)
- Email Sender → SMTP Email: sends email (evidence: `app.py`)
- Operator → Flask Routes: configures alerts (evidence: `README.md`)
