Networking - networking mointoring system source code on or ,net

Asked By hussien on 13-Mar-11 05:58 PM
please help me on the network monitoring system with the source code on .net
c# or
thanks too
Ravinder Jamgotre replied to hussien on 15-Mar-11 11:19 AM
Hi Hussien,

You can use the following code for see which machines are alive on the network.

// addressToPing can be an IPaddress or host name. 
// returns a boolean indicating successful ping 
public static bool PingComputer (string[] addressToPing) 
Ping pingSender = new Ping (); 
PingOptions options = new PingOptions (); 
// Use the default Ttl value which is 128, 
// but change the fragmentation behavior. 
.DontFragment = true; 
// Create a buffer of 32 bytes of data to be transmitted. 
string data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; 
byte[] buffer = Encoding.ASCII.GetBytes (data); 
int timeout = 120; 
PingReply reply = pingSender.Send (args[0], timeout, buffer, options); 
return reply.Status == IPStatus.Success; 

Other PING classes for can be found here

You can use this ping code and iterate through the IP addresses on your LAN (for(i = 1; i < 255; i++)). You should probably read up on doing IP address calculations though:

This is called a 'ping sweep'. It does assume that the computers on the network have not been configured to ignore ICMP requests.

If you have the ability to install monitoring software on the various computers on the network, I've had good luck using nagios  for tracking which servers are up/under heavy load/out of disk space/etc in a production network. It also has a nice web front end that you wouldn't even need to use ASP for at all.

If you must create something home-grown with ASP, I would use nmap to scan your class C subnet and then print the results in your ASP page. This isn't a very efficient method, but it would be very simple and be pretty much guaranteed to work (with appropriate options).

Hope this helps you.