From 972fdd761a44329e966124dfee0aa40c11dcf375 Mon Sep 17 00:00:00 2001 From: Marius Date: Tue, 16 Dec 2025 11:54:28 +0000 Subject: [PATCH] more clean --- bash_scripts/system_health.sh | 105 ++++++++++++++++++++++++++++++++++ contact.html | 1 - file_2test.txt | 1 - 3 files changed, 105 insertions(+), 2 deletions(-) create mode 100755 bash_scripts/system_health.sh delete mode 100644 contact.html delete mode 100644 file_2test.txt diff --git a/bash_scripts/system_health.sh b/bash_scripts/system_health.sh new file mode 100755 index 0000000..c2b24a3 --- /dev/null +++ b/bash_scripts/system_health.sh @@ -0,0 +1,105 @@ +#!/bin/bash + +##################################################### +# System Health Monitor +# Author: [Numele Tău] +# Description: Verifică starea sistemului și generează raport +##################################################### + +# Culori pentru output fancy +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +# Header fancy +clear +echo -e "${BLUE}╔════════════════════════════════════════╗${NC}" +echo -e "${BLUE}║ SYSTEM HEALTH MONITOR v1.0 ║${NC}" +echo -e "${BLUE}╚════════════════════════════════════════╝${NC}" +echo "" +echo -e "${GREEN}📊 Generez raportul...${NC}" +echo "" + +# 1. Informații sistem +echo -e "${YELLOW}━━━ 💻 INFORMAȚII SISTEM ━━━${NC}" +echo -e "Hostname: ${GREEN}$(hostname)${NC}" +echo -e "Utilizator: ${GREEN}$(whoami)${NC}" +echo -e "Data: ${GREEN}$(date '+%Y-%m-%d %H:%M:%S')${NC}" +echo -e "Uptime: ${GREEN}$(uptime -p)${NC}" +echo "" + +# 2. CPU Usage +echo -e "${YELLOW}━━━ ⚙️ CPU USAGE ━━━${NC}" +cpu_usage=$(top -bn1 | grep "Cpu(s)" | awk '{print $2}' | cut -d'%' -f1) +echo -e "Utilizare CPU: ${GREEN}${cpu_usage}%${NC}" + +if (( $(echo "$cpu_usage > 80" | bc -l) )); then + echo -e "${RED}⚠️ ATENȚIE: CPU usage ridicat!${NC}" +else + echo -e "${GREEN}✓ CPU în parametri normali${NC}" +fi +echo "" + +# 3. Memorie +echo -e "${YELLOW}━━━ 🧠 MEMORIE ━━━${NC}" +mem_total=$(free -h | awk '/^Mem:/ {print $2}') +mem_used=$(free -h | awk '/^Mem:/ {print $3}') +mem_percent=$(free | awk '/^Mem:/ {printf "%.0f", $3/$2 * 100}') + +echo -e "Total: ${GREEN}${mem_total}${NC}" +echo -e "Folosită: ${GREEN}${mem_used}${NC} (${mem_percent}%)" + +if [ "$mem_percent" -gt 80 ]; then + echo -e "${RED}⚠️ ATENȚIE: Memorie insuficientă!${NC}" +else + echo -e "${GREEN}✓ Memorie OK${NC}" +fi +echo "" + +# 4. Disc +echo -e "${YELLOW}━━━ 💾 SPAȚIU DISC ━━━${NC}" +df -h | grep -E '^/dev/' | while read line; do + usage=$(echo $line | awk '{print $5}' | cut -d'%' -f1) + mount=$(echo $line | awk '{print $6}') + + if [ "$usage" -gt 80 ]; then + echo -e "${RED}⚠️ $mount: ${usage}% (PLIN!)${NC}" + else + echo -e "${GREEN}✓ $mount: ${usage}%${NC}" + fi +done +echo "" + +# 5. Top 5 procese (CPU) +echo -e "${YELLOW}━━━ 🔥 TOP 5 PROCESE (CPU) ━━━${NC}" +ps aux --sort=-%cpu | head -6 | tail -5 | awk '{printf "%-20s %5s%%\n", $11, $3}' +echo "" + +# 6. Verificare servicii importante (opțional) +echo -e "${YELLOW}━━━ 🔧 STATUS SERVICII ━━━${NC}" + +# Exemplu: verifică serviciul SSH +if systemctl is-active --quiet sshd 2>/dev/null || systemctl is-active --quiet ssh 2>/dev/null; then + echo -e "${GREEN}✓ SSH: Running${NC}" +else + echo -e "${RED}✗ SSH: Stopped${NC}" +fi + +# Footer +echo "" +echo -e "${BLUE}╔════════════════════════════════════════╗${NC}" +echo -e "${BLUE}║ Raport generat cu succes! ✓ ║${NC}" +echo -e "${BLUE}╚════════════════════════════════════════╝${NC}" +echo "" + +# Opțiune salvare raport +read -p "Salvezi raportul în fișier? (y/n): " save_choice +if [ "$save_choice" = "y" ] || [ "$save_choice" = "Y" ]; then + report_file="system_health_$(date +%Y%m%d_%H%M%S).txt" + $0 2>&1 | grep -v "Salvezi raportul" > "$report_file" + echo -e "${GREEN}✓ Raport salvat: $report_file${NC}" +fi + +exit 0 diff --git a/contact.html b/contact.html deleted file mode 100644 index 7daf27c..0000000 --- a/contact.html +++ /dev/null @@ -1 +0,0 @@ -Formular contact diff --git a/file_2test.txt b/file_2test.txt deleted file mode 100644 index a59da7d..0000000 --- a/file_2test.txt +++ /dev/null @@ -1 +0,0 @@ -Fisier 2 test