开发者

How To Use .NET to Count The Number of TIME_WAIT Connections on an EC2 Server

I run a few clusters of servers at Amazon EC2. Lately, 开发者_如何学Gowe've been running into an issue with the OS not cleaning up connection in a TIME_WAIT status, so I want to create an alarm to notify me when a server hits a certain threshold of connections in TIME_WAIT. I can create a simple batch file to do this (netstat -an |find /c "TIME_WAIT" > count.txt), but the problem is that my monitoring software exists on my corporate network, so I don't have a way to call that command remotely.

I have a web server running in each of these clusters. I'd like to create a web service that will accept the name of the server I want to check as a parameter, then make a call to each of those servers, returning the number of connections in TIME_WAIT status. All of these machines are running Windows Server 2008.

In other words, a server on my corporate LAN will make a GET http request to a web server in EC2. That web server will then remotely count the number of connection in TIME_WAIT on another server in EC2. The EC2 machines are NOT in a domain. Is this possible or is there an easier way that would save me the trouble?

An absolute requirement is that all of the calls and monitoring must be managed centrally by my monitoring application on my corporate LAN.


You should look up WMI counters in .NET, see second answer to this question:

How can I access netstat-like Ethernet statistics from a Windows program

and this reference:

http://msdn.microsoft.com/en-us/library/ms257340(v=vs.80).aspx

WMI can be invoked remotely if the necessary credentials are in place.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