Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions fichier.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Bonjour
Monde
Empty file added mon-projet/config/fichier
Empty file.
22 changes: 22 additions & 0 deletions mon-projet/logs/app.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
2024-01-15 08:00:01 INFO Application started on port 8080
2024-01-15 08:00:05 INFO Connected to Azure SQL Database successfully
2024-01-15 08:01:22 WARNING High memory usage detected: 78%
2024-01-15 08:02:45 ERROR Failed to connect to Azure Storage: connection timeout
2024-01-15 08:03:10 INFO Request processed: GET /api/health [200]
2024-01-15 08:05:33 ERROR Authentication failed for service account: deploy_svc
2024-01-15 08:06:15 WARNING CPU usage spike detected: 92%
2024-01-15 08:07:42 ERROR Database query timeout after 30s on table: audit_logs
2024-01-15 08:08:00 INFO Retry attempt 1/3 for Azure Storage connection
2024-01-15 08:08:30 INFO Retry attempt 2/3 for Azure Storage connection
2024-01-15 08:09:00 ERROR Max retries exceeded - Azure Storage service unavailable
2024-01-15 08:10:15 WARNING Disk space below threshold: 15% remaining on /dev/sda1
2024-01-15 08:11:22 INFO Backup job started: daily-backup-2024-01-15
2024-01-15 08:12:45 ERROR Backup failed: insufficient permissions on /var/backup/azure
2024-01-15 08:14:03 INFO Alert sent to monitoring team via Azure Monitor
2024-01-15 08:15:00 INFO Scheduled maintenance check completed
2024-01-15 08:16:30 WARNING SSL certificate expires in 14 days for api.azuretech.fr
2024-01-15 08:18:00 CRITICAL Database connection pool exhausted — all 20 connections in use
2024-01-15 08:18:55 INFO Kubernetes pod restarted: api-deployment-7d9f8b-xkp2m
2024-01-15 08:19:30 CRITICAL Azure Key Vault unreachable — secrets cannot be retrieved
2024-01-15 08:20:00 INFO Health check passed: all 3 replicas running
2024-01-15 08:21:00 CRITICAL Disk full on /var/log — logging suspended
22 changes: 22 additions & 0 deletions mon-projet/logs/app.log.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
2024-01-15 08:00:01 INFO Application started on port 8080
2024-01-15 08:00:05 INFO Connected to Azure SQL Database successfully
2024-01-15 08:01:22 WARNING High memory usage detected: 78%
2024-01-15 08:02:45 ERROR Failed to connect to Azure Storage: connection timeout
2024-01-15 08:03:10 INFO Request processed: GET /api/health [200]
2024-01-15 08:05:33 ERROR Authentication failed for service account: deploy_svc
2024-01-15 08:06:15 WARNING CPU usage spike detected: 92%
2024-01-15 08:07:42 ERROR Database query timeout after 30s on table: audit_logs
2024-01-15 08:08:00 INFO Retry attempt 1/3 for Azure Storage connection
2024-01-15 08:08:30 INFO Retry attempt 2/3 for Azure Storage connection
2024-01-15 08:09:00 ERROR Max retries exceeded - Azure Storage service unavailable
2024-01-15 08:10:15 WARNING Disk space below threshold: 15% remaining on /dev/sda1
2024-01-15 08:11:22 INFO Backup job started: daily-backup-2024-01-15
2024-01-15 08:12:45 ERROR Backup failed: insufficient permissions on /var/backup/azure
2024-01-15 08:14:03 INFO Alert sent to monitoring team via Azure Monitor
2024-01-15 08:15:00 INFO Scheduled maintenance check completed
2024-01-15 08:16:30 WARNING SSL certificate expires in 14 days for api.azuretech.fr
2024-01-15 08:18:00 CRITICAL Database connection pool exhausted — all 20 connections in use
2024-01-15 08:18:55 INFO Kubernetes pod restarted: api-deployment-7d9f8b-xkp2m
2024-01-15 08:19:30 CRITICAL Azure Key Vault unreachable — secrets cannot be retrieved
2024-01-15 08:20:00 INFO Health check passed: all 3 replicas running
2024-01-15 08:21:00 CRITICAL Disk full on /var/log — logging suspended
Empty file added mon-projet/logs/fichier
Empty file.
16 changes: 16 additions & 0 deletions mon-projet/logs/rapport-20260528-145908.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
RAPPORT D'ANALYSE — 28/05/2026 14:59

--- Compteurs ---
INFO=10 WARNING=4 ERROR=5 CRITICAL=3

--- Incidents critiques ---
2024-01-15 08:18:00 CRITICAL Database connection pool exhausted — all 20 connections in use
2024-01-15 08:19:30 CRITICAL Azure Key Vault unreachable — secrets cannot be retrieved
2024-01-15 08:21:00 CRITICAL Disk full on /var/log — logging suspended

