Monitoring Anpassung
Dieser Commit ist enthalten in:
@@ -881,69 +881,8 @@ def license_analytics():
|
||||
@admin_bp.route("/lizenzserver/anomalies")
|
||||
@login_required
|
||||
def license_anomalies():
|
||||
"""Anomaly detection and management"""
|
||||
try:
|
||||
conn = get_connection()
|
||||
cur = conn.cursor()
|
||||
|
||||
# Filter parameters
|
||||
severity = request.args.get('severity', 'all')
|
||||
resolved = request.args.get('resolved', 'false')
|
||||
|
||||
# Build query
|
||||
query = """
|
||||
SELECT ad.*, l.license_key, c.name as customer_name, c.email
|
||||
FROM anomaly_detections ad
|
||||
LEFT JOIN licenses l ON ad.license_id = l.id
|
||||
LEFT JOIN customers c ON l.customer_id = c.id
|
||||
WHERE 1=1
|
||||
"""
|
||||
params = []
|
||||
|
||||
if severity != 'all':
|
||||
query += " AND ad.severity = %s"
|
||||
params.append(severity)
|
||||
|
||||
if resolved == 'false':
|
||||
query += " AND ad.resolved = false"
|
||||
elif resolved == 'true':
|
||||
query += " AND ad.resolved = true"
|
||||
|
||||
query += " ORDER BY ad.detected_at DESC LIMIT 100"
|
||||
|
||||
cur.execute(query, params)
|
||||
anomalies = cur.fetchall()
|
||||
|
||||
# Get anomaly statistics
|
||||
cur.execute("""
|
||||
SELECT anomaly_type, severity, COUNT(*) as count
|
||||
FROM anomaly_detections
|
||||
WHERE resolved = false
|
||||
GROUP BY anomaly_type, severity
|
||||
ORDER BY count DESC
|
||||
""")
|
||||
anomaly_stats = cur.fetchall()
|
||||
|
||||
return render_template('license_anomalies.html',
|
||||
anomalies=anomalies,
|
||||
anomaly_stats=anomaly_stats,
|
||||
severity=severity,
|
||||
resolved=resolved
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
flash(f'Fehler beim Laden der Anomalie-Daten: {str(e)}', 'error')
|
||||
return render_template('license_anomalies.html',
|
||||
anomalies=[],
|
||||
anomaly_stats=[],
|
||||
severity='all',
|
||||
resolved='false'
|
||||
)
|
||||
finally:
|
||||
if 'cur' in locals():
|
||||
cur.close()
|
||||
if 'conn' in locals():
|
||||
conn.close()
|
||||
"""Redirect to unified monitoring page"""
|
||||
return redirect(url_for('monitoring.unified_monitoring'))
|
||||
|
||||
|
||||
@admin_bp.route("/lizenzserver/anomaly/<anomaly_id>/resolve", methods=["POST"])
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren