Generate alerts when unusual network traffic is detected.
import psutil
threshold = 1000000 # bytes
net = psutil.net_io_counters()
if net.bytes_recv > threshold:
print("⚠️ Alert: High incoming traffic detected")
if net.bytes_sent > threshold:
print("⚠️ Alert: High outgoing traffic detected")
Alerts help you act fast to potential issues or attacks.
Next Lesson →