diff --git a/src/de/p1st/monitor/loggers/cpu.py b/src/de/p1st/monitor/loggers/cpu.py index f6e9920..15c3c00 100644 --- a/src/de/p1st/monitor/loggers/cpu.py +++ b/src/de/p1st/monitor/loggers/cpu.py @@ -13,12 +13,15 @@ from de.p1st.monitor.warn_data import WarnData class CPULogger(Logger): + """ + CPU load average (base class). + """ + def __init__(self, warn_if_above: float = None, warn_threshold: int = 1, warn_data_range: int = 1, ): - critical_if_above = warn_if_above * 1.5 super().__init__(warn_threshold, warn_data_range, diff --git a/src/de/p1st/monitor/loggers/drive.py b/src/de/p1st/monitor/loggers/drive.py index 6f6b4f2..d0dd494 100644 --- a/src/de/p1st/monitor/loggers/drive.py +++ b/src/de/p1st/monitor/loggers/drive.py @@ -24,6 +24,10 @@ class IDException(Exception): class DriveLogger(Logger): + """ + Drive temperature. + """ + def __init__(self, uuid: str = None, id_: str = None, @@ -123,7 +127,8 @@ class DriveLogger(Logger): """ returncode, stdout, stderr = execute_capture(['blkid', '-s', 'UUID', '-o', 'value', f'{device}']) if returncode != 0: - raise BlkidException(f'blkid failed for device {device} with returncode {returncode}\nstdout: {stdout}\nstderr: {stderr}') + raise BlkidException( + f'blkid failed for device {device} with returncode {returncode}\nstdout: {stdout}\nstderr: {stderr}') uuid = stdout.strip() if len(uuid) == 0: @@ -135,7 +140,7 @@ class DriveLogger(Logger): @classmethod def get_temp_from_device(cls, device: Path) -> int: """ - Use `smartctl` to get HDD/SSD temperature. + Use `smartctl` to get HDD/SSD/NVMe temperature. As reading SMART data wakes up standby HDD drives, we skip them. diff --git a/src/de/p1st/monitor/loggers/drive_temp.py b/src/de/p1st/monitor/loggers/drive_temp.py index a0352c5..a49bbc9 100644 --- a/src/de/p1st/monitor/loggers/drive_temp.py +++ b/src/de/p1st/monitor/loggers/drive_temp.py @@ -13,6 +13,10 @@ from de.p1st.monitor.warn_data import WarnData class DriveTempLogger(Logger): + """ + Minimum and maximum temperature of multiple drives of the same type (e.g. HDDs or NVMes). + """ + def __init__(self, type_: Literal['drivetemp', 'nvme'], warn_if_above: int = None, diff --git a/src/de/p1st/monitor/loggers/filesystem.py b/src/de/p1st/monitor/loggers/filesystem.py index 9c84221..a51ea37 100644 --- a/src/de/p1st/monitor/loggers/filesystem.py +++ b/src/de/p1st/monitor/loggers/filesystem.py @@ -18,6 +18,10 @@ class NotMounted(Exception): class FilesystemLogger(Logger): + """ + Disk usage. + """ + def __init__(self, uuid: str = None, mountpoint: Path = None, unmounted_ok: bool = False, diff --git a/src/de/p1st/monitor/loggers/memory.py b/src/de/p1st/monitor/loggers/memory.py index c575ed8..5ce4534 100644 --- a/src/de/p1st/monitor/loggers/memory.py +++ b/src/de/p1st/monitor/loggers/memory.py @@ -10,6 +10,10 @@ from de.p1st.monitor.warn_data import WarnData class MemoryLogger(Logger): + """ + Used, cached and total memory. + """ + def __init__(self, warn_if_above: float = 1.0, warn_threshold: int = 1, @@ -28,7 +32,7 @@ class MemoryLogger(Logger): used_mb = data[1] total_available_mb = data[3] used = used_mb / total_available_mb - message = f'Memory usage ist at {used_mb} MB of {total_available_mb} MB ({round(used*100,2)}%)' + message = f'Memory usage ist at {used_mb} MB of {total_available_mb} MB ({round(used * 100, 2)}%)' return WarnData(data[0], used, message) def read_data(self) -> list[any]: diff --git a/src/de/p1st/monitor/loggers/network.py b/src/de/p1st/monitor/loggers/network.py index b6a16bb..58eb484 100644 --- a/src/de/p1st/monitor/loggers/network.py +++ b/src/de/p1st/monitor/loggers/network.py @@ -14,6 +14,10 @@ from de.p1st.monitor.warn import WarnLevel, WarnMessage class NetworkLogger(Logger): + """ + Network bytes sent and received. + """ + def __init__(self, network_interface: str): super().__init__() self.network_interface = network_interface diff --git a/src/de/p1st/monitor/loggers/sensor_script.py b/src/de/p1st/monitor/loggers/sensor_script.py index cded3a9..190efc1 100644 --- a/src/de/p1st/monitor/loggers/sensor_script.py +++ b/src/de/p1st/monitor/loggers/sensor_script.py @@ -10,6 +10,10 @@ from de.p1st.monitor.warn_data import WarnData class ScriptLogger(Logger): + """ + Single value returned by specified script. + """ + def __init__(self, command: list[str], sensor_name: str, warn_if_above: float = None, diff --git a/src/de/p1st/monitor/loggers/swap.py b/src/de/p1st/monitor/loggers/swap.py index 2c37993..1ff6fd6 100644 --- a/src/de/p1st/monitor/loggers/swap.py +++ b/src/de/p1st/monitor/loggers/swap.py @@ -11,6 +11,10 @@ from de.p1st.monitor.warn_data import WarnData class SwapLogger(Logger): + """ + Used and total swap. + """ + def __init__(self, warn_if_above: float = 1.0, warn_threshold: int = 1, diff --git a/src/de/p1st/monitor/loggers/temp.py b/src/de/p1st/monitor/loggers/temp.py index cfe4142..c2e5f0a 100644 --- a/src/de/p1st/monitor/loggers/temp.py +++ b/src/de/p1st/monitor/loggers/temp.py @@ -11,6 +11,10 @@ from de.p1st.monitor.warn_data import WarnData class TempLogger(Logger): + """ + Temperature of sensor. + """ + def __init__(self, sensor_name: str, sensor_label: str, warn_if_above: float = None,