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
1c40478e
Commit
1c40478e
authored
Nov 17, 2022
by
jithu.tagore
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update infra_as_service_monitor.py
parent
3f922630
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
infra_as_service_monitor.py
infra_as_service_monitor.py
+3
-3
No files found.
infra_as_service_monitor.py
View file @
1c40478e
...
...
@@ -175,6 +175,7 @@ def docker_container():
containers
=
docker_client
.
containers
.
list
(
all
=
True
)
for
i
in
containers
:
if
i
.
attrs
[
"State"
][
"Status"
]
==
"restarting"
or
i
.
attrs
[
"State"
][
"Status"
]
==
"exited"
:
print
(
i
.
attrs
[
"State"
][
"Status"
])
container_restart
.
append
(
i
)
start
=
i
.
attrs
[
"State"
][
"StartedAt"
]
end
=
i
.
attrs
[
"State"
][
"FinishedAt"
]
...
...
@@ -182,6 +183,7 @@ def docker_container():
end_date
=
dateutil
.
parser
.
isoparse
(
end
)
time
=
((
end_date
-
start_date
)
.
total_seconds
())
if
i
.
attrs
[
"State"
][
"Status"
]
==
"running"
or
i
.
attrs
[
"State"
][
"Status"
]
==
"created"
:
print
(
i
.
attrs
[
"State"
][
"Status"
])
start_date
=
dateutil
.
parser
.
isoparse
(
start
)
end_date
=
datetime
.
datetime
.
now
(
tz
=
datetime
.
timezone
.
utc
)
time
=
(
end_date
.
astimezone
(
datetime
.
timezone
.
utc
)
-
start_date
.
astimezone
(
datetime
.
timezone
.
utc
))
.
total_seconds
()
...
...
@@ -216,7 +218,6 @@ def status(service_name):
else
:
# service_status = os.system(f'sudo service {str(service_name)} status')
service_status
=
os
.
system
(
f
'sudo systemctl status {str(service_name)} --no-pager'
)
print
(
"hi"
)
except
Exception
as
e
:
logger
.
info
(
e
)
logger
.
exception
(
e
)
...
...
@@ -225,9 +226,8 @@ def status(service_name):
if
service_status
==
0
:
logger
.
info
(
f
"^^^^^^^^^^^^^^^^^^^ {str(service_name)} - Active ^^^^^^^^^^^^^^^^^^^"
)
if
service_name
==
"docker"
:
print
(
"docker"
)
docker_container
()
print
(
"finish"
)
if
service_name
==
'cassandra'
and
counter
>
0
:
# if cassandra is already up, kairos restart not needed
# os.system('sudo service kairosdb restart')
...
...
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