Swap monitoring and auto fix script

So a little while ago I mentioned that you could combine the swap monitoring script and the script that trys to put the swap back into working memory into a script that would just take care of it. I found that my machines were going into swap for trivial reasons, so I just set up a cron to run every 15 minutes that checks for swap, and if it finds any it just throws it back into working memory. Script below: #!/bin/bash swap=$(top -bi -n 1 |...

Read More

A little about SWAP

A little about SWAP

Swap has been a major pain in my tush while managing Ubuntu Systems. Even my one machine with 16 gigs of RAM still finds itself in swap after a while. So I’ve been hunting around trying to come up with solutions to swapping machines, and how to keep machines out of swap. What is Swap From my experience, swap is NEVER a good thing, and your machine will never leave swap once its in that state, even if the memory demand decreases to the...

Read More

Ubuntu consolekit taking up enormous amounts of memory/cpu

I have an older machine that only has a small CPU and a small amount of memory. Ubuntu is designed to run on low resource computers, but It was going into extreme swap situations all the time. I recently go fed up with it, and did two things to help. The first is I changed the swapiness value, which is the tendency of the server to use swap. #edit /etc/sysctl.conf vm.swappiness=0 The second is that I removed consolekit using: apt-get remove...

Read More

Monitoring Resource Usage in Ubuntu with top

When you want to monitor the resources that are being used by your processes, the top command comes in handy. You can see a breakdown of the CPU usage by process, and memory usage as well. There are a few things I use top for regularly. To monitor whether the CPU usage is too high. To monitor whether Memory usage is too high.  — This can be misleading sometimes because of cache issues. To monitor whether the machine has entered into SWAP...

Read More