--- Erreurs ---
2024-01-15 08:02:45 ERROR Failed to connect to Azure Storage: connection timeout
2024-01-15 08:05:33 ERROR Authentication failed for service account: deploy_svc
2024-01-15 08:07:42 ERROR Database query timeout after 30s on table: audit_logs
2024-01-15 08:09:00 ERROR Max retries exceeded - Azure Storage service unavailable
2024-01-15 08:12:45 ERROR Backup failed: insufficient permissions on /var/backup/azure
Empty file added mon-projet/readme.txt
Empty file.
14 changes: 14 additions & 0 deletions mon-projet/src/analyse-niveaux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
# analyse-niveaux.sh — Compte chaque niveau de log

LOG_FILE="ressources/server.log"

echo "=== Analyse par niveau ==="

for NIVEAU in INFO WARNING ERROR CRITICAL; do
NB=$(grep -c "$NIVEAU" "$LOG_FILE")
echo " $NIVEAU : $NB occurrence(s)"
done

echo "=========================="
echo " TOTAL : $(wc -l < "$LOG_FILE") lignes"
24 changes: 24 additions & 0 deletions mon-projet/src/check-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
set -e

VERT="\033[0;32m"
JAUNE="\033[0;33m"
ROUGE="\033[0;31m"
RESET="\033[0m"

ok() { echo -e "${VERT}[OK]${RESET} $1"; }
warn() { echo -e "${JAUNE}[WARN]${RESET} $1"; }
err() { echo -e "${ROUGE}[ERR]${RESET} $1"; }

verifier_commande() {
local cmd="$1"
local name="${2:-$1}"

if command -v "$cmd" &>/dev/null; then
ok "$name présent"
else
err "$name absent"
fi
}

echo "=== CHECK ENV ==="
30 changes: 30 additions & 0 deletions mon-projet/src/check-logs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
# check-logs.sh — Vérifie l'état des logs et alerte si nécessaire

LOG_FILE="ressources/server.log"
SEUIL_ERREURS=3

if [ ! -f "$LOG_FILE" ]; then
echo "ERREUR : le fichier $LOG_FILE n'existe pas."
exit 1
fi

NB_ERREURS=$(grep -c "ERROR" "$LOG_FILE")
NB_CRITIQUES=$(grep -c "CRITICAL" "$LOG_FILE")
NB_WARNINGS=$(grep -c "WARNING" "$LOG_FILE")

echo "=== Analyse de $LOG_FILE ==="
echo " INFO : $(grep -c "INFO" "$LOG_FILE")"
echo " WARNING : $NB_WARNINGS"
echo " ERROR : $NB_ERREURS"
echo " CRITICAL : $NB_CRITIQUES"
echo "==========================="

# Vérifier le seuil d'erreurs
if [ "$NB_CRITIQUES" -gt 0 ]; then
echo "ALERTE CRITIQUE : $NB_CRITIQUES incident(s) critique(s) détecté(s) !"
elif [ "$NB_ERREURS" -gt "$SEUIL_ERREURS" ]; then
echo "ATTENTION : $NB_ERREURS erreurs détectées (seuil : $SEUIL_ERREURS)"
else
echo "OK : les logs sont dans les normes."
fi
12 changes: 12 additions & 0 deletions mon-projet/src/couleurs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

VERT="\033[0;32m"
ROUGE="\033[0;31m"
JAUNE="\033[0;33m"
CYAN="\033[0;36m"
RESET="\033[0m"

ok() { echo -e "${VERT}[OK]${RESET} $1"; }
info() { echo -e "${CYAN}[INFO]${RESET} $1"; }
warn() { echo -e "${JAUNE}[WARN]${RESET} $1"; }
err() { echo -e "${ROUGE}[ERR]${RESET} $1"; }
Empty file added mon-projet/src/fichier
Empty file.
21 changes: 21 additions & 0 deletions mon-projet/src/info.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# info.sh — Affiche des informations sur l'environnement

NOM_PROJET="NexaCloud"
VERSION="1.1.0"
LOG_FILE="ressources/server.log"

echo "==============================="
echo " Projet : $NOM_PROJET"
echo " Version : $VERSION"
echo "==============================="

# Vérifier que le fichier de log existe
if [ -f "$LOG_FILE" ]; then
NB_LIGNES=$(wc -l < "$LOG_FILE")
echo " Log : $LOG_FILE ($NB_LIGNES lignes)"
else
echo " Log : fichier introuvable !"
fi

echo "==============================="
64 changes: 64 additions & 0 deletions mon-projet/src/rapport.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash
# rapport.sh — Génère un rapport complet avec des fonctions

LOG_FILE="${1:-ressources/server.log}"
RAPPORT="logs/rapport-$(date +%Y%m%d-%H%M%S).txt"

# ── Fonctions ─────────────────────────────────────

afficher_titre() {
echo "==========================================="
echo " $1"
echo "==========================================="
}

compter_niveau() {
local niveau="$1"
local fichier="$2"

grep -c "$niveau" "$fichier" 2>/dev/null || echo 0
}

ecrire_section() {
local titre="$1"
local contenu="$2"
{
echo ""
echo "--- $titre ---"
echo "$contenu"
}>> "$RAPPORT"
}

# ── Script principal ──────────────────────────────

if [ ! -f "$LOG_FILE" ]; then
echo "Fichier introuvable : $LOG_FILE"
exit 1
fi

