mirror of
https://codeberg.org/privacy1st/de-p1st-monitor
synced 2024-11-21 19:33:18 +01:00
docs
This commit is contained in:
parent
681a946223
commit
e8e3e72a63
@ -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,
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user