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.


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.

| 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 http://msdn.microsoft.com/en-us/library/windows/desktop/aa394595(v=vs.85).aspx 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?".

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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