This commit is contained in:
parent
4a5060c7ae
commit
8509269085
@ -12,7 +12,7 @@ class AppriseClient:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.config = ''
|
self.config = ''
|
||||||
try:
|
try:
|
||||||
if os.environ["DOCKER"]:
|
if os.get["DOCKER"]:
|
||||||
self.host = os.environ["host"]
|
self.host = os.environ["host"]
|
||||||
self.port = os.environ["port"]
|
self.port = os.environ["port"]
|
||||||
self.aurls = os.environ["aurls"]
|
self.aurls = os.environ["aurls"]
|
||||||
|
@ -41,4 +41,10 @@ def get_script_runtime(self):
|
|||||||
if self.use_pushover:
|
if self.use_pushover:
|
||||||
self.extm = f"Execution time: [{elapsed_time}]"
|
self.extm = f"Execution time: [{elapsed_time}]"
|
||||||
if self.use_apprise:
|
if self.use_apprise:
|
||||||
self.extm = f"Execution time: [{elapsed_time}]"
|
self.extm = f"Execution time: [{elapsed_time}]"
|
||||||
|
|
||||||
|
def send_ping(self, req_obj, healthcheck_url):
|
||||||
|
try:
|
||||||
|
req_obj.get(healthcheck_url, timeout=10)
|
||||||
|
except req_obj.RequestException as e:
|
||||||
|
self.tl.info(f"Ping failed: {e}")
|
4
crane.py
4
crane.py
@ -54,6 +54,8 @@ class Crn:
|
|||||||
#containers
|
#containers
|
||||||
self.observed_containers = list(self.config["containers"].values())
|
self.observed_containers = list(self.config["containers"].values())
|
||||||
self.container_statuses = ["paused","dead","created","exited","removing","restarting","created"]
|
self.container_statuses = ["paused","dead","created","exited","removing","restarting","created"]
|
||||||
|
#healthcheck
|
||||||
|
self.healthcheck_url = self.config["healthcheck"]["healthcheck_url"]
|
||||||
|
|
||||||
cont_log(self)
|
cont_log(self)
|
||||||
cont_notify(self)
|
cont_notify(self)
|
||||||
@ -80,6 +82,8 @@ class Crn:
|
|||||||
cont_notify_summary(self, apprise_notify, requests)
|
cont_notify_summary(self, apprise_notify, requests)
|
||||||
if self.use_apprise:
|
if self.use_apprise:
|
||||||
cont_notify_summary(self, apprise_notify, requests)
|
cont_notify_summary(self, apprise_notify, requests)
|
||||||
|
send_ping(self, requests, self.healthcheck_url)
|
||||||
|
|
||||||
# Run
|
# Run
|
||||||
if __name__== "__main__":
|
if __name__== "__main__":
|
||||||
Crn()
|
Crn()
|
Loading…
x
Reference in New Issue
Block a user