enter code here
def send_email(hostname, target_directory, source_size, target_space):
“””Send an email notification if there is insufficient space.”””
subject = f”Insufficient space alert on {hostname}”
body = (f”Host: {hostname}n”
f”Target Directory: {target_directory}n”
f”Required Space: {source_size} bytesn”
f”Available Space: {target_space} bytesn”
“Please take necessary action to free up space.”)
command = f’echo “{body}” | mailx -s “{subject}” [email protected]’
run_command(command)
Sarvesh Kuthe is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.