system.util.getGatewayStatus
This function is used in Python Scripting.
Description​
Returns a string that indicates the status of a Gateway. A status of RUNNING means the Gateway is fully functional. If an exception occurs, the function returns ERROR with the associated error message appended. This function can be used to test the availability and operational state of a remote Gateway.
Client Permission Restrictions​
This scripting function has no Client Permission restrictions.
Syntax​
system.util.getGatewayStatus(gatewayAddress, [connectTimeoutMillis], [socketTimeoutMillis])
Parameters​
| Type | Parameter | Description |
|---|---|---|
| String | gatewayAddress | The Gateway address to ping, in the form of ADDR:PORT. |
| Integer | connectTimeoutMillis | The maximum time in milliseconds to attempt to initially contact a Gateway. [optional] |
| Integer | socketTimeoutMillis | The maximum time in milliseconds to wait for a response from a Gateway after initial connection has been established. [optional] |
| Boolean | bypassCertValidation | If the target address is an HTTPS address, and this parameter is True, the system will bypass all SSL certificate validation. This is not recommended, though is sometimes necessary for self-signed certificates. |
Returns​
String - A string that indicates the status of the Gateway. A status of RUNNING means that the Gateway is fully functional.
Scope​
Gateway, Vision Client, Perspective Session
Code Examples​
Example #1
REMOTE_GATEWAY = "10.20.6.253:8088"
def check_remote_gateway(address=REMOTE_GATEWAY):
try:
status = system.util.getGatewayStatus(address)
except Exception as err:
print "Error checking Gateway status for {0}: {1}".format(address, err)
return
if status == "RUNNING":
print "Central Gateway is available!"
else:
print "Central Gateway status: {0}".format(status)
# Run asynchronously so the call doesn't block the calling thread (UI/gateway event thread).
system.util.invokeAsynchronous(check_remote_gateway)