3 #from time import sleep
5 from datetime import datetime
10 BE_PORT="<%= @be_port %>"
11 PROTOCOL="<%= @protocol %>"
24 ##############################
26 ##############################
28 command="curl -k -s -o /dev/null -I -w \"%{http_code}\" -i "+PROTOCOL+"://" + BE_IP + ":" + BE_PORT + "/sdc2/rest/v1/user/jh0003"
30 proc = subprocess.Popen( command , shell=True , stdout=subprocess.PIPE )
31 (out, err) = proc.communicate()
33 return str(result, "UTF-8")
35 ##############################
37 ##############################
40 myResult = checkBackend()
42 print('[INFO]: Backend is up and running')
46 currentTime = datetime.now()
47 print('[ERROR]: ' + currentTime.strftime('%Y/%m/%d %H:%M:%S') + bcolors.FAIL + ' Backend not responding, try #' + str(i) + bcolors.ENDC)
51 print '[ERROR]: ' + time.strftime('%Y/%m/%d %H:%M:%S') + bcolors.FAIL + 'Backend is DOWN :-(' + bcolors.ENDC