diff --git a/sysalert/email.py b/sysalert/email.py index 5d6fd80..ec22478 100644 --- a/sysalert/email.py +++ b/sysalert/email.py @@ -1,20 +1,9 @@ import email import smtplib import socket -import subprocess import systemd.journal -def _get_status(name): - cmd = ['/usr/bin/systemctl', 'status', name] - - proc = subprocess.Popen( - cmd, - stdout=subprocess.PIPE) - out, err = proc.communicate() - out = out.decode('utf-8') - return out - def _send_email(subject, message, config): mail = email.message.EmailMessage() hostname = socket.getfqdn() @@ -44,9 +33,6 @@ def success(name, failures, config): subject=f'{hostname} - {name}: recovery' message=f""" {name} has recovered after {nr_failures} failures. -Current status: - -{cur_status} """ _send_email(subject, message, config) @@ -72,11 +58,6 @@ def failure(name, failures, config): subject=f"{hostname} - {name}: failure" message=f""" New failure for {name}. -Current status: - -{cur_status} - - Latest journal log: {journal_txt} @@ -85,11 +66,6 @@ Latest journal log: subject=f"{hostname} - {name}: {nr_failures} failures" message=f""" {nr_failures} failures for {name} ({prev_failures} since last notification). -Current status: - -{cur_status} - - Latest journal log: {journal_txt}