Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to log my bandwidth into a database and find out when my windows server 2003 is being used the most. I want to feed the database with the bandwidth passed from the last feed (let's say it's 15 minutes).

I know that the netstat -e command returns the bandwidth passed since interface's start. Is there a way to somehow reset that counter without disabling and reenabling the interface?

If not, is there a better way than caching the last sample and calculating the difference each time?

I'm scripting in python if it's related.

share|improve this question
up vote 3 down vote accepted

With some smarts, the built in Windows Performance Monitors (perfmon) can do this.

Basically, if you set up Windows Performance Monitors to log bytes/sec on the interface into an SQL database, you can then graph that over a period of time - any period of time you choose, assuming the logging was running then.

That's basically what most central monitoring systems do. I can go back over the past 12 months and see how much bandwidth went in/out of our database server down to uselessly small increments.

share|improve this answer

One idea that comes to mind is to use WMI to query the Network Interface. Since I am not familiar with python a quick search online seems to indicate there is a Python WMI module that will let you query WMI from within Python directly. Querying WMI can be daunting.

There is a small .vbs example here that should get you started. If you can figure out how to do it in python you should be all set and have access to more info than you know what to do with. I think the example you are looking for will be the one titled "...get information about network adapters without also retrieving information about things like RAS and VPN connections?".

share|improve this answer

Your Answer


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.