3

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

Keith
  • 4,627
  • 14
  • 25
lbanz
  • 1,579
  • 4
  • 18
  • 30
  • What is the actual problem you're trying to solve? – David Schwartz Jan 05 '16 at 09: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 05 '16 at 09: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 05 '16 at 09: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 05 '16 at 09:50
  • It looks like a bug. Update your system. – Michael Hampton Jul 02 '19 at 04:54

1 Answers1

6

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.

Diamond
  • 8,791
  • 3
  • 22
  • 37