|
|
@ -28,10 +28,10 @@ def GetNodeList(apiEndpoint, secret):
|
|
|
|
return None
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def RegisterRecord(apiEndpoint, secret, agentId, nodeId, lantency):
|
|
|
|
def RegisterRecord(apiEndpoint, secret, agentId, nodeId, latency):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
response = requests.get(apiEndpoint + '/registerRecord?secret=' +
|
|
|
|
response = requests.get(apiEndpoint + '/registerRecord?secret=' +
|
|
|
|
secret+'&agentId='+agentId+'&nodeId='+nodeId+'&lantency='+lantency)
|
|
|
|
secret+'&agentId='+agentId+'&nodeId='+nodeId+'&latency='+latency)
|
|
|
|
if not response.status_code == 200:
|
|
|
|
if not response.status_code == 200:
|
|
|
|
raise Exception('Error registering record')
|
|
|
|
raise Exception('Error registering record')
|
|
|
|
except Exception as e:
|
|
|
|
except Exception as e:
|
|
|
@ -62,10 +62,10 @@ if nodeList == None:
|
|
|
|
# Ping nodes
|
|
|
|
# Ping nodes
|
|
|
|
for node in nodeList:
|
|
|
|
for node in nodeList:
|
|
|
|
print('Pinging ' + node['hostname'])
|
|
|
|
print('Pinging ' + node['hostname'])
|
|
|
|
lantency = ping(node['hostname'], unit='ms')
|
|
|
|
latency = ping(node['hostname'], unit='ms')
|
|
|
|
if lantency == None or lantency == False:
|
|
|
|
if latency == None or latency == False:
|
|
|
|
lantency = -1
|
|
|
|
latency = -1
|
|
|
|
lantency = int(lantency)
|
|
|
|
latency = int(latency)
|
|
|
|
print('Lantency: ' + str(lantency))
|
|
|
|
print('latency: ' + str(latency))
|
|
|
|
RegisterRecord(args.apiEndpoint, args.secret,
|
|
|
|
RegisterRecord(args.apiEndpoint, args.secret,
|
|
|
|
str(agentId), str(node['id']), str(lantency))
|
|
|
|
str(agentId), str(node['id']), str(latency))
|
|
|
|