Valhalla Legends Forums Archive | Advanced Programming | IP Statistics

AuthorMessageTime
Arta
I'm trying to write a small service to monitor network usage on my server. It should add results, polled every minute, to a MySQL database which is then used by a PHP script to draw a graph of network use vs RTT to my ISP's default gateway.

The problem is this: My server has 2 interfaces - one public and one private - and I only want to monitor the public interface. The functions I've been looking at (GetIpStatisticsEx, GetTcpStatisticsEx, GetUdpStatisticsEx) don't provide an option for or mention which adapter they return information about, so I assume they return aggregated data about all of them. Does anyone know of a way to get separate statistics for each adapter? Similarly to taskmgr.exe?
October 7, 2003, 2:31 PM
Adron
One way would be to write a ndis intermediary driver, which could have several filter rules and packet / byte counts for matches for each rule...
October 7, 2003, 4:46 PM
Skywing
[quote author=Adron link=board=23;threadid=2988;start=0#msg23301 date=1065545161]
One way would be to write a ndis intermediary driver, which could have several filter rules and packet / byte counts for matches for each rule...
[/quote]
Actually, that's pretty much going overboard. Most (all?) NICs implement many of the statistics OIDs, which taskmgr queries. You can use WMI for this, or you can use the performance counter interface (poke around in Network with perfmon to find these). The best would probably be to use WMI, because IIRC you need special privileges to do performance monitoring, but taskmgr (and the link notification area icon) seem to have no trouble displaying stats when run under a limited user account.

Edit:
It looks like you can also query this by requesting an OID directly via IOCTL_NDIS_QUERY_GLOBAL_STATS. I looked around in the WMI SDK some time, and I never found out how to request OIDs through it despite things saying you could. Oh well.
October 7, 2003, 5:40 PM
Arta
WMI?
October 7, 2003, 11:07 PM
St0rm.iD
Here's my guess:

windows monitoring interface

Here's my 5 second google:

http://www.ndis.com/faq/QA01050301/default.htm
October 7, 2003, 11:17 PM
Skywing
[quote author=Arta[vL] link=board=23;threadid=2988;start=0#msg23338 date=1065568071]
WMI?
[/quote]
Windows Management Instrumentation. Be ware that it uses COM, BSTRs, and VARIANTs extensively.
October 7, 2003, 11:32 PM

Search