# rajinikanthvadla-ai/aiops-realworld-labs architecture

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

- Interactive diagram: https://gitdiagram.com/rajinikanthvadla-ai/aiops-realworld-labs
- Repository: https://github.com/rajinikanthvadla-ai/aiops-realworld-labs

## Overview

This AIOps lab collects historical CPU metrics from Prometheus, trains an Isolation Forest model, then repeatedly checks live CPU readings and sends Slack alerts for anomalies. The scripts and their artifact handoffs are shown as the main workflow; configuration and external services are included where visible. The README gives no further product description, and the deployment/configuration files were not sampled, so their wiring is not asserted.

Main entry points: [`DAY-01/aiops-lab/scripts/detect_anomalies.py`](https://github.com/rajinikanthvadla-ai/aiops-realworld-labs/blob/main/DAY-01/aiops-lab/scripts/detect_anomalies.py) (Detect Anomalies), [`DAY-01/aiops-lab/scripts/fetch_metrics.py`](https://github.com/rajinikanthvadla-ai/aiops-realworld-labs/blob/main/DAY-01/aiops-lab/scripts/fetch_metrics.py) (Fetch Metrics), [`DAY-01/aiops-lab/scripts/train_model.py`](https://github.com/rajinikanthvadla-ai/aiops-realworld-labs/blob/main/DAY-01/aiops-lab/scripts/train_model.py) (Train Model), [`DAY-01/aiops-lab/scripts/config.ini`](https://github.com/rajinikanthvadla-ai/aiops-realworld-labs/blob/main/DAY-01/aiops-lab/scripts/config.ini) (Monitoring Config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Metric Collection"]
  node_fetch["Fetch Metrics<br/>[fetch_metrics.py]"]
  node_config["Monitoring Config<br/>[config.ini]"]
  node_metrics_csv["CPU Metrics CSV"]
end

subgraph group_modeling["Model Training"]
  node_train["Train Model<br/>[train_model.py]"]
  node_model_file["Trained Model"]
end

subgraph group_monitoring["Anomaly Monitoring"]
  node_detect["Detect Anomalies"]
end

node_operator(("Operator"))
node_prometheus["Prometheus"]
node_slack["Slack"]

node_operator -->|"runs"| node_fetch
node_operator -->|"runs"| node_train
node_operator -->|"runs"| node_detect
node_fetch -->|"queries history"| node_prometheus
node_fetch -->|"reads"| node_config
node_fetch -->|"writes"| node_metrics_csv
node_train -->|"reads"| node_metrics_csv
node_train -->|"writes"| node_model_file
node_detect -->|"loads"| node_model_file
node_detect -->|"reads"| node_config
node_detect -->|"queries live data"| node_prometheus
node_detect -->|"posts alerts"| node_slack

click node_fetch "https://github.com/rajinikanthvadla-ai/aiops-realworld-labs/blob/main/DAY-01/aiops-lab/scripts/fetch_metrics.py"
click node_config "https://github.com/rajinikanthvadla-ai/aiops-realworld-labs/blob/main/DAY-01/aiops-lab/scripts/config.ini"
click node_train "https://github.com/rajinikanthvadla-ai/aiops-realworld-labs/blob/main/DAY-01/aiops-lab/scripts/train_model.py"
click node_detect "https://github.com/rajinikanthvadla-ai/aiops-realworld-labs/blob/main/DAY-01/aiops-lab/scripts/detect_anomalies.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_fetch,node_config,node_metrics_csv toneBlue
class node_train,node_model_file toneAmber
class node_detect toneMint
class node_operator,node_prometheus,node_slack toneIndigo
```

## Components

### Metric Collection

- [Fetch Metrics](https://github.com/rajinikanthvadla-ai/aiops-realworld-labs/blob/main/DAY-01/aiops-lab/scripts/fetch_metrics.py): `DAY-01/aiops-lab/scripts/fetch_metrics.py`
- [Monitoring Config](https://github.com/rajinikanthvadla-ai/aiops-realworld-labs/blob/main/DAY-01/aiops-lab/scripts/config.ini): `DAY-01/aiops-lab/scripts/config.ini`
- **CPU Metrics CSV**

### Model Training

- [Train Model](https://github.com/rajinikanthvadla-ai/aiops-realworld-labs/blob/main/DAY-01/aiops-lab/scripts/train_model.py): `DAY-01/aiops-lab/scripts/train_model.py`
- **Trained Model**

### Anomaly Monitoring

- [Detect Anomalies](https://github.com/rajinikanthvadla-ai/aiops-realworld-labs/blob/main/DAY-01/aiops-lab/scripts/detect_anomalies.py): `DAY-01/aiops-lab/scripts/detect_anomalies.py`

### Other components

- **Operator**
- **Prometheus**
- **Slack**

## Connections

- Operator → Fetch Metrics: runs (evidence: `DAY-01/aiops-lab/scripts/fetch_metrics.py`)
- Operator → Train Model: runs (evidence: `DAY-01/aiops-lab/scripts/train_model.py`)
- Operator → Detect Anomalies: runs (evidence: `DAY-01/aiops-lab/scripts/detect_anomalies.py`)
- Fetch Metrics → Prometheus: queries history (evidence: `DAY-01/aiops-lab/scripts/fetch_metrics.py`)
- Fetch Metrics → Monitoring Config: reads (evidence: `DAY-01/aiops-lab/scripts/fetch_metrics.py`)
- Fetch Metrics → CPU Metrics CSV: writes (evidence: `DAY-01/aiops-lab/scripts/fetch_metrics.py`)
- Train Model → CPU Metrics CSV: reads (evidence: `DAY-01/aiops-lab/scripts/train_model.py`)
- Train Model → Trained Model: writes (evidence: `DAY-01/aiops-lab/scripts/train_model.py`)
- Detect Anomalies → Trained Model: loads (evidence: `DAY-01/aiops-lab/scripts/detect_anomalies.py`)
- Detect Anomalies → Monitoring Config: reads (evidence: `DAY-01/aiops-lab/scripts/detect_anomalies.py`)
- Detect Anomalies → Prometheus: queries live data (evidence: `DAY-01/aiops-lab/scripts/detect_anomalies.py`)
- Detect Anomalies → Slack: posts alerts (evidence: `DAY-01/aiops-lab/scripts/detect_anomalies.py`)
