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
edx
configuration
Commits
109716e9
Commit
109716e9
authored
Feb 24, 2017
by
nadeemshahzad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed monitoring script to bash
parent
a035ee2d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
25 deletions
+13
-25
playbooks/roles/rabbitmq/tasks/main.yml
+3
-3
playbooks/roles/rabbitmq/templates/edx/app/rabbitmq/log-rabbitmq-memory.py.j2
+0
-22
playbooks/roles/rabbitmq/templates/edx/app/rabbitmq/log-rabbitmq-memory.sh.j2
+10
-0
No files found.
playbooks/roles/rabbitmq/tasks/main.yml
View file @
109716e9
...
...
@@ -54,8 +54,8 @@
-
name
:
Add RabbitMQ memory usage script
template
:
src
:
"
edx/app/rabbitmq/log-rabbitmq-memory.
py
.j2"
dest
:
"
{{
rabbitmq_app_dir
}}/log-rabbitmq-memory.
py
"
src
:
"
edx/app/rabbitmq/log-rabbitmq-memory.
sh
.j2"
dest
:
"
{{
rabbitmq_app_dir
}}/log-rabbitmq-memory.
sh
"
owner
:
"
{{
rabbitmq_user
}}"
group
:
"
{{
rabbitmq_group
}}"
mode
:
"
0775"
...
...
@@ -68,7 +68,7 @@
-
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"
job
:
"
{{
rabbitmq_app_dir
}}/log-rabbitmq-memory.
sh
>/dev/null
2>&1"
-
name
:
install logrotate configuration
template
:
...
...
playbooks/roles/rabbitmq/templates/edx/app/rabbitmq/log-rabbitmq-memory.py.j2
deleted
100644 → 0
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"
)
playbooks/roles/rabbitmq/templates/edx/app/rabbitmq/log-rabbitmq-memory.sh.j2
0 → 100644
View file @
109716e9
#!/usr/bin/env bash
set
-x
log_directory
={{
rabbitmq_log_dir
}}
{
% raw %
}
memusg
=
`
/usr/sbin/rabbitmqctl status |
grep
total | awk
-F
',|}'
-v
date
=
"
$(
date
)
"
'NR==1{printf date"\tRabbitMQ Memory Usage:(MB) " $2/(1024 * 1024)}'
`
mkdir
-p
$log_directory
echo
$memusg
>>
"
$log_directory
/rabbitmq.memory.log"
{
% endraw %
}
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