fix: dashboard and hosts count SSH and RDP daily reports
analytics-a4: daily_reports_24h uses report.daily.*; sac-deploy enables timers Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -10,7 +10,7 @@ from app.config import get_settings
|
||||
from app.database import get_db
|
||||
from app.models import Event, Host, Problem
|
||||
from app.schemas.list_models import EventSummary
|
||||
from app.services.host_health import DAILY_REPORT_SSH, HEARTBEAT_TYPE, count_stale_hosts
|
||||
from app.services.host_health import DAILY_REPORT_TYPES, HEARTBEAT_TYPE, count_stale_hosts
|
||||
|
||||
router = APIRouter(prefix="/dashboards", tags=["dashboards"])
|
||||
|
||||
@@ -89,7 +89,7 @@ def dashboard_summary(
|
||||
daily_reports_24h = db.scalar(
|
||||
select(func.count())
|
||||
.select_from(Event)
|
||||
.where(Event.received_at >= since, Event.type == DAILY_REPORT_SSH)
|
||||
.where(Event.received_at >= since, Event.type.in_(DAILY_REPORT_TYPES))
|
||||
) or 0
|
||||
problems_open = (
|
||||
db.scalar(select(func.count()).select_from(Problem).where(Problem.status == "open")) or 0
|
||||
|
||||
@@ -8,9 +8,9 @@ from app.database import get_db
|
||||
from app.models import Event, Host
|
||||
from app.schemas.list_models import HostListResponse, HostSummary
|
||||
from app.services.host_health import (
|
||||
DAILY_REPORT_SSH,
|
||||
HEARTBEAT_TYPE,
|
||||
agent_status,
|
||||
max_daily_report_time_by_host,
|
||||
max_event_time_by_host,
|
||||
)
|
||||
|
||||
@@ -47,7 +47,7 @@ def list_hosts(
|
||||
|
||||
settings = get_settings()
|
||||
hb_map = max_event_time_by_host(db, HEARTBEAT_TYPE)
|
||||
report_map = max_event_time_by_host(db, DAILY_REPORT_SSH)
|
||||
report_map = max_daily_report_time_by_host(db)
|
||||
|
||||
items: list[HostSummary] = []
|
||||
for host in rows:
|
||||
|
||||
@@ -11,7 +11,7 @@ from app.auth.jwt_auth import verify_access_token
|
||||
from app.database import SessionLocal
|
||||
from app.models import Event, Problem
|
||||
from app.config import get_settings
|
||||
from app.services.host_health import DAILY_REPORT_SSH, HEARTBEAT_TYPE, count_stale_hosts
|
||||
from app.services.host_health import DAILY_REPORT_TYPES, HEARTBEAT_TYPE, count_stale_hosts
|
||||
from app.version import APP_VERSION
|
||||
|
||||
router = APIRouter(prefix="/stream", tags=["stream"])
|
||||
@@ -43,7 +43,7 @@ def _dashboard_snapshot(db: Session) -> dict:
|
||||
"daily_reports_24h": db.scalar(
|
||||
select(func.count())
|
||||
.select_from(Event)
|
||||
.where(Event.received_at >= since, Event.type == DAILY_REPORT_SSH)
|
||||
.where(Event.received_at >= since, Event.type.in_(DAILY_REPORT_TYPES))
|
||||
)
|
||||
or 0,
|
||||
"problems_open": problems_open,
|
||||
|
||||
Reference in New Issue
Block a user