Merge branch 'develop' into release/0.1.0

This commit is contained in:
Jörn-Michael Miehe 2023-09-02 15:18:40 +00:00
commit e4296327b0
3 changed files with 9 additions and 5 deletions

2
.vscode/launch.json vendored
View file

@ -12,7 +12,7 @@
"env": {
"METRIC__INTERVAL": "5",
"METRIC__LOG__ENABLED": "True",
"METRIC__DISK__PATHS": "[\"/var\", \"/\", \"/dev\"]",
"METRIC__EXTERNAL__ENABLED": "True",
"METRIC__EXTERNAL__EXECUTABLES": "[\"${workspaceFolder}/example/dummy-metric\"]",
},
"justMyCode": true

View file

@ -102,6 +102,9 @@ class Report:
reports = [data.report for data in get_data()]
if not reports:
return None
return cls(
result=settings.report_outer.format(
name=settings.name,

View file

@ -1,8 +1,8 @@
import math
from typing import Any, Literal
from pydantic import (BaseModel, DirectoryPath, Field, FieldValidationInfo,
FilePath, field_validator)
from pydantic import (BaseModel, DirectoryPath, FieldValidationInfo, FilePath,
field_validator)
class MetricSettings(BaseModel):
@ -81,15 +81,16 @@ class DiskMS(MetricSettings):
count: int | None = 1
# paths to check for disk space
paths: list[DirectoryPath] = Field(default_factory=list)
paths: list[DirectoryPath] = [DirectoryPath("/")]
class ExternalMS(MetricSettings):
name: str = "External Metric"
enabled: bool = False
threshold: float = 0
# path to executable files
executables: list[FilePath] = Field(default_factory=list)
executables: list[FilePath] = []
# wait at most this many seconds for each executable
timeout: int = 60