Guest User

Untitled

a guest
Jan 6th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.39 KB | None | 0 0
  1. #!/bin/sh
  2. echo "Performing Health Checks .........."
  3. status=false;
  4. retries_allowed=25
  5. print_status(){
  6. if [ "$1" != true ]
  7. then
  8. echo -en "\033[u Failed\n"
  9. else
  10. echo -en "\033[u Passed\n"
  11. fi
  12. }
  13. print_status_pos(){
  14. if [ "$3" != true ]
  15. then
  16. echo -en "\033[$1A \033[$2CFailed"
  17. else
  18. echo -en "\033[$1A \033[$2CPassed"
  19. fi
  20. }
  21.  
  22. wait_count=$retries_allowed
  23. echo -en " Checking Config Server:\033[s"
  24. while [ "$status" != true ]
  25. do
  26. wget -q -O - ${PROTOCOL}://${CONFIG_HOSTNAME}:${CONFIG_PORT}/idpoauth/paas --user=${CONFIG_USERNAME} --password=${CONFIG_PASSWORD} --no-check-certificate >/dev/null 2>&1
  27. if [ $? -ne 0 ]
  28. then
  29. status="false"
  30. else
  31. status="true"
  32. print_status $status
  33. fi
  34. sleep 5
  35. wait_count=$((wait_count - 1))
  36. if [ "$wait_count" -eq "0" ]
  37. then
  38. print_status $status
  39. exit 1
  40. fi
  41. done
  42. status=false;
  43.  
  44. wait_count=$retries_allowed
  45. echo -en " Checking Eurkea Server:\033[s"
  46. while [ "$status" != true ]
  47. do
  48. wget -q -O - ${PROTOCOL}://${EUREKA_HOSTNAME}:${EUREKA_PORT}/ --no-check-certificate >/dev/null 2>&1
  49. if [ $? -ne 0 ]
  50. then
  51. status="false"
  52. else
  53. status="true"
  54. print_status $status
  55. fi
  56. sleep 5
  57. wait_count=$((wait_count - 1))
  58. if [ "$wait_count" -eq "0" ]
  59. then
  60. print_status $status
  61. exit 1
  62. fi
  63. done
  64. status=false;
  65.  
  66. wait_count=$retries_allowed
  67. echo -en " Checking Keycloak Server:\033[s"
  68. while [ "$status" != true ]
  69. do
  70. wget -q -O - ${PROTOCOL}://${KEYCLOAK_HOSTNAME}:${KEYCLOAK_PORT}/auth --no-check-certificate >/dev/null 2>&1
  71. if [ $? -ne 0 ]
  72. then
  73. status="false"
  74. else
  75. status="true"
  76. print_status $status
  77. fi
  78. sleep 5
  79. wait_count=$((wait_count - 1))
  80. if [ "$wait_count" -eq "0" ]
  81. then
  82. print_status $status
  83. exit 1
  84. fi
  85. done
  86. status=false;
  87.  
  88. wait_count=$retries_allowed
  89. echo -en " Checking Auth Server:\033[s"
  90. while [ "$status" != true ]
  91. do
  92. wget -q -O - ${PROTOCOL}://${OAUTH_HOSTNAME}:${OAUTH_PORT}/idp-oauth/login --no-check-certificate >/dev/null 2>&1
  93. if [ $? -ne 0 ]
  94. then
  95. status="false"
  96. else
  97. status="true"
  98. print_status $status
  99. fi
  100. sleep 5
  101. wait_count=$((wait_count - 1))
  102. if [ "$wait_count" -eq "0" ]
  103. then
  104. print_status $status
  105. exit 1
  106. fi
  107. done
  108. status=false;
  109.  
  110. wait_count=$retries_allowed
  111. echo -en " Checking Services Server:\033[s"
  112. while [ "$status" != true ]
  113. do
  114. wget -q -O - ${PROTOCOL}://${SERVICES_HOSTNAME}:${SERVICES_PORT}/idprest/swagger-ui.html --no-check-certificate >/dev/null 2>&1
  115. if [ $? -ne 0 ]
  116. then
  117. status="false"
  118. else
  119. status="true"
  120. print_status $status
  121. fi
  122. sleep 5
  123. wait_count=$((wait_count - 1))
  124. if [ "$wait_count" -eq "0" ]
  125. then
  126. print_status $status
  127. exit 1
  128. fi
  129. done
  130. status=false;
  131.  
  132. wait_count=$retries_allowed
  133. echo -en " Checking Subscription Server:\033[s"
  134. while [ "$status" != true ]
  135. do
  136. wget -q -O - ${PROTOCOL}://${SUBSCRIPTION_HOSTNAME}:${SUBSCRIPTION_PORT}/subscription/swagger-ui.html --no-check-certificate >/dev/null 2>&1
  137. if [ $? -ne 0 ]
  138. then
  139. status="false"
  140. else
  141. status="true"
  142. print_status $status
  143. fi
  144. sleep 5
  145. wait_count=$((wait_count - 1))
  146. if [ "$wait_count" -eq "0" ]
  147. then
  148. print_status $status
  149. exit 1
  150. fi
  151. done
  152. status=false;
  153.  
  154. wait_count=$retries_allowed
  155. echo -en " Checking Dashboard Server:\033[s"
  156. while [ "$status" != true ]
  157. do
  158. wget -q -O - ${PROTOCOL}://${DASHBOARD_HOSTNAME}:${DASHBOARD_PORT}/idpdashboard/1 --no-check-certificate >/dev/null 2>&1
  159. if [ $? -ne 0 ]
  160. then
  161. status="false"
  162. else
  163. status="true"
  164. print_status $status
  165. fi
  166. sleep 5
  167. wait_count=$((wait_count - 1))
  168. if [ "$wait_count" -eq "0" ]
  169. then
  170. print_status $status
  171. exit 1
  172. fi
  173. done
  174. status=false;
  175.  
  176. wait_count=$retries_allowed
  177. echo -en " Checking UI Server:\033[s"
  178. while [ "$status" != true ]
  179. do
  180. wget -q -O - ${PROTOCOL}://${IDPAPP_HOSTNAME}:${IDPAPP_PORT}/idpapp/ --no-check-certificate >/dev/null 2>&1
  181. if [ $? -ne 0 ]
  182. then
  183. status="false"
  184. else
  185. status="true"
  186. print_status $status
  187. fi
  188. sleep 5
  189. wait_count=$((wait_count - 1))
  190. if [ "$wait_count" -eq "0" ]
  191. then
  192. print_status $status
  193. exit 1
  194. fi
  195. done
  196. status=false;
  197.  
  198. wait_count=$retries_allowed
  199. echo -en " Checking CI Server:\033[s"
  200. while [ "$status" != true ]
  201. do
  202. wget -q -O - ${PROTOCOL}://${JENKINS_HOSTNAME}:${JENKINS_PORT}/jenkins --no-check-certificate >/dev/null 2>&1
  203. if [ $? -ne 0 ]
  204. then
  205. status="false"
  206. else
  207. status="true"
  208. print_status $status
  209. fi
  210. sleep 5
  211. wait_count=$((wait_count - 1))
  212. if [ "$wait_count" -eq "0" ]
  213. then
  214. print_status $status
  215. exit 1
  216. fi
  217. done
  218. status=false;
  219.  
  220. echo "All Health Checks Passed. IDP should be accessible at ${PROTOCOL}://${IDPAPP_HOSTNAME}:${IDPAPP_PORT}/idpapp/"
Add Comment
Please, Sign In to add comment