Skip to main content
Version: 8.1

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​

TypeParameterDescription
StringgatewayAddressThe Gateway address to ping, in the form of ADDR:PORT.
IntegerconnectTimeoutMillisThe maximum time in milliseconds to attempt to initially contact a Gateway. [optional]
IntegersocketTimeoutMillisThe maximum time in milliseconds to wait for a response from a Gateway after initial connection has been established. [optional]
BooleanbypassCertValidationIf 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)