Added PVE mem-overview script
Added mem-overview script for use on proxmox ve server. Added here, so I could remove an otherwise unused repository.
This commit is contained in:
parent
1531dc3b28
commit
faa784b0ee
25
pve_mem-overview.sh
Normal file
25
pve_mem-overview.sh
Normal file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Memory state with use of "free"
|
||||
MEM_TOTAL=$(free -m | awk '/^Mem:/ { print $2 } ')
|
||||
MEM_USED=$(free -m | awk '/^Mem:/ { print $3 } ')
|
||||
|
||||
# ARC state with use of "/proc/spl/kstat/zfs/arcstats"
|
||||
FLOAT_ARC_USED=$(awk '/^size/ { print $3 / 1048576 }' < /proc/spl/kstat/zfs/arcstats)
|
||||
INT_ARC_USED=${FLOAT_ARC_USED%.*}
|
||||
|
||||
# Calculated values
|
||||
MEM_SYSTEM=$(($MEM_USED-INT_ARC_USED))
|
||||
MEM_AVAILABLE=$(($MEM_TOTAL-$MEM_SYSTEM))
|
||||
|
||||
# output
|
||||
echo -e "\nMemory overview:\n"
|
||||
printf "\nTotal Memory:,Used Memory:,Available Memory:,Memory ARC:,Memory Sys & KVM:\n$MEM_TOTAL MiB,$MEM_USED MiB,$MEM_AVAILABLE MiB,$INT_ARC_USED MiB,$MEM_SYSTEM MiB\n\n" | column -t -s ','
|
||||
|
||||
echo -e "\nOutput definition:"
|
||||
|
||||
echo -e "Total Memory: Memory installed on system
|
||||
Available Memory: ['Total Memory' - 'Memory Sys & KVM']
|
||||
Memory ARC: Memory used by ZFS RAM cache (ARC)
|
||||
Memory Sys & KVM: Memory used by containers, VMs and system\n" | column -t -s ' '
|
||||
|
Loading…
x
Reference in New Issue
Block a user