diff --git a/checkzfs.py b/checkzfs.py index 976f58f..ac37bb7 100644 --- a/checkzfs.py +++ b/checkzfs.py @@ -61,6 +61,7 @@ import json import os.path import os import socket +from datetime import datetime from email.message import EmailMessage from email.mime.application import MIMEApplication from email.utils import formatdate @@ -660,17 +661,31 @@ class zfscheck(object): _header_names = [self.COLUMN_NAMES.get(i,i) for i in _header] _converter = dict((i,self.COLUMN_MAPPER.get(i,(lambda x: str(x)))) for i in _header) _hostname = socket.getfqdn() - _out = [] - _out.append("") - _out.append("") - _out.append("") - _out.append("ZFS") - _out.append(f"

{_hostname}

") - _out.append("") - _out.append("".format("".format("
{0}
".join(_header_names))) + + _out = "" + _out += "" + _out += "" + _out += "" + _out += "Check ZFS" + _out += f"

{_hostname}

{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}

" + _out += "" + _out += "".format("".format("
{0}
".join(_header_names)) + for _item in self._datasort(data): - _out.append("
{0}
".join([_converter.get(_col)(_item.get(_col,"")) for _col in _header]),_converter["status"](_item.get("status","0")))) - _out.append("
") + _out += "
{0}
".join([_converter.get(_col)(_item.get(_col,"")) for _col in _header]),_converter["status"](_item.get("status","0"))) + + _out += "
" return "".join(_out) def mail_output(self,data):