Kategorien
Allgemein

Simple resource log for linux servers

This script should be run periodically (at least hourly) to monitor the servers use of resources.
If the Server should crash because of insufficient memory someone can look into the log and find out which processes could have caused that.

exec 2>&1 1>> /var/log/resource.log
NOW=$(date)
echo ""
echo "#================================ $NOW ================================#"
echo ""
echo "#===top"
top -n 1 -b
echo ""
echo "#===lsof"
lsof -ni
echo ""
echo "#===/proc/user_beancounters"
grep -v " 0$" /proc/user_beancounters