Commit c6187066 authored by jithu.tagore's avatar jithu.tagore

Update infra_as_service_monitor.py

parent 3ae850e7
......@@ -197,24 +197,24 @@ def docker_container():
time=(end_date.astimezone(datetime.timezone.utc) - start_date.astimezone(datetime.timezone.utc)).total_seconds()
if time>3600:
time=time/3600
if int(time)>1:
timing=str(int(time))+" Hours"
if round(time)>1:
timing=str(round(time))+" Hours"
else:
timing=str(int(time))+" Hour"
timing=str(round(time))+" Hour"
elif time<60:
if int(time)>1:
timing=str(int(time))+" Seconds"
if round(time)>1:
timing=str(round(time))+" Seconds"
else:
timing=str(int(time))+" Second"
timing=str(round(time))+" Second"
elif time>60:
time=time/60
if int(time)>1:
timing=str(int(time))+" Minutes"
if round(time)>1:
timing=str(round(time))+" Minutes"
else:
timing=str(int(time))+" Minutes"
timing=str(round(time))+" Minutes"
data.append([container.name, container.id, container.attrs["State"]["Status"],timing])
......@@ -235,24 +235,24 @@ def docker_container():
time=(end_date.astimezone(datetime.timezone.utc) - start_date.astimezone(datetime.timezone.utc)).total_seconds()
if time>3600:
time=time/3600
if int(time)>1:
timing=str(int(time))+" Hours"
if round(time)>1:
timing=str(round(time))+" Hours"
else:
timing=str(int(time))+" Hour"
timing=str(round(time))+" Hour"
elif time<60:
if int(time)>1:
timing=str(int(time))+" Seconds"
if round(time)>1:
timing=str(round(time))+" Seconds"
else:
timing=str(int(time))+" Second"
timing=str(round(time))+" Second"
elif time>60:
time=time/60
if int(time)>1:
timing=str(int(time))+" Minutes"
if round(time)>1:
timing=str(round(time))+" Minutes"
else:
timing=str(int(time))+" Minutes"
timing=str(round(time))+" Minutes"
data.append([each.name, each.id, each.attrs["State"]["Status"],timing])
except Exception as e:
logger.info(e)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment