Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
docker_health_check
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jithu.tagore
docker_health_check
Commits
0512efed
Commit
0512efed
authored
Nov 21, 2022
by
jithu.tagore
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update infra_as_service_monitor.py
parent
cb7794a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
infra_as_service_monitor.py
infra_as_service_monitor.py
+7
-3
No files found.
infra_as_service_monitor.py
View file @
0512efed
...
...
@@ -190,9 +190,7 @@ def docker_container():
except
docker
.
errors
.
NotFound
as
exc
:
print
(
f
"Check container name!
\n
{exc.explanation}"
)
else
:
if
container
.
attrs
[
"State"
][
"Status"
]
==
"restarting"
or
container
.
attrs
[
"State"
][
"Status"
]
==
\
"exited"
:
container_restart
.
append
(
container
)
if
container
.
attrs
[
"State"
][
"Status"
]
==
"restarting"
or
container
.
attrs
[
"State"
][
"Status"
]
==
"exited"
:
end
=
container
.
attrs
[
"State"
][
"FinishedAt"
]
start_date
=
dateutil
.
parser
.
isoparse
(
end
)
end_date
=
datetime
.
datetime
.
now
(
tz
=
datetime
.
timezone
.
utc
)
...
...
@@ -202,6 +200,7 @@ def docker_container():
if
container_id
not
in
df
[
"Services"
]
.
values
:
df
.
loc
[
len
(
df
.
index
)]
=
[
container_id
,
datetime
.
datetime
.
now
(),
0
]
df
.
to_csv
(
"check_time.csv"
)
container_restart
.
append
(
container_id
)
else
:
found
=
list
(
df
[
df
[
'Services'
]
==
container_id
][
"Time"
])
timer
=
datetime
.
datetime
.
now
()
-
found
[
0
]
...
...
@@ -211,6 +210,7 @@ def docker_container():
df
.
loc
[
df
[
'Services'
]
==
container_id
,
"Ago"
]
=
0
df
.
loc
[
df
[
'Services'
]
==
container_id
,
"Time"
]
=
datetime
.
datetime
.
now
()
df
.
to_csv
(
"check_time.csv"
)
container_restart
.
append
(
container_id
)
else
:
df
.
loc
[
df
[
'Services'
]
==
container_id
,
"Ago"
]
=
str
(
timer
)
df
.
to_csv
(
"check_time.csv"
)
...
...
@@ -270,6 +270,8 @@ def docker_container():
if
container_id
not
in
df
[
"Services"
]
.
values
:
df
.
loc
[
len
(
df
.
index
)]
=
[
container_id
,
datetime
.
datetime
.
now
(),
0
]
df
.
to_csv
(
"check_time.csv"
)
container_restart
.
append
(
each
)
else
:
found
=
list
(
df
[
df
[
'Services'
]
==
container_id
][
"Time"
])
timer
=
datetime
.
datetime
.
now
()
-
found
[
0
]
...
...
@@ -649,6 +651,7 @@ if __name__ == '__main__':
df
.
loc
[
len
(
df
.
index
)]
=
[
container_id
,
datetime
.
datetime
.
now
(),
0
]
Ram_send_mail
=
1
df
.
to_csv
(
"check_time.csv"
)
send_mail
=
True
else
:
found
=
list
(
df
[
df
[
'Services'
]
==
container_id
][
"Time"
])
timer
=
datetime
.
datetime
.
now
()
-
found
[
0
]
...
...
@@ -677,6 +680,7 @@ if __name__ == '__main__':
if
container_id
not
in
df
[
"Services"
]
.
values
:
df
.
loc
[
len
(
df
.
index
)]
=
[
container_id
,
datetime
.
datetime
.
now
(),
0
]
df
.
to_csv
(
"check_time.csv"
)
send_mail
=
True
else
:
found
=
list
(
df
[
df
[
'Services'
]
==
container_id
][
"Time"
])
timer
=
datetime
.
datetime
.
now
()
-
found
[
0
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment