Fix System Health.
This commit is contained in:
@@ -456,13 +456,18 @@ def system_admin_health():
|
|||||||
func.date(SystemEvent.timestamp) == today
|
func.date(SystemEvent.timestamp) == today
|
||||||
).count()
|
).count()
|
||||||
|
|
||||||
# Calculate 24-hour error count
|
# Calculate 24-hour error and warning counts
|
||||||
yesterday = now - timedelta(days=1)
|
yesterday = now - timedelta(days=1)
|
||||||
error_count_24h = SystemEvent.query.filter(
|
error_count_24h = SystemEvent.query.filter(
|
||||||
SystemEvent.timestamp >= yesterday,
|
SystemEvent.timestamp >= yesterday,
|
||||||
SystemEvent.severity == 'error'
|
SystemEvent.severity == 'error'
|
||||||
).count()
|
).count()
|
||||||
|
|
||||||
|
warning_count_24h = SystemEvent.query.filter(
|
||||||
|
SystemEvent.timestamp >= yesterday,
|
||||||
|
SystemEvent.severity == 'warning'
|
||||||
|
).count()
|
||||||
|
|
||||||
# Log the health check
|
# Log the health check
|
||||||
SystemEvent.log_event(
|
SystemEvent.log_event(
|
||||||
'system_health_check',
|
'system_health_check',
|
||||||
@@ -484,7 +489,8 @@ def system_admin_health():
|
|||||||
db_error=db_error,
|
db_error=db_error,
|
||||||
uptime_duration=uptime_duration,
|
uptime_duration=uptime_duration,
|
||||||
today_events=today_events,
|
today_events=today_events,
|
||||||
error_count_24h=error_count_24h)
|
error_count_24h=error_count_24h,
|
||||||
|
warning_count_24h=warning_count_24h)
|
||||||
|
|
||||||
|
|
||||||
@system_admin_bp.route('/branding', methods=['GET', 'POST'])
|
@system_admin_bp.route('/branding', methods=['GET', 'POST'])
|
||||||
|
|||||||
Reference in New Issue
Block a user