mirror of
https://github.com/yavook/kiwi-simple-metrics.git
synced 2024-11-21 23:32:59 +00:00
16 lines
315 B
Python
16 lines
315 B
Python
import psutil
|
|
|
|
from ..settings import SETTINGS
|
|
from ._report import Report
|
|
|
|
|
|
def cpu() -> Report | None:
|
|
if not SETTINGS.cpu.enabled:
|
|
return None
|
|
|
|
value = psutil.cpu_percent(interval=1)
|
|
return Report.new(
|
|
settings=SETTINGS.cpu,
|
|
name=SETTINGS.cpu.name,
|
|
value=value,
|
|
)
|