feat: remove slow proxmox metrics

This commit is contained in:
Simon Cornet 2025-06-22 15:34:10 +02:00
commit 681d0f80cf

View file

@ -27,58 +27,6 @@ memory_usage=$(free -m | awk 'NR==2 {print $3 " MB / " $2 " MB (" int($3/$2*100)
# pending updates
pending_updates=$(apt list --upgradable 2>/dev/null | grep -c 'upgradable')
# proxmox information
proxmox_info=""
if [ -f /etc/pve/version ] || [ -f /usr/bin/pveversion ]; then
# get vms
if command -v qm >/dev/null 2>&1; then
running_vms=$(qm list 2>/dev/null | grep -c "running" || echo "0")
total_vms=$(qm list 2>/dev/null | tail -n +2 | wc -l || echo "0")
else
running_vms="0"
total_vms="0"
fi
# get lxcs
if command -v pct >/dev/null 2>&1; then
running_containers=$(pct list 2>/dev/null | grep -c "running" || echo "0")
total_containers=$(pct list 2>/dev/null | tail -n +2 | wc -l || echo "0")
else
running_containers="0"
total_containers="0"
fi
# get cluster status
cluster_status=""
if [ -f /etc/pve/corosync.conf ]; then
cluster_name=$(grep "cluster_name" /etc/pve/corosync.conf 2>/dev/null | awk '{print $2}' | tr -d '"' || echo "Unknown")
if command -v pvecm >/dev/null 2>&1; then
cluster_nodes=$(pvecm nodes 2>/dev/null | grep -c "^[[:space:]]*[0-9]" || echo "1")
cluster_status="Cluster: $cluster_name ($cluster_nodes nodes)"
fi
fi
# get storage
storage_usage=""
if command -v pvesm >/dev/null 2>&1; then
storage_usage=$(pvesm status 2>/dev/null | awk 'NR==2 {if($4>0) printf "%.1f%% of %.1fGB", ($5/$4)*100, $4/1024/1024}')
fi
proxmox_info="VMs: $running_vms/$total_vms running
LXC Containers: $running_containers/$total_containers running"
if [ -n "$cluster_status" ]; then
proxmox_info="$proxmox_info
$cluster_status"
fi
if [ -n "$storage_usage" ]; then
proxmox_info="$proxmox_info
Storage Usage: $storage_usage"
fi
fi
# display motd
echo "Welcome to $(hostname)!"
echo ""
@ -86,13 +34,6 @@ echo -e "$linux_distribution"
echo "Disk Usage: $disk_usage"
echo "Memory Usage: $memory_usage"
# display proxmox info
if [ -n "$proxmox_info" ]; then
echo ""
echo -e "\e[38;5;208mProxmox Status:\e[0m"
echo "$proxmox_info"
fi
echo ""
if [ "$pending_updates" -eq 1 ]; then
echo "There is $pending_updates pending update."