This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script reads a static VM list from /tmp/vms.txt and live network data | |
# to produce a sorted report of the top 20 VMs with the highest network drop rates. | |
# Ensure the VM list file exists before running | |
if [ ! -f /tmp/vms.txt ]; then | |
echo "Error: VM list file /tmp/vms.txt not found." | |
echo "Please create it first with: qm list > /tmp/vms.txt" | |
exit 1 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
awk ' | |
BEGIN { | |
# Print the header for our output with better formatting | |
printf "%-15s %-65s %15s %12s %12s\n", | |
"INTERFACE", "VM NAME", "TX PACKETS", "TX DROPS", "DROP RATE %" | |
printf "%-15s %-65s %15s %12s %12s\n", | |
"---------------", "-----------------------------------------------------------------", | |
"---------------", "------------", "------------" |