tools.rdr-it.comScriptsInventaire système Linux

🖥 Inventaire système Linux

CPU, RAM, disques, OS, kernel, interfaces réseau

bashScript

Inventaire système Linux

Génère un rapport complet du système : matériel, OS, réseau, stockage, services critiques.

Script

#!/usr/bin/env bash

inventaire-systeme.sh — Rapport inventaire système complet

Usage : bash inventaire-systeme.sh [--json]

JSON=false; [[ "${1:-}" == "--json" ]] && JSON=true

SEP="────────────────────────────────────────────────────────────────"

header() { echo -e "\n${SEP}\n $1\n${SEP}"; }

header "INFORMATIONS SYSTÈME — $(hostname) — $(date '+%Y-%m-%d %H:%M:%S')"

OS & Kernel

header "OS & KERNEL" echo "Hostname : $(hostname -f 2>/dev/null || hostname)" echo "OS : $(. /etc/os-release 2>/dev/null && echo "$PRETTY_NAME")" echo "Kernel : $(uname -r)" echo "Architecture: $(uname -m)" echo "Uptime : $(uptime -p 2>/dev/null || uptime)" echo "Boot time : $(who -b 2>/dev/null | awk '{print $3,$4}')"

CPU

header "PROCESSEUR" cpu_model=$(grep -m1 "model name" /proc/cpuinfo | cut -d: -f2 | xargs) cpu_cores=$(nproc --all 2>/dev/null || grep -c "processor" /proc/cpuinfo) cpu_threads=$(grep -c "processor" /proc/cpuinfo) cpu_load=$(uptime | awk -F'load average:' '{print $2}' | xargs) echo "Modèle : $cpu_model" echo "Cœurs phys. : $cpu_cores" echo "Threads : $cpu_threads" echo "Charge (1/5/15m): $cpu_load"

RAM

header "MÉMOIRE RAM" free -h | awk 'NR<=2{printf "%-12s: %s\n", $1, $0}' | column -t echo "" echo "Swap : $(free -h | awk '/Swap/{print $2 " total, " $3 " utilisé"}')"

Disques

header "STOCKAGE" df -hT | grep -v tmpfs | grep -v devtmpfs | grep -v squashfs echo "" echo "Disques physiques :" lsblk -d -o NAME,SIZE,TYPE,MODEL 2>/dev/null | grep -v loop || fdisk -l 2>/dev/null | grep "^Disk /dev/"

Réseau

header "RÉSEAU" ip -br addr show 2>/dev/null | grep -v "^lo" || ifconfig 2>/dev/null | grep -E "^[a-z]|inet " echo "" echo "Passerelle : $(ip route show default 2>/dev/null | awk '{print $3}' | head -1)" echo "DNS : $(grep "nameserver" /etc/resolv.conf 2>/dev/null | awk '{print $2}' | tr '\n' ' ')"

Services critiques

header "SERVICES CRITIQUES" SERVICES=(ssh sshd nginx apache2 httpd docker containerd mysql mariadb postgresql fail2ban ufw firewalld) for svc in "${SERVICES[@]}"; do if systemctl is-enabled "$svc" 2>/dev/null | grep -qE "enabled|static"; then status=$(systemctl is-active "$svc" 2>/dev/null) printf " %-20s : %s\n" "$svc" "$status" fi done

Paquets installés

header "PAQUETS" if command -v dpkg &>/dev/null; then echo "Total paquets Debian/Ubuntu : $(dpkg -l | grep -c "^ii")" elif command -v rpm &>/dev/null; then echo "Total paquets RPM : $(rpm -qa | wc -l)" fi

echo -e "\n${SEP}"

echo " Rapport généré le $(date '+%Y-%m-%d à %H:%M:%S')" echo "${SEP}"

Utilisation

# Rapport texte standard
bash inventaire-systeme.sh

Sauvegarder

bash inventaire-systeme.sh > inventaire-$(hostname)-$(date +%Y%m%d).txt
🔧 Ouvrir tools.rdr-it.com — application complète →

Plus de 40 outils AdminSys gratuits · SSL · DNS · Docker · Nginx · SSH · Mermaid · et plus