# anrighe/webapp-monitor-tool architecture

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

- Interactive diagram: https://gitdiagram.com/anrighe/webapp-monitor-tool
- Repository: https://github.com/anrighe/webapp-monitor-tool

## Overview

WebApp Monitor Tool loads and validates JSON configuration, constructs monitors for active apps, performs timed/retried HTTP checks, and aggregates status and latency results. The runner reports outcomes through logging and sends administrator email for checks still failing after retries. The graph includes configuration, monitoring, orchestration, and notification/reporting. Some relationships are supported only by README workflow documentation; unsampled implementation details are not inferred.

Main entry points: [`src/main.cpp`](https://github.com/anrighe/webapp-monitor-tool/blob/main/src/main.cpp) (Application entry), [`src/health_check_runner.cpp`](https://github.com/anrighe/webapp-monitor-tool/blob/main/src/health_check_runner.cpp) (Health check runner), [`src/config.cpp`](https://github.com/anrighe/webapp-monitor-tool/blob/main/src/config.cpp) (Config loader), [`src/i_endpoint_monitor.cpp`](https://github.com/anrighe/webapp-monitor-tool/blob/main/src/i_endpoint_monitor.cpp) (Monitor retry loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_configuration["Configuration"]
  node_config["Config loader<br/>[config.cpp]"]
  node_app_settings["App settings<br/>[config.hpp]"]
end

subgraph group_monitoring["Health monitoring"]
  node_monitor_base["Monitor retry loop"]
  node_http_monitor["HTTP monitor"]
  node_result["Health check result"]
end

subgraph group_orchestration["Run orchestration"]
  node_entry["Application entry<br/>[main.cpp]"]
  node_runner["Health check runner"]
end

subgraph group_reporting["Reporting and alerts"]
  node_logger["Logger setup<br/>[logger.cpp]"]
  node_email_sender["Email sender<br/>[email_sender.cpp]"]
  node_formatter["Text formatter<br/>[text_formatter.hpp]"]
end

node_operator(("Operator"))
node_config_file["JSON config"]
node_endpoint(("Monitored HTTP service"))
node_log_file["Log file"]
node_smtp(("SMTP service"))

node_operator -->|"starts"| node_entry
node_entry -->|"loads"| node_config
node_operator -.->|"provides"| node_config_file
node_config -->|"reads JSON"| node_config_file
node_config -->|"creates"| node_app_settings
node_entry -->|"initializes"| node_logger
node_entry -->|"runs"| node_runner
node_entry -->|"constructs"| node_http_monitor
node_runner -->|"reads apps"| node_app_settings
node_runner -->|"runs checks"| node_monitor_base
node_monitor_base -->|"dispatches request"| node_http_monitor
node_http_monitor -->|"sends HTTP"| node_endpoint
node_monitor_base -->|"returns result"| node_result
node_runner -->|"aggregates"| node_result
node_runner -->|"logs outcomes"| node_logger
node_logger -.->|"writes logs"| node_log_file
node_runner -->|"alerts failures"| node_email_sender
node_email_sender -->|"sends email"| node_smtp
node_entry -->|"formats errors"| node_formatter

click node_config "https://github.com/anrighe/webapp-monitor-tool/blob/main/src/config.cpp"
click node_app_settings "https://github.com/anrighe/webapp-monitor-tool/blob/main/include/config.hpp"
click node_entry "https://github.com/anrighe/webapp-monitor-tool/blob/main/src/main.cpp"
click node_runner "https://github.com/anrighe/webapp-monitor-tool/blob/main/src/health_check_runner.cpp"
click node_monitor_base "https://github.com/anrighe/webapp-monitor-tool/blob/main/src/i_endpoint_monitor.cpp"
click node_http_monitor "https://github.com/anrighe/webapp-monitor-tool/blob/main/src/http_endpoint_monitor.cpp"
click node_result "https://github.com/anrighe/webapp-monitor-tool/blob/main/include/health_check_result.hpp"
click node_logger "https://github.com/anrighe/webapp-monitor-tool/blob/main/src/logger.cpp"
click node_email_sender "https://github.com/anrighe/webapp-monitor-tool/blob/main/src/email_sender.cpp"
click node_formatter "https://github.com/anrighe/webapp-monitor-tool/blob/main/include/text_formatter.hpp"

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_config,node_app_settings toneBlue
class node_monitor_base,node_http_monitor,node_result toneAmber
class node_entry,node_runner toneMint
class node_logger,node_email_sender,node_formatter toneRose
class node_operator,node_config_file,node_endpoint,node_log_file,node_smtp toneIndigo
```

## Components

### Configuration

- [Config loader](https://github.com/anrighe/webapp-monitor-tool/blob/main/src/config.cpp): `src/config.cpp`
- [App settings](https://github.com/anrighe/webapp-monitor-tool/blob/main/include/config.hpp): `include/config.hpp`

### Health monitoring

- [Monitor retry loop](https://github.com/anrighe/webapp-monitor-tool/blob/main/src/i_endpoint_monitor.cpp): `src/i_endpoint_monitor.cpp`
- [HTTP monitor](https://github.com/anrighe/webapp-monitor-tool/blob/main/src/http_endpoint_monitor.cpp): `src/http_endpoint_monitor.cpp`
- [Health check result](https://github.com/anrighe/webapp-monitor-tool/blob/main/include/health_check_result.hpp): `include/health_check_result.hpp`

### Run orchestration

- [Application entry](https://github.com/anrighe/webapp-monitor-tool/blob/main/src/main.cpp): `src/main.cpp`
- [Health check runner](https://github.com/anrighe/webapp-monitor-tool/blob/main/src/health_check_runner.cpp): `src/health_check_runner.cpp`

### Reporting and alerts

- [Logger setup](https://github.com/anrighe/webapp-monitor-tool/blob/main/src/logger.cpp): `src/logger.cpp`
- [Email sender](https://github.com/anrighe/webapp-monitor-tool/blob/main/src/email_sender.cpp): `src/email_sender.cpp`
- [Text formatter](https://github.com/anrighe/webapp-monitor-tool/blob/main/include/text_formatter.hpp): `include/text_formatter.hpp`

### Other components

- **Operator**
- **JSON config**
- **Monitored HTTP service**
- **Log file**
- **SMTP service**

## Connections

- Operator → Application entry: starts (evidence: `src/main.cpp`)
- Application entry → Config loader: loads (evidence: `src/main.cpp`)
- Operator → JSON config: provides
- Config loader → JSON config: reads JSON
- Config loader → App settings: creates (evidence: `src/config.cpp`)
- Application entry → Logger setup: initializes (evidence: `src/main.cpp`)
- Application entry → Health check runner: runs (evidence: `src/main.cpp`)
- Application entry → HTTP monitor: constructs (evidence: `src/main.cpp`)
- Health check runner → App settings: reads apps
- Health check runner → Monitor retry loop: runs checks
- Monitor retry loop → HTTP monitor: dispatches request (evidence: `src/i_endpoint_monitor.cpp`)
- HTTP monitor → Monitored HTTP service: sends HTTP
- Monitor retry loop → Health check result: returns result (evidence: `src/i_endpoint_monitor.cpp`)
- Health check runner → Health check result: aggregates
- Health check runner → Logger setup: logs outcomes
- Logger setup → Log file: writes logs
- Health check runner → Email sender: alerts failures
- Email sender → SMTP service: sends email
- Application entry → Text formatter: formats errors (evidence: `src/main.cpp`)
