Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

How can I check which account/user is abusing/using the most resources on my VPS?

Quite often, web hosts suspend an account citing high resource usage. How can I check the same on my VPS? I have root access.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

It depends on what resource you wish to account for.

  • CPU: Install BSD process accounting (package acct on Debian; from memory it's psacct on CentOS, but I might be misremembering something there); this'll give you a log of all processes run, with UID, CPU/wall time, peak memory usage, etc, all included. Process as required.
  • RAM: For "over time" usage, BSD process accounting will do the trick. If you're after periodic "point in time" analysis (to catch large, long-running processes which are the most important consumer of memory) I'm not aware of anything off the shelf, but something that walks through /proc and scoops up the data out of /proc/X/maps isn't rocket science.
  • Network: This isn't a well-covered area for local users; if you're just after their usage of solicited incoming traffic the logs of your various servers can be used to analyse usage; if you're allowing unfettered inbound/outbound connections (not a good idea in the first place) and want to account for that traffic, something like netacct might be the least-worst option for this, although if you've got nefarious users it's not hard to get around.
  • Disk space: A periodic du will do for the simple case; if you really want to stop 'em, set up disk quotas.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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