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

Update infra_as_service_monitor.py

parent 563c747e
......@@ -174,7 +174,7 @@ def docker_container():
try:
docker_client = docker.from_env()
containers = docker_client.containers.list(all=True)
time=datetime.datetime.now(tz=datetime.timezone.utc)
for i in containers:
if i.attrs["State"]["Status"] =="restarting" or i.attrs["State"]["Status"] =="exited":
container_restart.append(i)
......@@ -545,9 +545,9 @@ if __name__ == '__main__':
service_table.append([service_name, "Active"])
tabular_table.add_rows(service_table)
if config['infra_alert_manager']['docker_container_status'] == "True":
for docker_name, docker_id, docker_status in data:
for docker_name, docker_id, docker_status,time in data:
if len(container_restart) > 0:
send_mail = True
docker_table.add_row([docker_name, docker_id, docker_status])
docker_table.add_row([docker_name, docker_id, docker_status,time])
if send_mail:
mail_send()
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