# ellouzati-mohammed/aiops-sentinel architecture

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

- Interactive diagram: https://gitdiagram.com/ellouzati-mohammed/aiops-sentinel
- Repository: https://github.com/ellouzati-mohammed/aiops-sentinel

## Overview

AIOps Sentinel monitors HDFS logs, groups events into blocks, predicts anomalies, and exposes live and historical monitoring views. The main path is log ingestion through parsing, template matching, block completion, prediction, persistence, and realtime notification; API routes serve those results to dashboard, logs, blocks, predictions, templates, models, anomalies, and metrics pages. System metrics are separately aggregated and periodically snapshotted. Edges reflect explicit imports/calls in sampled sources or documented frontend routes and API endpoints; unsampled features are retained as components where the tree and API inventory support them, without guessing their internal wiring.

Main entry points: [`frontend/src/App.tsx`](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/App.tsx) (Page router), [`backend/aiops-api/app/main.py`](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/main.py) (FastAPI application), [`backend/aiops-api/app/services/block_manager.py`](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/services/block_manager.py) (Block lifecycle), [`backend/aiops-api/app/services/metrics_service.py`](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/services/metrics_service.py) (Metrics aggregation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Log processing"]
  node_simulator["HDFS log generator"]
  node_block_manager["Block lifecycle<br/>[block_manager.py]"]
  node_parser["Log parser<br/>[log_parser.py]"]
  node_matcher["Template matching"]
end

subgraph group_analysis["Prediction and storage"]
  node_predictor["Anomaly prediction<br/>[predictor.py]"]
  node_preprocessing["Feature preparation<br/>[preprocessing.py]"]
  node_postgres[("PostgreSQL")]
  node_db_setup["Database sessions<br/>[database.py]"]
  node_data_models["Domain records<br/>[models.py]"]
  node_realtime["Realtime broadcast<br/>[realtime.py]"]
  node_metrics_service["Metrics aggregation<br/>[metrics_service.py]"]
end

subgraph group_backend_api["Backend API"]
  node_logs_api["Log ingestion<br/>[logs.py]"]
  node_scheduler["Metrics scheduler"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_sequence_routes["Block sequences API<br/>[hdfs_sequences.py]"]
  node_template_routes["Templates API<br/>[hdfs_templates.py]"]
  node_model_routes["Models API<br/>[models.py]"]
  node_metrics_routes["System metrics API<br/>[system_metrics.py]"]
  node_health_routes["Health API<br/>[health.py]"]
end

subgraph group_frontend["Monitoring UI"]
  node_frontend_app["Page router<br/>[App.tsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_logs_page["Live logs<br/>[LiveLogs.tsx]"]
  node_blocks_page["Blocks view<br/>[Blocks.tsx]"]
  node_predictions_page["Predictions view<br/>[Predictions.tsx]"]
  node_anomalies_page["Anomalies view<br/>[Anomalies.tsx]"]
  node_models_page["Models view<br/>[Models.tsx]"]
  node_templates_page["Templates view<br/>[Templates.tsx]"]
  node_metrics_page["Metrics view<br/>[SystemMetrics.tsx]"]
  node_settings_page["Settings view<br/>[Settings.tsx]"]
  node_metrics_component["Metrics display<br/>[SystemMetrics.tsx]"]
  node_realtime_hook["Realtime client<br/>[useRealtime.ts]"]
  node_metrics_hook["Metrics history hook"]
end

node_operator(("Operator"))
node_elasticsearch[("Elasticsearch")]

node_operator -.->|"generates logs"| node_simulator
node_simulator -.->|"sends logs"| node_logs_api
node_operator -.->|"uses"| node_frontend_app
node_logs_api -->|"processes logs"| node_block_manager
node_block_manager -->|"parses events"| node_parser
node_block_manager -->|"matches templates"| node_matcher
node_block_manager -->|"predicts anomaly"| node_predictor
node_predictor -->|"prepares features"| node_preprocessing
node_block_manager -->|"opens session"| node_db_setup
node_block_manager -->|"persists sequence"| node_data_models
node_db_setup -->|"connects"| node_postgres
node_data_models -->|"uses Base"| node_db_setup
node_block_manager -->|"broadcasts events"| node_realtime
node_api_app -->|"serves websocket"| node_realtime
node_api_app -->|"starts task"| node_scheduler
node_scheduler -->|"collects snapshots"| node_metrics_service
node_metrics_service -->|"queries and saves"| node_db_setup
node_metrics_service -->|"reads metrics records"| node_data_models
node_metrics_service -->|"counts log events"| node_elasticsearch
node_api_app -->|"mounts routes"| node_health_routes
node_api_app -->|"mounts routes"| node_sequence_routes
node_api_app -->|"mounts routes"| node_template_routes
node_api_app -->|"mounts routes"| node_model_routes
node_api_app -->|"mounts routes"| node_metrics_routes
node_api_app -->|"mounts routes"| node_logs_api
node_frontend_app -->|"routes to"| node_dashboard
node_frontend_app -->|"routes to"| node_logs_page
node_frontend_app -->|"routes to"| node_blocks_page
node_frontend_app -->|"routes to"| node_predictions_page
node_frontend_app -->|"routes to"| node_anomalies_page
node_frontend_app -->|"routes to"| node_models_page
node_frontend_app -->|"routes to"| node_templates_page
node_frontend_app -->|"routes to"| node_metrics_page
node_frontend_app -->|"routes to"| node_settings_page
node_dashboard -->|"renders"| node_metrics_component
node_dashboard -->|"uses events"| node_realtime_hook
node_metrics_page -->|"renders"| node_metrics_component
node_metrics_page -->|"loads history"| node_metrics_hook
node_realtime_hook -->|"opens websocket"| node_api_app
node_metrics_hook -.->|"requests history"| node_metrics_routes

click node_simulator "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/simulator/hdfs_log_generator.py"
click node_logs_api "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/routers/logs.py"
click node_block_manager "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/services/block_manager.py"
click node_parser "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/services/log_parser.py"
click node_matcher "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/services/template_matcher.py"
click node_predictor "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/services/predictor.py"
click node_preprocessing "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/services/preprocessing.py"
click node_db_setup "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/database.py"
click node_data_models "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/models.py"
click node_realtime "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/services/realtime.py"
click node_metrics_service "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/services/metrics_service.py"
click node_scheduler "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/scheduler/metrics_scheduler.py"
click node_api_app "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/main.py"
click node_sequence_routes "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/routers/hdfs_sequences.py"
click node_template_routes "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/routers/hdfs_templates.py"
click node_model_routes "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/routers/models.py"
click node_metrics_routes "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/routers/system_metrics.py"
click node_health_routes "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/routers/health.py"
click node_frontend_app "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/App.tsx"
click node_dashboard "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/pages/Dashboard.tsx"
click node_logs_page "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/pages/LiveLogs.tsx"
click node_blocks_page "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/pages/Blocks.tsx"
click node_predictions_page "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/pages/Predictions.tsx"
click node_anomalies_page "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/pages/Anomalies.tsx"
click node_models_page "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/pages/Models.tsx"
click node_templates_page "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/pages/Templates.tsx"
click node_metrics_page "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/pages/SystemMetrics.tsx"
click node_settings_page "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/pages/Settings.tsx"
click node_metrics_component "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/components/common/SystemMetrics.tsx"
click node_realtime_hook "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/hooks/useRealtime.ts"
click node_metrics_hook "https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/hooks/useSystemMetricsHistory.ts"

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_simulator,node_block_manager,node_parser,node_matcher toneBlue
class node_predictor,node_preprocessing,node_postgres,node_db_setup,node_data_models,node_realtime,node_metrics_service,node_elasticsearch toneAmber
class node_logs_api,node_scheduler,node_api_app,node_sequence_routes,node_template_routes,node_model_routes,node_metrics_routes,node_health_routes toneMint
class node_frontend_app,node_dashboard,node_logs_page,node_blocks_page,node_predictions_page,node_anomalies_page,node_models_page,node_templates_page,node_metrics_page,node_settings_page,node_metrics_component,node_realtime_hook,node_metrics_hook toneRose
class node_operator toneIndigo
```

## Components

### Log processing

- [HDFS log generator](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/simulator/hdfs_log_generator.py): `simulator/hdfs_log_generator.py`
- [Block lifecycle](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/services/block_manager.py): `backend/aiops-api/app/services/block_manager.py`
- [Log parser](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/services/log_parser.py): `backend/aiops-api/app/services/log_parser.py`
- [Template matching](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/services/template_matcher.py): `backend/aiops-api/app/services/template_matcher.py`

### Prediction and storage

- [Anomaly prediction](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/services/predictor.py): `backend/aiops-api/app/services/predictor.py`
- [Feature preparation](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/services/preprocessing.py): `backend/aiops-api/app/services/preprocessing.py`
- **PostgreSQL**
- [Database sessions](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/database.py): `backend/aiops-api/app/database.py`
- [Domain records](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/models.py): `backend/aiops-api/app/models.py`
- [Realtime broadcast](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/services/realtime.py): `backend/aiops-api/app/services/realtime.py`
- [Metrics aggregation](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/services/metrics_service.py): `backend/aiops-api/app/services/metrics_service.py`

### Backend API

- [Log ingestion](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/routers/logs.py): `backend/aiops-api/app/routers/logs.py`
- [Metrics scheduler](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/scheduler/metrics_scheduler.py): `backend/aiops-api/app/scheduler/metrics_scheduler.py`
- [FastAPI application](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/main.py): `backend/aiops-api/app/main.py`
- [Block sequences API](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/routers/hdfs_sequences.py): `backend/aiops-api/app/routers/hdfs_sequences.py`
- [Templates API](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/routers/hdfs_templates.py): `backend/aiops-api/app/routers/hdfs_templates.py`
- [Models API](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/routers/models.py): `backend/aiops-api/app/routers/models.py`
- [System metrics API](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/routers/system_metrics.py): `backend/aiops-api/app/routers/system_metrics.py`
- [Health API](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/backend/aiops-api/app/routers/health.py): `backend/aiops-api/app/routers/health.py`

### Monitoring UI

- [Page router](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Dashboard](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/pages/Dashboard.tsx): `frontend/src/pages/Dashboard.tsx`
- [Live logs](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/pages/LiveLogs.tsx): `frontend/src/pages/LiveLogs.tsx`
- [Blocks view](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/pages/Blocks.tsx): `frontend/src/pages/Blocks.tsx`
- [Predictions view](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/pages/Predictions.tsx): `frontend/src/pages/Predictions.tsx`
- [Anomalies view](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/pages/Anomalies.tsx): `frontend/src/pages/Anomalies.tsx`
- [Models view](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/pages/Models.tsx): `frontend/src/pages/Models.tsx`
- [Templates view](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/pages/Templates.tsx): `frontend/src/pages/Templates.tsx`
- [Metrics view](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/pages/SystemMetrics.tsx): `frontend/src/pages/SystemMetrics.tsx`
- [Settings view](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/pages/Settings.tsx): `frontend/src/pages/Settings.tsx`
- [Metrics display](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/components/common/SystemMetrics.tsx): `frontend/src/components/common/SystemMetrics.tsx`
- [Realtime client](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/hooks/useRealtime.ts): `frontend/src/hooks/useRealtime.ts`
- [Metrics history hook](https://github.com/ellouzati-mohammed/aiops-sentinel/blob/main/frontend/src/hooks/useSystemMetricsHistory.ts): `frontend/src/hooks/useSystemMetricsHistory.ts`

### Other components

- **Operator**
- **Elasticsearch**

## Connections

- Operator → HDFS log generator: generates logs
- HDFS log generator → Log ingestion: sends logs
- Operator → Page router: uses
- Log ingestion → Block lifecycle: processes logs (evidence: `backend/aiops-api/app/routers/logs.py`)
- Block lifecycle → Log parser: parses events (evidence: `backend/aiops-api/app/services/block_manager.py`)
- Block lifecycle → Template matching: matches templates (evidence: `backend/aiops-api/app/services/block_manager.py`)
- Block lifecycle → Anomaly prediction: predicts anomaly (evidence: `backend/aiops-api/app/services/block_manager.py`)
- Anomaly prediction → Feature preparation: prepares features (evidence: `backend/aiops-api/app/services/predictor.py`)
- Block lifecycle → Database sessions: opens session (evidence: `backend/aiops-api/app/services/block_manager.py`)
- Block lifecycle → Domain records: persists sequence (evidence: `backend/aiops-api/app/services/block_manager.py`)
- Database sessions → PostgreSQL: connects (evidence: `backend/aiops-api/app/database.py`)
- Domain records → Database sessions: uses Base (evidence: `backend/aiops-api/app/models.py`)
- Block lifecycle → Realtime broadcast: broadcasts events (evidence: `backend/aiops-api/app/services/block_manager.py`)
- FastAPI application → Realtime broadcast: serves websocket (evidence: `backend/aiops-api/app/main.py`)
- FastAPI application → Metrics scheduler: starts task (evidence: `backend/aiops-api/app/main.py`)
- Metrics scheduler → Metrics aggregation: collects snapshots (evidence: `backend/aiops-api/app/scheduler/metrics_scheduler.py`)
- Metrics aggregation → Database sessions: queries and saves (evidence: `backend/aiops-api/app/services/metrics_service.py`)
- Metrics aggregation → Domain records: reads metrics records (evidence: `backend/aiops-api/app/services/metrics_service.py`)
- Metrics aggregation → Elasticsearch: counts log events (evidence: `backend/aiops-api/app/services/metrics_service.py`)
- FastAPI application → Health API: mounts routes (evidence: `backend/aiops-api/app/main.py`)
- FastAPI application → Block sequences API: mounts routes (evidence: `backend/aiops-api/app/main.py`)
- FastAPI application → Templates API: mounts routes (evidence: `backend/aiops-api/app/main.py`)
- FastAPI application → Models API: mounts routes (evidence: `backend/aiops-api/app/main.py`)
- FastAPI application → System metrics API: mounts routes (evidence: `backend/aiops-api/app/main.py`)
- FastAPI application → Log ingestion: mounts routes (evidence: `backend/aiops-api/app/main.py`)
- Page router → Dashboard: routes to (evidence: `frontend/src/App.tsx`)
- Page router → Live logs: routes to (evidence: `frontend/src/App.tsx`)
- Page router → Blocks view: routes to (evidence: `frontend/src/App.tsx`)
- Page router → Predictions view: routes to (evidence: `frontend/src/App.tsx`)
- Page router → Anomalies view: routes to (evidence: `frontend/src/App.tsx`)
- Page router → Models view: routes to (evidence: `frontend/src/App.tsx`)
- Page router → Templates view: routes to (evidence: `frontend/src/App.tsx`)
- Page router → Metrics view: routes to (evidence: `frontend/src/App.tsx`)
- Page router → Settings view: routes to (evidence: `frontend/src/App.tsx`)
- Dashboard → Metrics display: renders (evidence: `frontend/src/pages/Dashboard.tsx`)
- Dashboard → Realtime client: uses events (evidence: `frontend/src/pages/Dashboard.tsx`)
- Metrics view → Metrics display: renders (evidence: `frontend/src/pages/SystemMetrics.tsx`)
- Metrics view → Metrics history hook: loads history (evidence: `frontend/src/pages/SystemMetrics.tsx`)
- Realtime client → FastAPI application: opens websocket (evidence: `frontend/src/hooks/useRealtime.ts`)
- Metrics history hook → System metrics API: requests history
