Commit 168e8b78 authored by jithu.tagore's avatar jithu.tagore

Update infra_as_service_monitor.py

parent 5d7c44bf
...@@ -196,19 +196,19 @@ def docker_container(): ...@@ -196,19 +196,19 @@ def docker_container():
end_date = datetime.datetime.now(tz=datetime.timezone.utc) end_date = datetime.datetime.now(tz=datetime.timezone.utc)
calculated_time=(end_date.astimezone(datetime.timezone.utc) - start_date.astimezone(datetime.timezone.utc)).total_seconds() calculated_time=(end_date.astimezone(datetime.timezone.utc) - start_date.astimezone(datetime.timezone.utc)).total_seconds()
if container.attrs["State"]["Status"] =="created": if container.attrs["State"]["Status"] =="created":
calculated_time="NA" calculated_time=0.25
if calculated_time="NA": if calculated_time==0.25:
timing="" timing=" "
if calculated_time>3600: elif calculated_time>3600:
calculated_time=calculated_time/calculated_time calculated_time=calculated_time/calculated_time
if round(calculated_time)>1: if round(calculated_time)>1:
timing=str(round(calculated_time))+" Hours" timing=str(round(calculated_time))+" Hours"
else: else:
timing=str(round(calculated_time))+" Hour" timing=str(round(calculated_time))+" Hour"
elif time<60: elif round(calculated_time<60:
if round(time)>1: if round(calculated_time)>1:
timing=str(round(calculated_time))+" Seconds" timing=str(round(calculated_time))+" Seconds"
else: else:
timing=str(round(calculated_time))+" Second" timing=str(round(calculated_time))+" Second"
...@@ -239,17 +239,17 @@ def docker_container(): ...@@ -239,17 +239,17 @@ def docker_container():
end_date = datetime.datetime.now(tz=datetime.timezone.utc) end_date = datetime.datetime.now(tz=datetime.timezone.utc)
calculated_time=(end_date.astimezone(datetime.timezone.utc) - start_date.astimezone(datetime.timezone.utc)).total_seconds() calculated_time=(end_date.astimezone(datetime.timezone.utc) - start_date.astimezone(datetime.timezone.utc)).total_seconds()
if each.attrs["State"]["Status"] =="created": if each.attrs["State"]["Status"] =="created":
calculated_time="NA" calculated_time=0.25
if calculated_time="NA": if calculated_time==0.25:
timing="" timing=""
if calculated_time>3600: elif calculated_time>3600:
calculated_time=calculated_time/3600 calculated_time=calculated_time/3600
if round(calculated_time)>1: if round(calculated_time)>1:
timing=str(round(calculated_time))+" Hours" timing=str(round(calculated_time))+" Hours"
else: else:
timing=str(round(calculated_time))+" Hour" timing=str(round(calculated_time))+" Hour"
elif calculated_time<60: elif round(calculated_time)<60:
if round(calculated_time)>1: if round(calculated_time)>1:
timing=str(round(calculated_time))+" Seconds" timing=str(round(calculated_time))+" Seconds"
else: else:
......
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