|
@@ -1,16 +1,20 @@
|
|
|
+import os
|
|
|
+
|
|
|
+import requests
|
|
|
from flask import Flask
|
|
|
from flask import jsonify
|
|
|
-import requests
|
|
|
from flask_cors import CORS, cross_origin
|
|
|
|
|
|
+
|
|
|
def get_result():
|
|
|
services_up = 0
|
|
|
failure_list = []
|
|
|
returnResponse = {"style":"", "title":"", "content":""}
|
|
|
- statping_endpoint = "http://192.168.81.253:8085/api/services/"
|
|
|
+ statping_endpoint = os.getenv('STATPING_ENDPOINT')
|
|
|
|
|
|
try:
|
|
|
- response = requests.get(statping_endpoint, verify=False)
|
|
|
+ print('%sapi/services/' % statping_endpoint)
|
|
|
+ response = requests.get('%sapi/services/' % statping_endpoint, verify=False)
|
|
|
# If we get a response
|
|
|
if response.status_code == 200:
|
|
|
# Get the total number of services returned
|
|
@@ -29,7 +33,7 @@ def get_result():
|
|
|
# if so, return a success object
|
|
|
returnResponse["style"] = "is-success"
|
|
|
returnResponse["title"] = "All good in the hood boss"
|
|
|
- returnResponse["content"] = "<b>%s / %s Services showing as online. Check <a href=http://192.168.88.50:8085/ target=_blank>here</a> for more info. </br> <p>"%(services_up, total_services)
|
|
|
+ returnResponse["content"] = "<b>%s / %s Services showing as online. Check <a href=%s target=_blank>here</a> for more info. </br> <p>" % (services_up, total_services, statping_endpoint)
|
|
|
|
|
|
return(returnResponse)
|
|
|
else:
|
|
@@ -41,7 +45,7 @@ def get_result():
|
|
|
for i in failure_list:
|
|
|
numptyList += "<li>" + i + "</li>"
|
|
|
numptyList += "</ul>"
|
|
|
- returnResponse["content"] = "<b>%s / %s Services showing as online. Check <a href=http://192.168.88.50:8085/ target=_blank>here</a> for more info. </br> <p> <br>Here are the numpties that are letting the side down:</br> %s"%(services_up, total_services, numptyList)
|
|
|
+ returnResponse["content"] = "<b>%s / %s Services showing as online. Check <a href=%s target=_blank>here</a> for more info. </br> <p> <br>Here are the numpties that are letting the side down:</br> %s" % (services_up, total_services, numptyList, statping_endpoint)
|
|
|
|
|
|
return(returnResponse)
|
|
|
|