# rajankt07/system-health-monitor architecture

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

- Interactive diagram: https://gitdiagram.com/rajankt07/system-health-monitor
- Repository: https://github.com/rajankt07/system-health-monitor

## Overview

This is a small system-health monitor: it samples CPU, memory, and disk usage, appends a report, and emails an alert when configured thresholds are exceeded. The workflow is implemented in one script. The source imports a runtime `config` module, but the tree contains only `config.example.py`; its values also do not fully match the names used by the script, so the actual runtime configuration is not shown.

Main entry points: [`monitor.py`](https://github.com/rajankt07/system-health-monitor/blob/main/monitor.py) (Monitor entry point)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_operator(("Operator"))
node_monitor["Monitor entry point<br/>[monitor.py]"]
node_health["Health checks<br/>[monitor.py]"]
node_report["Report logger<br/>[monitor.py]"]
node_alerts["Email alerts<br/>[monitor.py]"]
node_psutil["psutil"]
node_runtime_config["Runtime config"]
node_report_file[("report.log")]
node_smtp["SMTP server"]
node_config_example["Config example<br/>[config.example.py]"]

node_operator -.->|"runs"| node_monitor
node_monitor -->|"calls"| node_health
node_health -->|"reads metrics"| node_psutil
node_health -->|"reads thresholds"| node_runtime_config
node_health -->|"returns metrics"| node_monitor
node_monitor -->|"calls"| node_report
node_report -->|"appends report"| node_report_file
node_monitor -->|"calls when needed"| node_alerts
node_alerts -->|"reads mail settings"| node_runtime_config
node_alerts -->|"sends email"| node_smtp

click node_monitor "https://github.com/rajankt07/system-health-monitor/blob/main/monitor.py"
click node_health "https://github.com/rajankt07/system-health-monitor/blob/main/monitor.py"
click node_report "https://github.com/rajankt07/system-health-monitor/blob/main/monitor.py"
click node_alerts "https://github.com/rajankt07/system-health-monitor/blob/main/monitor.py"
click node_config_example "https://github.com/rajankt07/system-health-monitor/blob/main/config.example.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_operator,node_psutil,node_runtime_config toneIndigo
class node_monitor,node_health,node_report,node_alerts,node_config_example toneTeal
class node_report_file toneAmber
class node_smtp toneMint
```

## Components

### Other components

- **Operator**
- [Monitor entry point](https://github.com/rajankt07/system-health-monitor/blob/main/monitor.py): `monitor.py`
- [Health checks](https://github.com/rajankt07/system-health-monitor/blob/main/monitor.py): `monitor.py`
- [Report logger](https://github.com/rajankt07/system-health-monitor/blob/main/monitor.py): `monitor.py`
- [Email alerts](https://github.com/rajankt07/system-health-monitor/blob/main/monitor.py): `monitor.py`
- **psutil**
- **Runtime config**
- **report.log**
- **SMTP server**
- [Config example](https://github.com/rajankt07/system-health-monitor/blob/main/config.example.py): `config.example.py`

## Connections

- Operator → Monitor entry point: runs
- Monitor entry point → Health checks: calls (evidence: `monitor.py`)
- Health checks → psutil: reads metrics (evidence: `monitor.py`)
- Health checks → Runtime config: reads thresholds (evidence: `monitor.py`)
- Health checks → Monitor entry point: returns metrics (evidence: `monitor.py`)
- Monitor entry point → Report logger: calls (evidence: `monitor.py`)
- Report logger → report.log: appends report (evidence: `monitor.py`)
- Monitor entry point → Email alerts: calls when needed (evidence: `monitor.py`)
- Email alerts → Runtime config: reads mail settings (evidence: `monitor.py`)
- Email alerts → SMTP server: sends email (evidence: `monitor.py`)
