feat: portage complet en Rust (axum + sysinfo + tera)
Remplacement du backend Python/Flask par un binaire Rust natif. Stack : axum (web), sysinfo (metriques), lettre (SMTP), tera (templates), argon2 (auth). Binaire Windows 6.3 Mo sans dependance runtime. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Supervision - Alertes{% endblock %}
|
||||
{% block title %}Supervision - Alertes{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h4 class="mb-0"><i class="bi bi-bell"></i> Historique des alertes</h4>
|
||||
{% if alerts %}
|
||||
<form method="POST" action="{{ url_for('clear_alerts') }}">
|
||||
<form method="POST" action="/alerts/clear">
|
||||
<button type="submit" class="btn btn-sm btn-outline-danger"
|
||||
onclick="return confirm('Effacer tout l\'historique ?')">
|
||||
<i class="bi bi-trash"></i> Effacer l'historique
|
||||
@@ -35,10 +35,10 @@
|
||||
{% for alert in alerts %}
|
||||
<tr>
|
||||
<td class="text-nowrap">
|
||||
<small>{{ alert.timestamp[:19] | replace('T', ' ') }}</small>
|
||||
<small>{{ alert.timestamp | truncate(length=19, end="") | replace(from="T", to=" ") }}</small>
|
||||
</td>
|
||||
<td>
|
||||
{% if alert.type == 'process_down' %}
|
||||
{% if alert.type == "process_down" %}
|
||||
<span class="badge bg-danger">Processus</span>
|
||||
{% else %}
|
||||
<span class="badge bg-warning text-dark">Seuil</span>
|
||||
@@ -57,4 +57,4 @@
|
||||
{{ alerts | length }} alerte(s) — les 500 dernieres sont conservees.
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endblock content %}
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% block title %}Supervision{% endblock %}</title>
|
||||
<title>{% block title %}Supervision{% endblock title %}</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet">
|
||||
<link href="{{ url_for('static', filename='style.css') }}" rel="stylesheet">
|
||||
<link href="/static/style.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
{% if current_user.is_authenticated %}
|
||||
{% if authenticated %}
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="{{ url_for('dashboard') }}">
|
||||
<a class="navbar-brand" href="/">
|
||||
<i class="bi bi-activity"></i> Supervision
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
||||
@@ -21,27 +21,27 @@
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav me-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if request.endpoint == 'dashboard' %}active{% endif %}"
|
||||
href="{{ url_for('dashboard') }}">
|
||||
<a class="nav-link {% if active_page == "dashboard" %}active{% endif %}"
|
||||
href="/">
|
||||
<i class="bi bi-speedometer2"></i> Tableau de bord
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if request.endpoint == 'settings' %}active{% endif %}"
|
||||
href="{{ url_for('settings') }}">
|
||||
<a class="nav-link {% if active_page == "settings" %}active{% endif %}"
|
||||
href="/settings">
|
||||
<i class="bi bi-gear"></i> Configuration
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if request.endpoint == 'alerts' %}active{% endif %}"
|
||||
href="{{ url_for('alerts') }}">
|
||||
<a class="nav-link {% if active_page == "alerts" %}active{% endif %}"
|
||||
href="/alerts">
|
||||
<i class="bi bi-bell"></i> Alertes
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ url_for('logout') }}">
|
||||
<a class="nav-link" href="/logout">
|
||||
<i class="bi bi-box-arrow-right"></i> Deconnexion
|
||||
</a>
|
||||
</li>
|
||||
@@ -52,29 +52,27 @@
|
||||
{% endif %}
|
||||
|
||||
<div class="container-fluid mt-3">
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
{% for category, message in messages %}
|
||||
<div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
|
||||
{{ message }}
|
||||
{% if flash_messages %}
|
||||
{% for msg in flash_messages %}
|
||||
<div class="alert alert-{{ msg.category }} alert-dismissible fade show" role="alert">
|
||||
{{ msg.message }}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
{% if default_pw is defined and default_pw %}
|
||||
{% if default_pw %}
|
||||
<div class="alert alert-danger">
|
||||
<i class="bi bi-exclamation-triangle"></i>
|
||||
<strong>Securite :</strong> Le mot de passe par defaut est encore actif.
|
||||
<a href="{{ url_for('settings') }}#password" class="alert-link">Changez-le maintenant</a>.
|
||||
<a href="/settings#password" class="alert-link">Changez-le maintenant</a>.
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% block content %}{% endblock %}
|
||||
{% block content %}{% endblock content %}
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
{% block scripts %}{% endblock %}
|
||||
{% block scripts %}{% endblock scripts %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Supervision - Tableau de bord{% endblock %}
|
||||
{% block title %}Supervision - Tableau de bord{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
@@ -11,7 +11,7 @@
|
||||
</h4>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<span id="last-update" class="text-muted small"></span>
|
||||
<form method="POST" action="{{ url_for('toggle_monitoring') }}" class="d-inline">
|
||||
<form method="POST" action="/api/monitoring/toggle" class="d-inline">
|
||||
{% if metrics and metrics.monitoring_active %}
|
||||
<button type="submit" class="btn btn-sm btn-outline-warning">
|
||||
<i class="bi bi-pause-circle"></i> Pause
|
||||
@@ -86,7 +86,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Placeholder pour les disques - sera rempli par JS aussi -->
|
||||
<!-- Disques -->
|
||||
{% for disk in metrics.disks %}
|
||||
<div class="col-md-4 mb-3">
|
||||
<div class="card metric-card" id="card-disk-{{ loop.index0 }}">
|
||||
@@ -154,7 +154,7 @@
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ proc.total_cpu_percent }}%</td>
|
||||
<td><small>{{ proc.pids | join(', ') }}</small></td>
|
||||
<td><small>{{ proc.pids | join(sep=", ") }}</small></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
@@ -170,7 +170,7 @@
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between">
|
||||
<h6 class="mb-0"><i class="bi bi-bell"></i> Alertes recentes</h6>
|
||||
<a href="{{ url_for('alerts') }}" class="btn btn-sm btn-outline-primary">Voir tout</a>
|
||||
<a href="/alerts" class="btn btn-sm btn-outline-primary">Voir tout</a>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<table class="table table-sm mb-0" id="recent-alerts">
|
||||
@@ -187,7 +187,7 @@
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% endblock content %}
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
@@ -237,16 +237,7 @@ function refreshMetrics() {
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
function loadRecentAlerts() {
|
||||
fetch('/api/metrics')
|
||||
.then(r => r.json())
|
||||
.then(() => {
|
||||
// Charger les alertes separement via la page
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
// Rafraichir toutes les 30 secondes
|
||||
setInterval(refreshMetrics, 30000);
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% endblock scripts %}
|
||||
|
||||
@@ -23,20 +23,18 @@
|
||||
<small class="text-secondary">Monitoring systeme</small>
|
||||
</div>
|
||||
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
{% for category, message in messages %}
|
||||
<div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
|
||||
{{ message }}
|
||||
{% if flash_messages %}
|
||||
{% for msg in flash_messages %}
|
||||
<div class="alert alert-{{ msg.category }} alert-dismissible fade show" role="alert">
|
||||
{{ msg.message }}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<div class="card shadow">
|
||||
<div class="card-body p-4">
|
||||
<form method="POST" action="{{ url_for('login') }}">
|
||||
<form method="POST" action="/login">
|
||||
<div class="mb-3">
|
||||
<label for="username" class="form-label">Identifiant</label>
|
||||
<div class="input-group">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Supervision - Configuration{% endblock %}
|
||||
{% block title %}Supervision - Configuration{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<h4 class="mb-3"><i class="bi bi-gear"></i> Configuration</h4>
|
||||
@@ -10,7 +10,7 @@
|
||||
<div class="card">
|
||||
<div class="card-header"><h6 class="mb-0"><i class="bi bi-sliders"></i> Seuils d'alerte (%)</h6></div>
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ url_for('update_thresholds') }}">
|
||||
<form method="POST" action="/settings/thresholds">
|
||||
<div class="mb-3">
|
||||
<label for="cpu_percent" class="form-label">CPU (%)</label>
|
||||
<input type="number" class="form-control" id="cpu_percent" name="cpu_percent"
|
||||
@@ -39,7 +39,7 @@
|
||||
<div class="card">
|
||||
<div class="card-header"><h6 class="mb-0"><i class="bi bi-clock"></i> Frequence et alertes</h6></div>
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ url_for('update_monitoring') }}">
|
||||
<form method="POST" action="/settings/monitoring">
|
||||
<div class="mb-3">
|
||||
<label for="check_interval_minutes" class="form-label">Intervalle de verification (minutes)</label>
|
||||
<input type="number" class="form-control" id="check_interval_minutes"
|
||||
@@ -64,7 +64,7 @@
|
||||
<div class="card mt-4">
|
||||
<div class="card-header"><h6 class="mb-0"><i class="bi bi-diagram-3"></i> Port de l'application</h6></div>
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ url_for('update_port') }}">
|
||||
<form method="POST" action="/settings/port">
|
||||
<div class="mb-3">
|
||||
<label for="port" class="form-label">Port (redemarrage requis)</label>
|
||||
<input type="number" class="form-control" id="port" name="port"
|
||||
@@ -85,7 +85,7 @@
|
||||
<div class="card">
|
||||
<div class="card-header"><h6 class="mb-0"><i class="bi bi-envelope"></i> Configuration SMTP</h6></div>
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ url_for('update_smtp') }}">
|
||||
<form method="POST" action="/settings/smtp">
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="smtp_server" class="form-label">Serveur SMTP</label>
|
||||
@@ -128,7 +128,7 @@
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="smtp_to" class="form-label">Destinataires (separes par des virgules)</label>
|
||||
<input type="text" class="form-control" id="smtp_to" name="smtp_to"
|
||||
value="{{ smtp.to_emails | join(', ') }}"
|
||||
value="{{ smtp.to_emails | join(sep=", ") }}"
|
||||
placeholder="admin@example.com, tech@example.com">
|
||||
</div>
|
||||
</div>
|
||||
@@ -139,7 +139,7 @@
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
<form method="POST" action="{{ url_for('test_smtp') }}" class="d-inline">
|
||||
<form method="POST" action="/settings/smtp/test" class="d-inline">
|
||||
<button type="submit" class="btn btn-outline-info">
|
||||
<i class="bi bi-send"></i> Envoyer un email de test
|
||||
</button>
|
||||
@@ -157,7 +157,7 @@
|
||||
<h6 class="mb-0"><i class="bi bi-list-task"></i> Processus surveilles</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ url_for('update_processes') }}" id="process-form">
|
||||
<form method="POST" action="/settings/processes" id="process-form">
|
||||
<table class="table" id="proc-table">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -231,7 +231,7 @@
|
||||
<h6 class="mb-0"><i class="bi bi-shield-lock"></i> Mot de passe administrateur</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form method="POST" action="{{ url_for('update_password') }}">
|
||||
<form method="POST" action="/settings/password">
|
||||
<div class="mb-3">
|
||||
<label for="current_password" class="form-label">Mot de passe actuel</label>
|
||||
<input type="password" class="form-control" id="current_password"
|
||||
@@ -257,7 +257,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
{% endblock content %}
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
@@ -285,4 +285,4 @@ document.addEventListener('click', function(e) {
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% endblock scripts %}
|
||||
|
||||
Reference in New Issue
Block a user