LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   check network connection between servers on a port (https://www.linuxquestions.org/questions/linux-newbie-8/check-network-connection-between-servers-on-a-port-4175506918/)

rug.roya 06-03-2014 01:14 PM

check network connection between servers on a port
 
Hi,

I've a requirement to check network connection between servers on a port (any port) and should return the result in the below format along with the response time its successful

Ex: myserver:443 | Success | 3.4s
myserver1:25 | Service not running | 0.2s

Can somebody please help me to achieve this in a bash script if possible. I'm new to Linux administration and got a requirement to work on this all of the sudden.

szboardstretcher 06-03-2014 01:27 PM

You could use nmap.. is the format that important?

Code:

nmap -sS -p 80 google.com

rug.roya 06-03-2014 01:41 PM

Thanks a lot for your quick reply.

Format is not important, but looking for to capture possible reasons for fail and response time.

Thanks for the support

chrism01 06-04-2014 05:59 AM

Try this http://linux.die.net/man/1/echoping for timings.
Its a little difficult to automate 'reasons for failure' without writing a script.
I also highly recommend you bookmark/read this http://rute.2038bug.com/index.html.gz

You should also look into ping, tcptraceroute etc.
There are many tools for measuring network performance and checking if something is listening eg telnet client is good for quick n dirty checks.

See www.linuxtopia.org for free to read manuals.


All times are GMT -5. The time now is 03:41 AM.