mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-11-18 19:46:18 +00:00
Update AppImage
This commit is contained in:
@@ -174,7 +174,7 @@ const fetchStorageData = async (): Promise<StorageData | null> => {
|
|||||||
const fetchNetworkData = async (): Promise<NetworkData | null> => {
|
const fetchNetworkData = async (): Promise<NetworkData | null> => {
|
||||||
try {
|
try {
|
||||||
const baseUrl = typeof window !== "undefined" ? `${window.location.protocol}//${window.location.hostname}:8008` : ""
|
const baseUrl = typeof window !== "undefined" ? `${window.location.protocol}//${window.location.hostname}:8008` : ""
|
||||||
const apiUrl = `${baseUrl}/api/network`
|
const apiUrl = `${baseUrl}/api/network/summary`
|
||||||
|
|
||||||
const response = await fetch(apiUrl, {
|
const response = await fetch(apiUrl, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
|||||||
@@ -1375,7 +1375,7 @@ def get_interface_type(interface_name):
|
|||||||
return 'vlan'
|
return 'vlan'
|
||||||
|
|
||||||
# Check if it's a physical interface
|
# Check if it's a physical interface
|
||||||
if interface_name.startswith(('enp', 'eth', 'wlan', 'wlp', 'eno', 'ens')):
|
if interface_name.startswith(('enp', 'eth', 'eno', 'ens', 'wlan', 'wlp')):
|
||||||
return 'physical'
|
return 'physical'
|
||||||
|
|
||||||
# Default to skip for unknown types
|
# Default to skip for unknown types
|
||||||
@@ -3493,6 +3493,7 @@ def get_hardware_info():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"[v0] Error getting graphics cards: {e}")
|
print(f"[v0] Error getting graphics cards: {e}")
|
||||||
|
|
||||||
|
# PCI Devices
|
||||||
try:
|
try:
|
||||||
print("[v0] Getting PCI devices with driver information...")
|
print("[v0] Getting PCI devices with driver information...")
|
||||||
# First get basic device info with lspci -vmm
|
# First get basic device info with lspci -vmm
|
||||||
@@ -3807,6 +3808,83 @@ def api_network():
|
|||||||
"""Get network information"""
|
"""Get network information"""
|
||||||
return jsonify(get_network_info())
|
return jsonify(get_network_info())
|
||||||
|
|
||||||
|
@app.route('/api/network/summary', methods=['GET'])
|
||||||
|
def api_network_summary():
|
||||||
|
"""Optimized network summary endpoint - returns basic network info without detailed analysis"""
|
||||||
|
try:
|
||||||
|
net_io = psutil.net_io_counters()
|
||||||
|
net_if_stats = psutil.net_if_stats()
|
||||||
|
net_if_addrs = psutil.net_if_addrs()
|
||||||
|
|
||||||
|
# Count active interfaces by type
|
||||||
|
physical_active = 0
|
||||||
|
physical_total = 0
|
||||||
|
bridge_active = 0
|
||||||
|
bridge_total = 0
|
||||||
|
|
||||||
|
physical_interfaces = []
|
||||||
|
bridge_interfaces = []
|
||||||
|
|
||||||
|
for interface_name, stats in net_if_stats.items():
|
||||||
|
# Skip loopback and special interfaces
|
||||||
|
if interface_name in ['lo', 'docker0'] or interface_name.startswith(('veth', 'tap', 'fw')):
|
||||||
|
continue
|
||||||
|
|
||||||
|
is_up = stats.isup
|
||||||
|
|
||||||
|
# Classify interface type
|
||||||
|
if interface_name.startswith(('enp', 'eth', 'eno', 'ens', 'wlan', 'wlp')):
|
||||||
|
physical_total += 1
|
||||||
|
if is_up:
|
||||||
|
physical_active += 1
|
||||||
|
# Get IP addresses
|
||||||
|
addresses = []
|
||||||
|
if interface_name in net_if_addrs:
|
||||||
|
for addr in net_if_addrs[interface_name]:
|
||||||
|
if addr.family == socket.AF_INET:
|
||||||
|
addresses.append({'ip': addr.address, 'netmask': addr.netmask})
|
||||||
|
|
||||||
|
physical_interfaces.append({
|
||||||
|
'name': interface_name,
|
||||||
|
'status': 'up' if is_up else 'down',
|
||||||
|
'addresses': addresses
|
||||||
|
})
|
||||||
|
|
||||||
|
elif interface_name.startswith(('vmbr', 'br')):
|
||||||
|
bridge_total += 1
|
||||||
|
if is_up:
|
||||||
|
bridge_active += 1
|
||||||
|
# Get IP addresses
|
||||||
|
addresses = []
|
||||||
|
if interface_name in net_if_addrs:
|
||||||
|
for addr in net_if_addrs[interface_name]:
|
||||||
|
if addr.family == socket.AF_INET:
|
||||||
|
addresses.append({'ip': addr.address, 'netmask': addr.netmask})
|
||||||
|
|
||||||
|
bridge_interfaces.append({
|
||||||
|
'name': interface_name,
|
||||||
|
'status': 'up' if is_up else 'down',
|
||||||
|
'addresses': addresses
|
||||||
|
})
|
||||||
|
|
||||||
|
return jsonify({
|
||||||
|
'physical_active_count': physical_active,
|
||||||
|
'physical_total_count': physical_total,
|
||||||
|
'bridge_active_count': bridge_active,
|
||||||
|
'bridge_total_count': bridge_total,
|
||||||
|
'physical_interfaces': physical_interfaces,
|
||||||
|
'bridge_interfaces': bridge_interfaces,
|
||||||
|
'traffic': {
|
||||||
|
'bytes_sent': net_io.bytes_sent,
|
||||||
|
'bytes_recv': net_io.bytes_recv,
|
||||||
|
'packets_sent': net_io.packets_sent,
|
||||||
|
'packets_recv': net_io.packets_recv
|
||||||
|
}
|
||||||
|
})
|
||||||
|
except Exception as e:
|
||||||
|
print(f"[v0] Error in api_network_summary: {e}")
|
||||||
|
return jsonify({'error': str(e)}), 500
|
||||||
|
|
||||||
@app.route('/api/network/<interface_name>/metrics', methods=['GET'])
|
@app.route('/api/network/<interface_name>/metrics', methods=['GET'])
|
||||||
def api_network_interface_metrics(interface_name):
|
def api_network_interface_metrics(interface_name):
|
||||||
"""Get historical metrics (RRD data) for a specific network interface"""
|
"""Get historical metrics (RRD data) for a specific network interface"""
|
||||||
@@ -4882,6 +4960,7 @@ def api_info():
|
|||||||
'/api/storage',
|
'/api/storage',
|
||||||
'/api/proxmox-storage',
|
'/api/proxmox-storage',
|
||||||
'/api/network',
|
'/api/network',
|
||||||
|
'/api/network/summary', # Added network summary
|
||||||
'/api/vms',
|
'/api/vms',
|
||||||
'/api/vms/<vmid>/metrics', # Added endpoint for RRD data
|
'/api/vms/<vmid>/metrics', # Added endpoint for RRD data
|
||||||
'/api/node/metrics', # Added node metrics endpoint
|
'/api/node/metrics', # Added node metrics endpoint
|
||||||
@@ -5210,7 +5289,7 @@ def api_vm_config_update(vmid):
|
|||||||
'error': config_result.stderr
|
'error': config_result.stderr
|
||||||
}), 500
|
}), 500
|
||||||
else:
|
else:
|
||||||
return jsonify({'error': 'Failed to get VM details'}), 500
|
return jsonify({'error': 'Failed to get VM
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error updating VM configuration: {e}")
|
print(f"Error updating VM configuration: {e}")
|
||||||
return jsonify({'error': str(e)}), 500
|
return jsonify({'error': str(e)}), 500
|
||||||
|
|||||||
Reference in New Issue
Block a user