نظارت بر پهنای باند شبکه

اسکریپتی که ترافیک شبکه را به صورت بلادرنگ نظارت می‌کند و استفاده از پهنای باند را گزارش می‌دهد.

منتشر شده: 2024/03/25

کد

#!/bin/bash

# Network Bandwidth Monitor

INTERFACE="${1:-eth0}"
INTERVAL=1

if ! command -v ifstat &> /dev/null; then
    echo "Installing ifstat..."
    apt-get update && apt-get install -y ifstat
fi

echo "Monitoring $INTERFACE (Press Ctrl+C to stop)"
echo "==========================================="
echo ""

ifstat -i "$INTERFACE" -b $INTERVAL

نحوه استفاده

chmod +x bandwidth_monitor.sh
# Default interface (eth0)
./bandwidth_monitor.sh

# Specific interface
./bandwidth_monitor.sh wlan0

برچسب‌ها

network monitoring bandwidth traffic ifstat