Welcome to InviteVPS.com home of cheap linux vps powered by SolusVM panel. Be sure to check out our latest SPECIALS HERE. Hope you enjoy your stay with us!
+60193214412
Live Support

Portal Home > Knowledgebase > Tutorials > Ps_Mem – A Simple Python Memory Usage Script


Ps_Mem – A Simple Python Memory Usage Script




I don’t know where I was looking but I came across ps_mem.py, a simple Python memory usage script. All you need for this is Python, the programming language, to run this on your VPS.

wget http://www.pixelbeat.org/scripts/ps_mem.py
chmod +x ps_mem.py
sudo ./ps_mem.py

Here is an example of some output of my VPS running nginx and CSF, the ConfigServer Firewall.

# ./ps_mem.py 
 Private  +   Shared  =  RAM used	Program 

296.0 KiB +  37.5 KiB = 333.5 KiB	udevd
680.0 KiB +  97.5 KiB = 777.5 KiB	crond
696.0 KiB + 124.5 KiB = 820.5 KiB	init
  1.1 MiB + 118.0 KiB =   1.2 MiB	bash
  1.2 MiB + 376.5 KiB =   1.6 MiB	syslog-ng (2)
  2.4 MiB + 887.5 KiB =   3.3 MiB	sshd (2)
  4.6 MiB +   1.0 MiB =   5.6 MiB	sendmail.sendmail (3)
 13.3 MiB + 911.5 KiB =  14.2 MiB	nginx (2)
  1.9 MiB +  24.2 MiB =  26.1 MiB	lfd (2)
---------------------------------
                         53.9 MiB
=================================

This tells me that lfd, part of CSF, is using up the most memory with 26.1 MB and nginx uses 14.2 MB plus the combined programs running use 53.9 MB of my virtual private server’s 256mb of memory, which is not very much at all and very good!

You have to keep your eye on your virtual private server’s resource use and this ps_mem.py script is absolutely perfect for doing so when some folks find ps aux confusing. I would even go as far as putting it in your /usr/bin directory if memory consumption checking is something that you do often on your VPS.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read

Language: