LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-05-2013, 04:14 AM   #1
devUnix
Member
 
Registered: Oct 2010
Posts: 606

Rep: Reputation: 59
Server is Pinging But Not Connecting


Hi,


Let's say we have a Linux / UNIX server example1.com which is responding to a ping request but when we try to connect to it through ssh or telnet, it does not respond. Similarly we have a Windows server example2.com and it responds to a ping request successfully (0% packets loss), but we can't connect to it through RDP.

Does it mean the servers are in a hung state? Can a server still respond (successfully) to a ping request while it is dying?

If yes, then consider a production environment wherein we have 100 UNIX and Windows servers and we want to make sure that they are alive. I usually write a shell script which ping(s) each of them and if a green signal is returned, I ignore this node otherwise an email alert is sent to the admin / concerned group.

(This is critical because we have other services such as Databases running on the servers and if the servers are pinging but are not actually functioning properly then the services are likely to be impacted.)

Last edited by devUnix; 03-05-2013 at 04:16 AM.
 
Old 03-05-2013, 04:57 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
A half dead server can certainly often respond to ICMP but not open TCP connections, but there's no 100% guarantee that that's what's the case. Maybe the ssh service itself has just frozen, or a firewall was updated
 
Old 03-05-2013, 06:20 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,849

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
imagine, a single network card without running OS can answer to the ping request, so ping is not reliable for this purpose. also a firewall can block any port or protocol. If you want to be sure I suggest you to create-install your own health check service on all your hosts and ask that service about the state.
 
2 members found this post helpful.
Old 03-05-2013, 06:39 AM   #4
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Quote:
Originally Posted by devUnix View Post
consider a production environment wherein we have 100 UNIX and Windows servers and we want to make sure that they are alive. I usually write a shell script which ping(s) each of them and if a green signal is returned, I ignore this node otherwise an email alert is sent to the admin / concerned group.
Just checking ping is nowhere near enough to determine if a host is down or not. As previous posters have indicated a host can reply to pings while other services are impacted, conversly firewall configurations could prevent the host from responding to pings while other services are unaffected.

You need to define what services you are expecting on each of your hosts and check them accordingly.

Rather than a single script you might want to consider a monitoring suite, my personal preference is nagios but I'm sure others will have their own opinions.
 
Old 03-05-2013, 06:40 AM   #5
devUnix
Member
 
Registered: Oct 2010
Posts: 606

Original Poster
Rep: Reputation: 59
Quote:
Originally Posted by pan64 View Post
create-install your own health check service on all your hosts and ask that service about the state.
To make sure I got your point exactly, let me put it this way:

I put a script on server_1, server_2, and server_n and let the script on each of these servers create a log at some common place let's say logging_server:\var\log\myLogs\servers_health.log and then see if I get logs/answers from all the named servers or not?
 
Old 03-05-2013, 06:56 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,849

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
No, not really. A small daemon process which will listen on a given port and will reply to the central host. Something like "are you ok?" "yes/no/whatever".
The daemon process knows on every and each host how to check if it works well and runs some test periodically.

But also you can try to write a log on a common filesystem and check those logs...
 
Old 03-05-2013, 07:03 AM   #7
devUnix
Member
 
Registered: Oct 2010
Posts: 606

Original Poster
Rep: Reputation: 59
Quote:
Originally Posted by acid_kewpie View Post
A half dead server can certainly often respond to ICMP but not open TCP connections
How do we make sure that a particular Port is opened only when the server is alive?

Quote:
Originally Posted by pan64;

A small daemon process which will listen on a given port and will reply to the central host. Something like "are you ok?" "yes/no/whatever".
The daemon process knows on every and each host how to check if it works well and runs some test periodically.

What Port number do you suggest?
 
Old 03-05-2013, 07:34 AM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,849

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
Quote:
Originally Posted by devUnix View Post
How do we make sure that a particular Port is opened only when the server is alive?
It costs so much (to check all the other ports are closed). nmap can do that for you.


Quote:
Originally Posted by devUnix View Post
What Port number do you suggest?
I suggest you to select any port which will not conflict with your configuration, 9563 or 34712 can also be used.
 
Old 03-05-2013, 07:43 AM   #9
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Quote:
Originally Posted by pan64 View Post
No, not really. A small daemon process which will listen on a given port and will reply to the central host. Something like "are you ok?" "yes/no/whatever".
Why re-invent something that already exists? Most distros now come with an extendable SNMP daemon.
 
1 members found this post helpful.
Old 03-05-2013, 07:48 AM   #10
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Quote:
Originally Posted by TenTenths View Post
Why re-invent something that already exists? Most distros now come with an extendable SNMP daemon.
Yeah, I'm baffled at the discussion too. There are loads of monitoring solutions that already exist in all sorts of forms.
 
1 members found this post helpful.
Old 03-05-2013, 07:29 PM   #11
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
As with the others; if this is a serious prod qn, get monitoring tool eg nagios, zabbix, zenoss, opennms etc etc.
I wouldn't write your own for 100 systems.

Re ping: that just tests the network cxn to the remote host's network stack.
Tells you nothing about the state of rest of the system/services.
 
Old 03-05-2013, 11:57 PM   #12
devUnix
Member
 
Registered: Oct 2010
Posts: 606

Original Poster
Rep: Reputation: 59
Thanks to all of you for your inputs!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Pinging and connecting between subnets TooMad Linux - Networking 6 12-04-2009 02:33 PM
Pinging All the Nodes Connected to the Server Hi_This_is_Dev Linux - Newbie 1 05-15-2009 09:43 AM
pinging smb server by name returns 127.0.0.1 starmonche Linux - Networking 6 08-10-2007 05:40 AM
Pinging Fedora Server?? OneManOfBits Linux - Newbie 2 04-12-2007 06:51 PM
pinging but not connecting bruse Linux - Networking 1 02-26-2005 07:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration