mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-04-30 19:36:24 +00:00
Update flask_server.py
This commit is contained in:
@@ -2434,28 +2434,28 @@ def api_storage_summary():
|
|||||||
return jsonify({'error': str(e)}), 500
|
return jsonify({'error': str(e)}), 500
|
||||||
# END OF CHANGE FOR /api/storage/summary
|
# END OF CHANGE FOR /api/storage/summary
|
||||||
|
|
||||||
@app.route('/api/storage/observations', methods=['GET'])
|
@app.route('/api/storage/observations', methods=['GET'])
|
||||||
@require_auth
|
@require_auth
|
||||||
def api_storage_observations():
|
def api_storage_observations():
|
||||||
"""Get disk observations (permanent error history) for a specific disk or all disks."""
|
"""Get disk observations (permanent error history) for a specific disk or all disks."""
|
||||||
try:
|
try:
|
||||||
device = request.args.get('device', '')
|
device = request.args.get('device', '')
|
||||||
serial = request.args.get('serial', '')
|
serial = request.args.get('serial', '')
|
||||||
|
|
||||||
# Strip /dev/ prefix if present
|
# Strip /dev/ prefix if present
|
||||||
if device.startswith('/dev/'):
|
if device.startswith('/dev/'):
|
||||||
device = device[5:]
|
device = device[5:]
|
||||||
|
|
||||||
observations = health_persistence.get_disk_observations(
|
observations = health_persistence.get_disk_observations(
|
||||||
device_name=device or None,
|
device_name=device or None,
|
||||||
serial=serial or None
|
serial=serial or None
|
||||||
)
|
)
|
||||||
|
|
||||||
return jsonify({'observations': observations})
|
return jsonify({'observations': observations})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return jsonify({'observations': [], 'error': str(e)}), 500
|
return jsonify({'observations': [], 'error': str(e)}), 500
|
||||||
|
|
||||||
def get_interface_type(interface_name):
|
def get_interface_type(interface_name):
|
||||||
"""Detect the type of network interface"""
|
"""Detect the type of network interface"""
|
||||||
try:
|
try:
|
||||||
# Skip loopback
|
# Skip loopback
|
||||||
|
|||||||
Reference in New Issue
Block a user