views:

74

answers:

5

I am trying to create some HTML which shows me if my server is available from the internet, green light OK red light unavailable. This I can do for a remote site but not for my home, my router seems to prevent me from returning to home via my static IP address. I want to create some HTML so that I see how I look from my ISP not my own LAN, more specifically, I want the boss in Paris to know if the Paris server is up and running.

<html>
<head><script language='JavaScript'>
// Begin
  function MyErr4(MyImage) {
      setTimeout(function() {       
        document.light4.src = 'http://www.myisp.uk/red.jpg';
      },300);
  }
// end
</script>

<img name='light4' src='http://mystaticip/2_lime.jpg'
    onerror='MyErr4(this)' border='0' width='30' />

does not work because I am running it inside my own LAN. How can I write some code that gets resolved at my ISP. I tried ASP but the Javascript gets resolved clientside.

Anybody like to comment please?

+1  A: 

You are attacking the problem on the wrong angle.

Any code in a page is going to be executed client side, by definition.

If you need something executed somewhere else, you need an external server at that other place. That can be a very simple http server that you could query with XMLHttpRequest on you page, or something more fancy that will render the full status page.

As suggested in another answer, you should consider running Nagios on a third party server.

ddaa
+1  A: 

Have you considered using an existing application like Nagios instead of writing your own tool? I guarantee it will offer more features and work much better. For example, you can test whether the web server returns a status code 500 (or other errors) which might indicate a database is overloaded, instead of just checking to see if it will respond to requests.

Marc Charbonneau
Not heard of it but I will certainly check it out, thanks
my servers and clients are all windows W2000, and my reading of NAGIOS (which looks good) is that it is Linux or similar only at this time
Nagios does run on *nix, but there are plugins which allow it to monitor Windows servers which work very well. If you administer your own servers you could set up a lightweight virtualized *nix server to run it, which is what I do at work.
Marc Charbonneau
+1  A: 

Do you know for sure that your server can respond to requests from outside the LAN? It sounds like this is a routing/firewall problem, not a code problem. Typically for most home networks you would enable port forwarding on your router to send requests from outside the firewall to the correct IP within the firewall.

Jason
HI Jason. I have port forwarding on and the same code shows me green if run from Paris but not if run from UK. My previous router was OK with this, but my LinkSys has a problem with seeing itself outgoing with internal address and incoming with external address
A: 

Symptom: "Other people can reach my server, but I can't view it locally."

Problem: You have a Loopback Connection Error.

Read the link and their solution. See if that helps.

Jeffrey Martinez
thanks Jeffrey, good suggestion
Sure thing, that loopback connection error drove me nuts once up on a time.
Jeffrey Martinez
loopback seems to redirect image request within LAN and does not actually test HTTP service availability from the WWW. I see that it would make the script work but not actually test the condition I seek. Thanks anyway.
A: 

I am sorry but I have not fully understood your answer. Can you illustrate an XMLHttpRequest for me or is that good enough keyword for google to tell me all. What would "something more fancy" entail? regards

Your replies must be made as comments so the person you reply to is notified.
PhiLho