capturing resource use stats on windows (and linux, osx, …)

Needed a way to capture performance data for a windows server.

Had a long look, plenty of tools there seem to be. Perfmon, Processmon, etc. The problem with these is that they are graphical tools, which is nice for manual analysis and all. But I wanted to capture the data automatically for long term analysis. Some options I found include

  • Scripting Perfmon with Logman. Seems possible but I found it very poorly documented and seems like a real hassle.
  • Install Cygwin and run commands like “top” or cat the /proc filesystem. Seems to work surprisingly well actually. But still something a bit easier to script and better access to specific resource data would be nice.
  • Run some queries over SNMP. Arrr, probably very useful approach but I am more of a script it myself kinda guy and also not sure how well I will always have access to some SNMP services where I need to monitor..

And then finally for something completely different. Figured to look into options for building my own. And it turns out Python has a nice module called “psutil”. So just install python+psutil and it takes about 2 lines of code to read and print CPU, Memory, Network, Disk metrics from any of Windows, Linux, OSX, … And much better control for me. Brilliant.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s