Last active
September 29, 2023 16:16
-
-
Save aitseitz/279c16d614f997497ed6f396a068f7c4 to your computer and use it in GitHub Desktop.
Checks for RAM and SWAP Usage
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 | |
echo "free -m:" | |
free -m | |
echo " " | |
echo "------" | |
echo "sysctl vm.swappiness :" | |
sysctl vm.swappiness | |
echo " " | |
echo "------" | |
echo "cat /proc/meminfo:" | |
cat /proc/meminfo | |
echo " " | |
echo "------" | |
echo "check swap usage sorted by process names:" | |
#cat /proc/18361/status | grep -i "VmSwap" | |
for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done | sort -k 2 -n -r | cat | |
# Additional Checks with root permissions: | |
#echo " " | |
#echo "------" | |
#echo "sudo cat /proc/slabinfo" | |
#sudo cat /proc/slabinfo | |
#echo " " | |
#echo "------" | |
#echo "sudo slabtop" | |
#sudo slabtop |
Change Swapiness:
Option 1: --> Temporary:
sudo sysctl vm.swappiness=10
Option 2: --> Permanently
echo "vm.swappiness=10" | sudo tee /etc/sysctl.d/500-custom-swapiness.conf
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Useful articles:
https://checkmk.com/de/blog/swap-monitoring
https://www.kernel.org/doc/Documentation/sysctl/vm.txt
REHL specific:
https://access.redhat.com/solutions/2435631
https://access.redhat.com/solutions/1384183
https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt