Python Check remote webpage availavle

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

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.

Try this:

[code]success=1

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

print success
[/code]

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,

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

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

Perhaps the StatusPing servlet on the gateway would help you?

Try using the system.net.httpGet function with the url:

[tt]http://server.address:8088/main/StatusPing[/tt]

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