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
235930f6
Commit
235930f6
authored
Nov 16, 2022
by
jithu.tagore
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update infra_as_service_monitor.py
parent
bfcc9597
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
infra_as_service_monitor.py
infra_as_service_monitor.py
+10
-9
No files found.
infra_as_service_monitor.py
View file @
235930f6
...
...
@@ -51,7 +51,6 @@ ram_threshold_value = config["ram"]["ram_threshold_value"]
include_ram
=
config
[
"ram"
][
"include_ram"
]
filesystem
=
config
[
"disk"
][
"filesystem"
]
server
=
config
[
"type"
][
"server"
]
camera
=
config
[
"type"
][
"camera"
]
include_all_filesystem
=
config
[
"disk"
][
"include_all_filesystem"
]
service_list
=
config
[
"service"
][
"service_list"
]
.
split
(
","
)
status_dict
=
{}
...
...
@@ -170,12 +169,15 @@ def restart(service_name):
def
docker_container
():
docker_client
=
docker
.
from_env
()
containers
=
docker_client
.
containers
.
list
(
all
=
True
)
for
i
in
containers
:
if
i
.
attrs
[
"State"
][
"Status"
]
==
config
[
'service'
][
'docker_conatiner_state'
]:
container_restart
.
append
(
i
)
data
.
append
([
i
.
name
,
i
.
id
,
i
.
attrs
[
"State"
][
"Status"
]])
try
:
docker_client
=
docker
.
from_env
()
containers
=
docker_client
.
containers
.
list
(
all
=
True
)
for
i
in
containers
:
if
i
.
attrs
[
"State"
][
"Status"
]
==
config
[
'service'
][
'docker_conatiner_state'
]:
container_restart
.
append
(
i
)
data
.
append
([
i
.
name
,
i
.
id
,
i
.
attrs
[
"State"
][
"Status"
]])
except
Exception
as
e
:
logger
.
exception
(
e
)
def
status
(
service_name
):
...
...
@@ -405,7 +407,6 @@ def mail_send():
f
"<b>{env} {config['user_info']['subject']}</b>
\n
Last Restarted at : {restart_time}({count_of_restart})
\n
IP:{ip_address}
\n
Environment:{env}
\n\n
<b>Ram Usage</b>
\n
<pre>{tabular_table}</pre>"
)
html
=
html_top_section
+
service_section
+
docker_container
+
html_end
elif
len
(
disk_table
)
>
0
:
print
(
"disk html"
)
if
mqtt
==
"True"
:
client1
.
publish
(
mqtt_topic
,
"{}"
)
if
telegram
==
"True"
:
...
...
@@ -448,7 +449,7 @@ def mail_send():
auth
=
HTTPBasicAuth
(
email_detail
[
"user"
],
email_detail
[
"password"
]))
logger
.
debug
(
f
'{resp}'
)
logger
.
debug
(
f
'{resp.json()}'
)
if
camera
==
"Tru
e"
:
if
server
==
"Fals
e"
:
payload
=
{
"receiver_list"
:
receiver_email
,
"from_name"
:
'devops@unifytwin.com'
,
...
...
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