import psutil
import smtplib
from email.mime.text import MIMEText
def check_disk_usage(threshold, mail):
usage = psutil.disk_usage("/")
free = usage.free / (1024.0 ** 3)
if free < threshold:
msg = MIMEText("Attention, l'espace disque restant est de {} Go, qui est en dessous...