feat: expose monitoring pf health detail

This commit is contained in:
Grendgi
2026-06-17 15:59:53 +03:00
parent ccd56165c7
commit f73c9fba5f
3 changed files with 136 additions and 0 deletions

View File

@@ -10,6 +10,8 @@ import json
import sys
from typing import Any
from sqlalchemy import text
from app.db import SessionLocal, init_db
from app.models import Project
from app.services.monitor import (
@@ -131,7 +133,17 @@ def cmd_suggest(payload: dict[str, Any]) -> None:
db.close()
def cmd_health(_: dict[str, Any]) -> None:
db = SessionLocal()
try:
db.execute(text("SELECT 1"))
_write({"status": "ok"})
finally:
db.close()
COMMANDS = {
"health": cmd_health,
"add-listing": cmd_add_listing,
"add-listings": cmd_add_listings,
"check-project": cmd_check_project,