Realtime server status page - slow on refresh

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ghostface
    New Member
    • Jul 2007
    • 13

    Realtime server status page - slow on refresh

    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
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    How or where does perl come into the problem? You mention CGI, but that is not perl. How are you currently pinging your servers?

    Comment

    • ghostface
      New Member
      • Jul 2007
      • 13

      #3
      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.xx x';
      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.

      Comment

      • KevinADC
        Recognized Expert Specialist
        • Jan 2007
        • 4092

        #4
        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.

        Comment

        • miller
          Recognized Expert Top Contributor
          • Oct 2006
          • 1086

          #5
          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

          Comment

          • ghostface
            New Member
            • Jul 2007
            • 13

            #6
            Hi Guys,
            Thanks for the reply. Yes, I made a separate process.
            Works a lot better now. Thanks for the help everyone.

            Comment

            • miller
              Recognized Expert Top Contributor
              • Oct 2006
              • 1086

              #7
              Kudos. Well done.

              - Miller

              Comment

              Working...