afficher_titre "RAPPORT D'ANALYSE — $(date '+%d/%m/%Y %H:%M')"

INFO=$(compter_niveau "INFO" "$LOG_FILE")
WARNING=$(compter_niveau "WARNING" "$LOG_FILE")
ERROR=$(compter_niveau "ERROR" "$LOG_FILE")
CRITICAL=$(compter_niveau "CRITICAL" "$LOG_FILE")

echo "INFO : $INFO"
echo "WARNING : $WARNING"
echo "ERROR : $ERROR"
echo "CRITICAL : $CRITICAL"

# Création du rapport
echo "RAPPORT D'ANALYSE — $(date '+%d/%m/%Y %H:%M')" > "$RAPPORT"

ecrire_section "Compteurs" \
"INFO=$INFO WARNING=$WARNING ERROR=$ERROR CRITICAL=$CRITICAL"

ecrire_section "Incidents critiques" \
"$(grep 'CRITICAL' "$LOG_FILE")"

ecrire_section "Erreurs" \
"$(grep 'ERROR' "$LOG_FILE")"

echo ""
echo "Rapport sauvegardé : $RAPPORT"
5 changes: 5 additions & 0 deletions ressources/erreurs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
2024-01-15 08:02:45 ERROR Failed to connect to Azure Storage: connection timeout
2024-01-15 08:05:33 ERROR Authentication failed for service account: deploy_svc
2024-01-15 08:07:42 ERROR Database query timeout after 30s on table: audit_logs
2024-01-15 08:09:00 ERROR Max retries exceeded - Azure Storage service unavailable
2024-01-15 08:12:45 ERROR Backup failed: insufficient permissions on /var/backup/azure
12 changes: 12 additions & 0 deletions ressources/rapport.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
=== RAPPORT DE LOGS ===
Nombre total de lignes :
Nombre d'erreurs :
Nombre de warnings :
Nombre de critiques :
Nombre total de lignes :
Nombre total de lignes : 22
Nombre d'erreurs : 5
Nombre d'erreurs : 5
Nombre d'erreurs : 5
Nombre de warnings : 4
Nombre de critiques : 3
77 changes: 77 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/bash
# setup.sh — Prépare le projet NexaCloud en une commande

set -e

VERT="\033[0;32m"
ROUGE="\033[0;31m"
JAUNE="\033[0;33m"
CYAN="\033[0;36m"
BOLD="\033[1m"
RESET="\033[0m"

info() { echo -e "${CYAN}[INFO]${RESET} $1"; }
ok() { echo -e "${VERT}[OK]${RESET} $1"; }
warn() { echo -e "${JAUNE}[WARN]${RESET} $1"; }
err() { echo -e "${ROUGE}[ERR]${RESET} $1"; exit 1; }

echo ""
echo -e "${BOLD}${CYAN}============================================${RESET}"
echo -e "${BOLD}${CYAN} SETUP NEXACLOUD — $(date '+%d/%m/%Y %H:%M')${RESET}"
echo -e "${BOLD}${CYAN}============================================${RESET}"
echo ""

info "Vérification des prérequis..."

command -v python3 >/dev/null || err "Python3 non trouvé"
command -v node >/dev/null || err "Node.js non trouvé"
command -v npm >/dev/null || err "npm non trouvé"

ok "Prérequis : Python3, Node.js, npm présents"

info "Installation des dépendances Python..."

if [ -f "tp-collaboratif-git-dev-starter/python-api/requirements.txt" ]; then
pip install -r tp-collaboratif-git-dev-starter/python-api/requirements.txt --quiet
ok "Dépendances Python installées"
else
warn "Fichier python-api/requirements.txt absent"
fi

info "Installation des dépendances Node..."

if [ -f "tp-collaboratif-git-dev-starter/node-client/package.json" ]; then
cd tp-collaboratif-git-dev-starter/node-client && npm install --silent && cd ../..
ok "Dépendances Node installées"
else
warn "Fichier node-client/package.json absent"
fi

info "Analyse des logs..."

LOG="ressources/server.log"


if [ -f "$LOG" ]; then
NB_ERR=$(grep -c "ERROR" "$LOG" || true)
NB_CRIT=$(grep -c "CRITICAL" "$LOG" || true)

ok "Logs analysés : $NB_ERR erreur(s), $NB_CRIT critique(s)"
if [ "$NB_CRIT" -gt 0 ]; then
echo -e "${ROUGE}Incidents critiques détectés${RESET}"
grep "CRITICAL" "$LOG" | while read -r ligne; do
echo -e "${ROUGE} - $ligne${RESET}"
done
fi
else
warn "Fichier de logs absent : $LOG"
fi

echo ""
echo -e "${BOLD}${VERT}============================================${RESET}"
echo -e "${BOLD}${VERT} SETUP TERMINÉ AVEC SUCCÈS ${RESET}"
echo -e "${BOLD}${VERT}============================================${RESET}"
echo ""
echo " Lancer l'API Python : cd python-api && python3 app.py"
echo " Lancer le client Node: cd node-client && node app.js"
echo ""
Loading