chore: initialise la structure du projet SentinelMesh
- Workspace Cargo avec backend, agent-scan-network, agent-metric - Skeleton Rust pour les trois crates (Axum, Tokio, SQLx) - Documentation : README, FEATURES, ROADMAP, ARCHITECTURE, API, INSTALL - Exemples de widgets Glance (custom-api) - Script d'installation agents (squelette Phase 5) - Docker Compose + Dockerfile backend - .gitignore et CLAUDE.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+62
@@ -0,0 +1,62 @@
|
||||
# API SentinelMesh
|
||||
|
||||
Base URL : `http://<host>:8080/api/v1/`
|
||||
|
||||
Toutes les réponses sont en JSON. Auth par token Bearer (header `Authorization: Bearer <token>`).
|
||||
|
||||
## Endpoints
|
||||
|
||||
### Santé
|
||||
|
||||
| Méthode | Endpoint | Description |
|
||||
|---------|------------------|--------------------|
|
||||
| GET | `/api/v1/health` | État du backend |
|
||||
|
||||
### Agents
|
||||
|
||||
| Méthode | Endpoint | Description |
|
||||
|---------|-----------------------|--------------------------------|
|
||||
| GET | `/api/v1/agents` | Liste des agents enregistrés |
|
||||
| POST | `/api/v1/agents` | Enregistrement d'un agent |
|
||||
| GET | `/api/v1/agents/{id}` | Détail d'un agent |
|
||||
|
||||
### Réseau
|
||||
|
||||
| Méthode | Endpoint | Description |
|
||||
|---------|-----------------------|------------------------------------|
|
||||
| GET | `/api/v1/network` | Équipements découverts |
|
||||
| POST | `/api/v1/network` | Push scan depuis agent |
|
||||
| GET | `/api/v1/network/{ip}`| Détail d'un équipement |
|
||||
|
||||
### Métriques
|
||||
|
||||
| Méthode | Endpoint | Description |
|
||||
|---------|-----------------------|------------------------------------|
|
||||
| GET | `/api/v1/metrics` | Métriques de tous les agents |
|
||||
| POST | `/api/v1/metrics` | Push métriques depuis agent |
|
||||
| GET | `/api/v1/metrics/{id}`| Métriques d'un agent |
|
||||
|
||||
### Widgets (consommés par Glance)
|
||||
|
||||
| Méthode | Endpoint | Cache Glance |
|
||||
|---------|-------------------------------|--------------|
|
||||
| GET | `/api/v1/widgets/network` | 30s |
|
||||
| GET | `/api/v1/widgets/metrics` | 1s |
|
||||
|
||||
### Événements
|
||||
|
||||
| Méthode | Endpoint | Description |
|
||||
|---------|-----------------------|--------------------------|
|
||||
| GET | `/api/v1/events` | Journal des événements |
|
||||
| POST | `/api/v1/events` | Push événement |
|
||||
|
||||
### Installation / Mise à jour
|
||||
|
||||
| Méthode | Endpoint | Description |
|
||||
|---------|-----------------------|--------------------------------|
|
||||
| GET | `/api/v1/install` | Commande d'installation |
|
||||
| GET | `/api/v1/update` | Commande de mise à jour |
|
||||
|
||||
## Documentation interactive
|
||||
|
||||
Swagger UI disponible sur : `http://<host>:8080/swagger-ui/`
|
||||
@@ -0,0 +1,41 @@
|
||||
# Architecture SentinelMesh
|
||||
|
||||
## Vue d'ensemble
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────┐
|
||||
│ Dashboards (Glance…) │
|
||||
│ widget-network-scan widget-agent-metrics │
|
||||
└──────────────────────┬──────────────────────────────────┘
|
||||
│ /api/v1/widgets/*
|
||||
┌──────────────────────▼──────────────────────────────────┐
|
||||
│ Backend central (Rust/Axum) │
|
||||
│ /api/v1/agents /api/v1/metrics /api/v1/network │
|
||||
│ SQLite (→ PostgreSQL futur) │
|
||||
└────────────┬────────────────────────┬───────────────────┘
|
||||
│ push JSON │ push JSON
|
||||
┌────────────▼────────┐ ┌──────────▼────────────────────┐
|
||||
│ agent-scan-network │ │ agent-metric │
|
||||
│ ICMP/ARP/MAC/DNS │ │ CPU/RAM/HDD/GPU/DMI/Events │
|
||||
│ Détection services │ │ Multi-fréquence │
|
||||
│ API JSON locale │ │ API JSON locale │
|
||||
└─────────────────────┘ └───────────────────────────────┘
|
||||
```
|
||||
|
||||
## Principes
|
||||
|
||||
- **Séparation stricte** : collecte → centralisation → affichage. Jamais de lien direct widget ↔ agent.
|
||||
- **API-first** : toute donnée accessible via `/api/v1/`.
|
||||
- **Agents autonomes** : fonctionnent sans le dashboard, exposent leur propre API locale.
|
||||
- **Faiblement couplé** : les widgets sont remplaçables par n'importe quel dashboard.
|
||||
|
||||
## Flux de données
|
||||
|
||||
1. Les agents scannent / collectent en local.
|
||||
2. Ils poussent les données vers le backend via HTTP JSON.
|
||||
3. Le backend stocke, agrège et expose via `/api/v1/`.
|
||||
4. Glance interroge les endpoints widgets (`/api/v1/widgets/*`) à la fréquence de cache configurée.
|
||||
|
||||
## Extensions futures
|
||||
|
||||
Les agents pourront publier directement vers : MQTT, Prometheus, InfluxDB, Home Assistant, Grafana, Node-RED.
|
||||
@@ -0,0 +1,59 @@
|
||||
# Installation SentinelMesh
|
||||
|
||||
## Prérequis
|
||||
|
||||
- Docker + Docker Compose (recommandé)
|
||||
- ou Rust >= 1.82 pour une compilation locale
|
||||
|
||||
## Docker Compose (recommandé)
|
||||
|
||||
```bash
|
||||
git clone https://git.maison43gil.com/gilles/SentinelMesh.git
|
||||
cd SentinelMesh
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
Le backend est accessible sur `http://localhost:8080`.
|
||||
|
||||
## Compilation locale
|
||||
|
||||
```bash
|
||||
# Backend
|
||||
cd backend && cargo build --release
|
||||
|
||||
# Agent découverte réseau
|
||||
cd agents/agent-scan-network && cargo build --release
|
||||
|
||||
# Agent métriques
|
||||
cd agents/agent-metric && cargo build --release
|
||||
```
|
||||
|
||||
## Installation des agents (Phase 5)
|
||||
|
||||
```bash
|
||||
curl -fsSL http://<backend>/install.sh | bash \
|
||||
--server http://<backend> \
|
||||
--token <token> \
|
||||
--agent-type scan-network
|
||||
|
||||
curl -fsSL http://<backend>/install.sh | bash \
|
||||
--server http://<backend> \
|
||||
--token <token> \
|
||||
--agent-type metric
|
||||
```
|
||||
|
||||
## Intégration Glance
|
||||
|
||||
Ajouter dans `glance.yml` :
|
||||
|
||||
```yaml
|
||||
- type: custom-api
|
||||
title: SentinelMesh — Réseau
|
||||
cache: 30s
|
||||
url: http://<backend>:8080/api/v1/widgets/network
|
||||
|
||||
- type: custom-api
|
||||
title: SentinelMesh — Métriques
|
||||
cache: 1s
|
||||
url: http://<backend>:8080/api/v1/widgets/metrics
|
||||
```
|
||||
Reference in New Issue
Block a user