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
0a97633c
Commit
0a97633c
authored
Aug 11, 2014
by
Feanil Patel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Log the length of all the queues.
parent
2dd906e3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
4 deletions
+52
-4
playbooks/roles/rabbitmq/defaults/main.yml
+7
-4
playbooks/roles/rabbitmq/tasks/main.yml
+24
-0
playbooks/roles/rabbitmq/templates/edx/app/rabbitmq/log-rabbitmq-queues.sh.j2
+21
-0
No files found.
playbooks/roles/rabbitmq/defaults/main.yml
View file @
0a97633c
#Variables for rabbitmq
---
rabbit_app_dir
:
"
{{
COMMON_APP_DIR
}}/rabbitmq"
rabbit_data_dir
:
"
{{
COMMON_DATA_DIR
}}/rabbitmq"
rabbit_log_dir
:
"
{{
COMMON_LOG_DIR
}}/rabbitmq"
rabbit_cfg_dir
:
"
{{
COMMON_CFG_DIR
}}/rabbitmq"
rabbitmq_app_dir
:
"
{{
COMMON_APP_DIR
}}/rabbitmq"
rabbitmq_data_dir
:
"
{{
COMMON_DATA_DIR
}}/rabbitmq"
rabbitmq_log_dir
:
"
{{
COMMON_LOG_DIR
}}/rabbitmq"
rabbitmq_cfg_dir
:
"
{{
COMMON_CFG_DIR
}}/rabbitmq"
rabbitmq_user
:
"
rabbitmq"
rabbitmq_group
:
"
rabbitmq"
# Environment specific vars
RABBIT_ERLANG_COOKIE
:
'
DEFAULT_COOKIE'
...
...
playbooks/roles/rabbitmq/tasks/main.yml
View file @
0a97633c
...
...
@@ -36,6 +36,30 @@
-
name
:
send sigterm to any running rabbitmq processes
shell
:
pkill -u rabbitmq ||
true
# Create the rabbitmq directories
-
name
:
create rabbitmq edx directories
file
:
path={{ item }}
owner={{ rabbitmq_user }}
mode=0755
state=directory
with_items
:
-
"
{{
rabbitmq_app_dir
}}"
-
"
{{
rabbitmq_log_dir
}}"
-
name
:
add queue monitoring script
template
:
src="edx/app/rabbitmq/log-rabbitmq-queues.sh.j2"
dest="{{ rabbitmq_app_dir }}/log-rabbitmq-queues.sh"
owner="{{ rabbitmq_user }}"
group="{{ rabbitmq_group }}"
mode=0755
-
name
:
set up a cron job to run the script
cron
:
name="log-queue-lenghts"
job="{{ rabbitmq_app_dir }}/log-rabbitmq-queues.sh"
# Defaulting to /var/lib/rabbitmq
-
name
:
create cookie directory
file
:
>
...
...
playbooks/roles/rabbitmq/templates/edx/app/rabbitmq/log-rabbitmq-queues.sh.j2
0 → 100644
View file @
0a97633c
#!/usr/bin/env bash
set
-x
vpc_name
={{
COMMON_ENVIRONMENT
}}
-
{{
COMMON_DEPLOYMENT
}}
log_directory
={{
rabbitmq_log_dir
}}
{
% raw %
}
OLD_IFS
=
$IFS
IFS
=
$'
\n
'
vhosts
=
`
/usr/sbin/rabbitmqctl list_vhosts |
grep
"^/"
`
for
vhost
in
$vhosts
;
do
queues
=
`
/usr/sbin/rabbitmqctl list_queues
-p
$vhost
| awk
'NF==2{ print }'
`
mkdir
-p
${
log_directory
}
/
${
vhost
}
for
queue
in
$queues
;
do
queue_name
=
`
echo
$queue
| awk
'{ print $1 }'
`
echo
$queue
| sed
's/\s*/ /'
| awk
-v
date
=
"
$(
date
)
"
-v
vhost
=
"
$vhost
"
'{ print "date=\x27"date"\x27","vhost=\x27"vhost"\x27","queue=\x27"$1"\x27","length="$2}'
>>
${
log_directory
}
/
${
vhost
}
/
${
queue_name
}
.log
done
done
IFS
=
$OLD_IFS
{
% 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