disk_metric reporting

This commit is contained in:
Jörn-Michael Miehe 2023-08-31 11:02:54 +00:00
parent b9259d306d
commit 953da6d511
2 changed files with 20 additions and 3 deletions

View file

@ -64,7 +64,18 @@ def disk_metric() -> Report | None:
value=percent,
) for path, percent in data]
return Report(
", ".join(report.result for report in reports),
failed=any(report.failed for report in reports),
report_inner = ", ".join(
report.result
for report in reports[:SETTINGS.disk.count]
)
return Report(
SETTINGS.disk.report_outer.format(
name="DISK FREE",
inner=report_inner,
),
failed=any(
report.failed
for report in reports
),
)

View file

@ -19,9 +19,15 @@ class MetricSettings(BaseModel):
class DiskMS(MetricSettings):
# outer format string for reporting
report_outer: str = "{name}: [{inner}]"
# paths to check for disk space
paths: list[DirectoryPath] = Field(default_factory=list)
# include only `count` many of the paths with the least free space
count: int = 1
class Settings(BaseSettings):
model_config = SettingsConfigDict(