# Python Check remote webpage availavle

**URL:** <https://forum.inductiveautomation.com/t/python-check-remote-webpage-availavle/3171>\
**Category:** Ignition\
**Created:** [August 10, 2011, 8:13pm UTC](https://forum.inductiveautomation.com/t/python-check-remote-webpage-availavle/3171 "2011-08-10T20:13:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![focus-eng](https://avatars.discourse-cdn.com/v4/letter/f/fbc32d/32.png) [@focus-eng](https://forum.inductiveautomation.com/u/focus-eng)\
**Post date:** [August 10, 2011, 8:13pm UTC](https://forum.inductiveautomation.com/t/python-check-remote-webpage-availavle/3171/1 "2011-08-10T20:13:29Z")

</div>

Dear Board Members

I have a redundant ignition server setup and would like to display an alarm if one of the nodes if offline  
I didn’t find anything in ignition to check the redundancy state to create an alarm.  
my idea now was to check if the webpage of the other node is available using python.  
However when i run the following code it complains about the HTTPConnection part in the code

```auto
import httplib
conn = httplib.HTTPConnection("www.python.org")
conn.request("HEAD", "/")
r1 = conn.getresponse()
print r1.status, r1.reason
```

My question is: is the python library complete in ignition or are bits missing.

Has anyone another idea of solving my problem.  
I did try the ping route through java but firewall is blocking this even when ICMP is in the exception list.

Thanks in advance guys  
Regards  
Sascha  
P.S.: it would be nice to have a system tag available to show other redundant nodes configured and to see if they are active.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [August 11, 2011, 10:06am UTC](https://forum.inductiveautomation.com/t/python-check-remote-webpage-availavle/3171/2 "2011-08-11T10:06:07Z")

</div>

Try this:

[code]success=1

try:  
source = system.net.httpGet(“[http://www.python.org](http://www.python.org)”)  
except IOError:  
success=0

print success  
[/code]

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [August 11, 2011, 3:35pm UTC](https://forum.inductiveautomation.com/t/python-check-remote-webpage-availavle/3171/3 "2011-08-11T15:35:47Z")

</div>

> [@](#):
>
> P.S.: it would be nice to have a system tag available to show other redundant nodes configured and to see if they are active.

Definitely... we're hoping to get this into 7.3 (with many other gateway status tags). Don't know if it'll be in there for the first release, but sometime soon after.

Regards,

---

<div class="post-metadata">

**Author:** ![focus-eng](https://avatars.discourse-cdn.com/v4/letter/f/fbc32d/32.png) [@focus-eng](https://forum.inductiveautomation.com/u/focus-eng)\
**Post date:** [August 11, 2011, 8:22pm UTC](https://forum.inductiveautomation.com/t/python-check-remote-webpage-availavle/3171/4 "2011-08-11T20:22:29Z")

</div>

i was hoping on not using the httpget, since it will retrieve the whole page.  
I was hoping to just retrieve the header for status 200 (OK) vs 404 etc. (Not o.k.), that way i could check every say 10 seconds without too much comms overhead.

If i am retrieving the Webpage fully could one look at the status page of the master node, which should also have information of the backup node.  
i know one can search through the http responce in python and find the text “Master - active” and “Slave - Active” indicating everything is o.k. However my skills for that seem to be limited as i got nowhere with that one.  
Any ideas on that?

Regards  
Sascha

---

<div class="post-metadata">

**Author:** ![focus-eng](https://avatars.discourse-cdn.com/v4/letter/f/fbc32d/32.png) [@focus-eng](https://forum.inductiveautomation.com/u/focus-eng)\
**Post date:** [August 11, 2011, 8:30pm UTC](https://forum.inductiveautomation.com/t/python-check-remote-webpage-availavle/3171/5 "2011-08-11T20:30:56Z")

</div>

Colby while on the subject for inlcuding more status information.  
a system.gateway function section would be nice which includes  
system.gateway.status which returns a dataset of the configured nodes and their status.  
system.gateway.devices , returns dataset of configured devices with their status e.g. connected etc  
system.gateway.opcstatus (same as system.opc.getconnection)

am sure there is plenty more that could be included and others may want too.

This then could also be used to generate alarms which can be emailed and displayed.  
Actually a drag in component for a system page with all of the above would be even nicer. lol. asking too much here now.

Kind Regards  
Sascha

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [September 8, 2011, 6:07pm UTC](https://forum.inductiveautomation.com/t/python-check-remote-webpage-availavle/3171/6 "2011-09-08T18:07:26Z")

</div>

Perhaps the StatusPing servlet on the gateway would help you?

Try using the [system.net.httpGet](http://www.inductiveautomation.com/support/usermanuals/ignition/indexhtml?system_net_httpget.htm) function with the url:

[tt][http://server.address:8088/main/StatusPing[/tt]](http://server.address:8088/main/StatusPing%5B/tt%5D)

This will give you a JSON-encoded representation of the gateway’s status.
