Change interval

This commit is contained in:
Paul Moeller-Friedrich
2026-08-20 09:24:02 +02:00
parent 200186e561
commit 553c035a20
5 changed files with 129 additions and 47 deletions
+2 -23
View File
@@ -3,11 +3,9 @@ from __future__ import annotations
import logging
import os
import sys
import time
from app.checker import check_all
from app.config import ConfigError, load_config
from app.influx_writer import write_results
from app.scheduler import run_forever
logger = logging.getLogger("uptime_monitor")
@@ -20,13 +18,6 @@ def setup_logging() -> None:
)
def run_cycle(cfg) -> list:
timestamp_ns = time.time_ns()
results = check_all(cfg.endpoints, cfg.check.timeout_seconds, timestamp_ns)
write_results(cfg.influx, results)
return results
def main() -> None:
setup_logging()
config_path = os.environ.get("CONFIG_PATH", "/config/config.yaml")
@@ -42,19 +33,7 @@ def main() -> None:
len(cfg.endpoints), config_path, cfg.check.interval_seconds,
)
while True:
results = run_cycle(cfg)
if any(not r.success for r in results):
logger.warning(
"at least one endpoint failed this cycle; "
"re-checking all endpoints immediately in %.0fs",
cfg.check.immediate_recheck_delay_seconds,
)
time.sleep(cfg.check.immediate_recheck_delay_seconds)
run_cycle(cfg)
time.sleep(cfg.check.interval_seconds)
run_forever(cfg)
if __name__ == "__main__":