• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to Ping Multiple Servers

 
Sri Anand
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Our application went to production machine recently, we are seeing a potential problem like we are dependent on upto 5 servers to get application going ( 2 webservers, 1 email server, 1 business object server, 2 database servers).
Is there any way i can check if all the servers are up and running before i let the user do anything after loggin in ?We want to check proactively if any of the servers are down keep the user informed
Any Ideas ?
 
Scott Selikoff
author
Bartender
Posts: 4033
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mean actually Ping the machine or check if the ejb server is up? If its the former, Ping is only supported as of java 1.5 or 1.6 (not 1.4). Although you can to a faux ping by checking if common services like ftp/ssh are up. For the former just connect to a dummy servlet.
 
Paul Clapham
Sheriff
Posts: 21886
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So... you check that everything is A-OK, then you let the user sign in. Two minutes later, one of the servers fails. Now what?
 
Sri Anand
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The other purpuse is by pining we also know which server has problem and fix it quickly, all of them are not EJB servers, we have 2 Orion servers 2 Oracle servers and 1 business object server and 1 email server, We would want to programatically ping and log status of each server
By ping i really mean to check the status of server if it Up of not
[ July 02, 2008: Message edited by: Raghunandan Mamidala ]
 
Paul Clapham
Sheriff
Posts: 21886
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there only one user? And is that user the one who will fix the problems when they occur? If not, then it should be the responsible person who is notified of problems, not the user.

And frankly if it were me, I would be approaching this problem by trying to arrange things so that the servers in question don't crash very often. If the situation is such that you have to warn users not to use the system, you should be fixing the problems rather than setting up systems to provide early warnings to the users.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd use monitoring software for this purpose (google for "server monitoring"). It can access each server periodically in a manner that's appropriate for that server (HTTP for the web server, SMTP/POP3 for the email server etc.), and notify someone via email, SMS or beeper if there's a problem. In all likelihood that'd be more reliable than something homegrown.
[ July 02, 2008: Message edited by: Ulf Dittmer ]
 
Ahmed Altashi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've done something similar to what your mentioning. I needed to create a page that shows the status of pre defined servers and ports for each server.

my objective could be different then yours but it's the same idea.

what i did is that i created two java pojo classes one called server and the other called ports each with variables like name and ip address/port address and status etc..

then i created a servlet that pings each ip address. The set of ip address(objects of server class) are defined in the contextListener. the servlet provides only the method of pinging the ip address and it's ports. Then in the jsp page i looped through all the ips and the ports.

Later on i figured that it wasn't a good idea. The page takes around 10 seconds to load and if i add more servers or ports it will take even more time.

I'm thinking about modifying the servlet to return a value (up/down) and then fire multiple calls to the servlet to speed up the process. it's a fake multi-threading approach.

anyway .. have a look at this:
http://java.sun.com/j2se/1.4.2/docs/api/java/net/InetAddress.html

and this:
http://www.rgagnon.com/javadetails/java-0093.html
 
Ahmed Altashi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i just noticed the date .. mar 2005
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ahmed Altashi:
Later on i figured that it wasn't a good idea. The page takes around 10 seconds to load and if i add more servers or ports it will take even more time.

Maybe a better approach would be to run the pinging of all the servers as a background thread periodically -say every N minutes- and save the results, and then hitting the servlet would merely create a page that reports on those results.

The servlet could even store the results of the last 24 hours or so, which would be information that might come in handy.

Thinking further, the background job could fire off an email to someone if any service is unreachable for more than X pings in a row.

i just noticed the date .. mar 2005

What's from March 2005?
[ August 09, 2008: Message edited by: Ulf Dittmer ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!