Add latest changes

Dieser Commit ist enthalten in:
2025-07-03 20:38:33 +00:00
Ursprung 63f3d92724
Commit 6f6cde65db
129 geänderte Dateien mit 3998 neuen und 1199 gelöschten Zeilen

Datei anzeigen

@@ -91,7 +91,7 @@ def unified_monitoring():
SELECT
COUNT(DISTINCT license_id) as active_licenses,
COUNT(*) as total_validations,
COUNT(DISTINCT hardware_id) as unique_devices,
COUNT(DISTINCT hardware_fingerprint) as unique_devices,
COUNT(DISTINCT ip_address) as unique_ips,
0 as avg_response_time
FROM license_heartbeats
@@ -126,7 +126,7 @@ def unified_monitoring():
l.license_key,
c.name as customer_name,
lh.ip_address,
lh.hardware_id,
lh.hardware_fingerprint,
NULL as anomaly_type,
NULL as description
FROM license_heartbeats lh
@@ -143,8 +143,8 @@ def unified_monitoring():
ad.severity,
l.license_key,
c.name as customer_name,
ad.details->>'ip_address' as ip_address,
ad.details->>'hardware_id' as hardware_id,
(ad.details->>'ip_address')::inet as ip_address,
ad.details->>'hardware_fingerprint' as hardware_fingerprint,
ad.anomaly_type,
ad.details->>'description' as description
FROM anomaly_detections ad
@@ -166,7 +166,7 @@ def unified_monitoring():
l.license_key,
c.name as customer_name,
lh.ip_address,
lh.hardware_id,
lh.hardware_fingerprint,
NULL as anomaly_type,
NULL as description
FROM license_heartbeats lh
@@ -199,7 +199,7 @@ def unified_monitoring():
l.id,
l.license_key,
c.name as customer_name,
COUNT(DISTINCT lh.hardware_id) as device_count,
COUNT(DISTINCT lh.hardware_fingerprint) as device_count,
COUNT(lh.*) as validation_count,
MAX(lh.timestamp) as last_seen,
COUNT(DISTINCT ad.id) as anomaly_count
@@ -220,7 +220,7 @@ def unified_monitoring():
l.id,
l.license_key,
c.name as customer_name,
COUNT(DISTINCT lh.hardware_id) as device_count,
COUNT(DISTINCT lh.hardware_fingerprint) as device_count,
COUNT(lh.*) as validation_count,
MAX(lh.timestamp) as last_seen,
0 as anomaly_count
@@ -345,7 +345,7 @@ def analytics():
SELECT
COUNT(DISTINCT license_id) as active_licenses,
COUNT(*) as total_validations,
COUNT(DISTINCT hardware_id) as unique_devices,
COUNT(DISTINCT hardware_fingerprint) as unique_devices,
COUNT(DISTINCT ip_address) as unique_ips
FROM license_heartbeats
WHERE timestamp > NOW() - INTERVAL '5 minutes'
@@ -403,7 +403,7 @@ def analytics_stream():
SELECT
COUNT(DISTINCT license_id) as active_licenses,
COUNT(*) as total_validations,
COUNT(DISTINCT hardware_id) as unique_devices,
COUNT(DISTINCT hardware_fingerprint) as unique_devices,
COUNT(DISTINCT ip_address) as unique_ips
FROM license_heartbeats
WHERE timestamp > NOW() - INTERVAL '5 minutes'
@@ -425,4 +425,15 @@ def analytics_stream():
time.sleep(5) # Update every 5 seconds
from flask import Response
return Response(generate(), mimetype="text/event-stream")
return Response(generate(), mimetype="text/event-stream")
@monitoring_bp.route('/device_limits')
@login_required
def device_limits():
"""Device limit monitoring dashboard"""
from utils.device_monitoring import check_device_limits, get_device_usage_stats
warnings = check_device_limits()
stats = get_device_usage_stats()
return render_template('monitoring/device_limits.html', warnings=warnings, stats=stats)