Count active TCP connections

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
Kris
Posts: 375
Joined: Wed May 12, 2010 3:22 am

Count active TCP connections

Post by Kris »

Hiya all,

I'm looking for a way to count active TCP connections on a remote computer.
Of course I could run "netstat -a > result.txt" on the remote computer and count the number of lines in "result.txt" minus 5 for header and blank line, but that would be my last resort.

A more sophisticated approach, maybe through WMI, would be more desirable...

Any ideas?

Thanks!
Kris
Kris
Posts: 375
Joined: Wed May 12, 2010 3:22 am

Post by Kris »

Allright...

I found "Win32_PerfFormattedData_Tcpip_TCPv4" and the caption "ConnectionsActive".

However, I'm not sure what I'm looking at.

The WMI value is quite different from the number of TCP lines when using netstat...
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

You may use SNMP GET test and query OID: 1.3.6.1.2.1.6.9.0
It shows the number of TCP connections for which the current state is either ESTABLISHED or CLOSE-WAIT.
Please note: SNMP Service should be configured properly and started on target system.
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

Same data can be retrieved by the following WMI query:
select ConnectionsEstablished from Win32_PerfFormattedData_Tcpip_TCPv4
Kris
Posts: 375
Joined: Wed May 12, 2010 3:22 am

Post by Kris »

Neither value match the number of connections shown by netstat.
Still not shure which one to use....
Kris
Posts: 375
Joined: Wed May 12, 2010 3:22 am

Post by Kris »

Ah...

netstat also show local connections.
That seems to explain the difference.

Now I need one more value:
The number of unassigned TCP ports :o
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

We cannot find such counter.

Regards
Alex
Post Reply