pi_dashboard.system_metrics_handler¶
System metrics collection handler for Pi Dashboard.
This module provides functions to collect system metrics from the host system, even when running inside a Docker container. It uses psutil and direct file reading from mounted host directories.
Functions
|
Get the path to a host system file from within Docker container. |
Get the host root path for metrics collection. |
|
Get the system hostname, attempting to read from host filesystem if in Docker. |
|
Get system information using platform module. |
|
Get current system metrics. |
|
Read CPU temperature from thermal zone. |
|
Read system uptime from /proc/uptime. |
- pi_dashboard.system_metrics_handler.get_host_root()[source]¶
Get the host root path for metrics collection.
- Return str:
The host root path
- Return type:
- pi_dashboard.system_metrics_handler.get_host_path(relative_path)[source]¶
Get the path to a host system file from within Docker container.
If running in Docker with host mounts, accesses files from /host/* paths. Otherwise, accesses system files directly.
- pi_dashboard.system_metrics_handler.get_hostname()[source]¶
Get the system hostname, attempting to read from host filesystem if in Docker.
- Return str:
The system hostname
- Return type:
- pi_dashboard.system_metrics_handler.read_cpu_temperature()[source]¶
Read CPU temperature from thermal zone.
- Return float:
CPU temperature in Celsius, or 0.0 if unavailable
- Return type:
- pi_dashboard.system_metrics_handler.read_uptime()[source]¶
Read system uptime from /proc/uptime.
- Return int:
System uptime in seconds, or 0 if unavailable
- Return type:
- pi_dashboard.system_metrics_handler.get_system_info()[source]¶
Get system information using platform module.
When running in Docker, reads hostname from host filesystem.
- Return SystemInfo:
System information data
- Return type: