mirror of
https://github.com/yavook/kiwi-simple-metrics.git
synced 2024-11-24 08:23:01 +00:00
disk_metric reporting
This commit is contained in:
parent
b9259d306d
commit
953da6d511
2 changed files with 20 additions and 3 deletions
|
@ -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
|
||||
),
|
||||
)
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue