The script should read from a file the list of hosts and ports to check.
For each line, the script should check TCP network connectivity between the server it's running on and that host:port combination and, in case it fails, find out the reason.
Possible results for a check:
- DNS record does not exist. (cannot resolve hostname)
- Service not running (remote host is not listening on that port)
- Connection rejected (remote host is listening on that port but network connection is rejected)
- Timeout (remote host is listening on that port but network connection is timing out)
Script's output will consist on a list of checks, results and the time it took for each one of them.
server-1.dev.internal:443 | Success | 3.4s
server-2.prod.internal:25 | Service not running | 0.2s
Note: Script is expecting a text file and is executed as: ./script_name <path-to-file>