Network monitor script

Hi,

Although I'm not at my nature habitat, I need some assistance in having a basic windows script to monitor TCP connections from a host to other hosts.
script heed to display the following:

  1. ping a remote host/hosts every 1 second (or other adjustable timer)
  2. Display a fail/success.
  3. time stamp.
  4. write into a log file
  5. create a new log file each hour.

A power shell script is acceptable, i'm a newbe in PowerShell
thanks

There are several ways to do this.

  • you can set ping to the interval and process the output, perhaps for each hour so you can switch logs.
  • you can call ping every interval for one ping and process the output. You can regenerate the log file name on each pass.
  • You can send part of your script to the far end using ssh, and send a small message every interval. To switch logs, you might limit the runs to an hour. For a full duplex check it might just be 'ssh there cat', so the messages go up and back.
  • You can go to C/C++/Java/PERL/Python so the log switch is easier to detect and implement. You might even make it a free standing pipe fitting for just that. Scripts are harder to make blockage sensitive, compared to poll(). You could just write a ping output watcher. It might be a good time to use aio (asynchronous I O), so you can check progress without blocking any thread/process.

Eventually I had used a "netstat" command within a script.