Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
configuration
Commits
a035ee2d
Commit
a035ee2d
authored
8 years ago
by
nadeemshahzad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added cron for rabbitmq mem usage
parent
77d54170
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletions
+36
-1
playbooks/roles/rabbitmq/tasks/main.yml
+14
-1
playbooks/roles/rabbitmq/templates/edx/app/rabbitmq/log-rabbitmq-memory.py.j2
+22
-0
No files found.
playbooks/roles/rabbitmq/tasks/main.yml
View file @
a035ee2d
...
...
@@ -52,11 +52,24 @@
group
:
"
{{
rabbitmq_group
}}"
mode
:
"
0755"
-
name
:
Set up a cron job to run the script
-
name
:
Add RabbitMQ memory usage script
template
:
src
:
"
edx/app/rabbitmq/log-rabbitmq-memory.py.j2"
dest
:
"
{{
rabbitmq_app_dir
}}/log-rabbitmq-memory.py"
owner
:
"
{{
rabbitmq_user
}}"
group
:
"
{{
rabbitmq_group
}}"
mode
:
"
0775"
-
name
:
Set up a cron job to run queue script
cron
:
name
:
"
log-queue-lenghts"
job
:
"
{{
rabbitmq_app_dir
}}/log-rabbitmq-queues.sh
>/dev/null
2>&1"
-
name
:
Set up a cron job to run the script
cron
:
name
:
"
log-rabbitmq-memory-usage"
job
:
"
{{
rabbitmq_app_dir
}}/log-rabbitmq-memory.py
>/dev/null
2>&1"
-
name
:
install logrotate configuration
template
:
src
:
etc/logrotate.d/rabbitmq.j2
...
...
This diff is collapsed.
Click to expand it.
playbooks/roles/rabbitmq/templates/edx/app/rabbitmq/log-rabbitmq-memory.py.j2
0 → 100644
View file @
a035ee2d
#!/usr/bin/python
from
subprocess
import
Popen
,
PIPE
import
logging
log_file
=
"{{ rabbitmq_log_dir }}/rabbitmq.memory.log"
def
run_cmd
(
cmd
):
process
=
Popen
(
cmd
,
stdout
=
PIPE
,
stderr
=
PIPE
,
shell
=
True
)
output
=
process
.
communicate
()[
0
]
return
output
if
__name__
==
'__main__'
:
process_mem
=
run_cmd
(
"/usr/sbin/rabbitmqctl status | grep total | awk -F',|}' 'NR==1{print $2}'"
)
logging
.
basicConfig
(
filename
=
log_file
,
format
=
'
%(asctime)
s -
%(message)
s'
,
level
=
logging
.
DEBUG
)
if
process_mem
:
process_mem_mb
=
float
(
process_mem
)
/
(
1024
*
1024
)
logging
.
debug
(
"RabbitMQ Memory Usage(MB): {}"
.
format
(
process_mem_mb
))
else
:
logging
.
debug
(
"error connecting RabbitMQ process"
)
This diff is collapsed.
Click to expand it.
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