I got nagios monitoring and it is picking up high swap usage on a specific server. The user is using some application which triggers the high swap. Even after they quit the application, top still shows high swap used.

I've tried using swapoff -a and swapon -a. It doesn't reset the counter within top.

It seems like the only way to reset the counter is to reboot the server. Which is a pain.

enter image description here

  • What is the actual problem you're trying to solve? – David Schwartz Jan 5 '16 at 9:42
  • @DavidSchwartz Reset the swap counter. Even after the process is killed, the high swap usage still remains until after a reboot. The high swap triggers the nagios alerts. – lbanz Jan 5 '16 at 9:45
  • Can you fix Nagios so it doesn't trigger the false alerts? Clearly, the amount of used swap can't actually be greater than the total swap. – David Schwartz Jan 5 '16 at 9:47
  • @DavidSchwartz nagios isn't wrong. top is showing higher swap used then the total amount of swap available. I've applied the latest Centos patches for this version. – lbanz Jan 5 '16 at 9:50

For the swapoff command to work, there should be enough free physical memory so that the swapped files can be moved. As far as I can see, your amount of swap usage is very high and there is no way the system can free it.

See the swapoff man page: https://www.freebsd.org/cgi/man.cgi?query=swapoff&sektion=8

...Note that swapoff will fail and refuse to remove a swap device if there is insufficient VM (memory + remaining swap devices) to run the system...

There is certainly something wrong with your system which you should investigate. You can also try to run swapoff with the -v (for verbose) option to see if outputs more info.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.