Connecting Tech Pros Worldwide Forums | Help | Site Map

Realtime server status page - slow on refresh

Newbie
 
Join Date: Jul 2007
Posts: 14
#1: Jul 5 '07
I'm new to perl. And I studied it because I really need to use CGI on my project. I have a website which pings my 10 VMware servers, now I display the status of the servers on a webpage. (online or offline) ..I use autorefresh on the page but it loads too long.

1.) Is there anyway to resolve this? Is there anyway that I can just loop the ping commands and not refresh the whole page?

2.) through the site, also I want to run a bat file on my webserver. The bat file will open or close my VMware servers. Is this possible?

Any comments/suggestions is very much appreciated. Thanks much.. =)

KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#2: Jul 5 '07

re: Realtime server status page - slow on refresh


How or where does perl come into the problem? You mention CGI, but that is not perl. How are you currently pinging your servers?
Newbie
 
Join Date: Jul 2007
Posts: 14
#3: Jul 6 '07

re: Realtime server status page - slow on refresh


I studied CGI because I need to run a remote file, and most common tutorials in CGI used perl programming.. So I practiced some perl and used it to ping my servers. Specifically, Net::Ping.. Here is my code.

use Net::Ping;

my $ip1 = 'xxx.xxx.xxx.xxx';
my $p = Net::Ping->new();
print "Server Online\n"
if $p->ping($ip1);
$p->close();
print "Server Offline\n"
unless $p->ping($ip1);
$p->close();

It works for me but I'm not really sure if I'm doing it right. I'm still a beginner with perl. Another is running a remote file. Is there a way to do that in perl? Thanks again.
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#4: Jul 6 '07

re: Realtime server status page - slow on refresh


The pinging looks OK to me. As far as running a remote file goes, you can look into stuff like Telnet and SSH, both of which you will find on CPAN in the NET class of modules, just like ping.
miller's Avatar
Moderator
 
Join Date: Oct 2006
Location: San Francisco, CA
Posts: 830
#5: Jul 6 '07

re: Realtime server status page - slow on refresh


I understand that this is probably beyond the scope of your experience, but what you have to realize is that pinging a server is a time intensive operation. Especially if you're doing a lot of them, or if even one doesn't respond.

If you want the webpage to be responsive, you're going to have to have to create a separate process that will cache the results of the status checks so that the website only has to display the lastest checked status.

- Miller
Newbie
 
Join Date: Jul 2007
Posts: 14
#6: Jul 18 '07

re: Realtime server status page - slow on refresh


Hi Guys,
Thanks for the reply. Yes, I made a separate process.
Works a lot better now. Thanks for the help everyone.
miller's Avatar
Moderator
 
Join Date: Oct 2006
Location: San Francisco, CA
Posts: 830
#7: Jul 18 '07

re: Realtime server status page - slow on refresh


Kudos. Well done.

- Miller
Reply