Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
392f026e
authored
Jun 24, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monitor: celery queues
parent
2ad3534a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
circle/manager/mancelery.py
+6
-0
circle/monitor/tasks/local_periodic_tasks.py
+27
-0
No files found.
circle/manager/mancelery.py
View file @
392f026e
...
@@ -77,6 +77,12 @@ celery.conf.update(
...
@@ -77,6 +77,12 @@ celery.conf.update(
'schedule'
:
timedelta
(
seconds
=
5
),
'schedule'
:
timedelta
(
seconds
=
5
),
'options'
:
{
'queue'
:
'localhost.man'
}
'options'
:
{
'queue'
:
'localhost.man'
}
},
},
'monitor.check_celery_queues'
:
{
'task'
:
'monitor.tasks.local_periodic_tasks.'
'check_celeries'
,
'schedule'
:
timedelta
(
seconds
=
5
),
'options'
:
{
'queue'
:
'localhost.man'
}
},
}
}
)
)
circle/monitor/tasks/local_periodic_tasks.py
View file @
392f026e
...
@@ -22,6 +22,9 @@ from time import time
...
@@ -22,6 +22,9 @@ from time import time
from
django.conf
import
settings
from
django.conf
import
settings
from
manager.mancelery
import
celery
from
manager.mancelery
import
celery
from
vm.tasks.vm_tasks
import
check_queue
from
vm.models
import
Node
from
storage.models
import
DataStore
from
monitor.client
import
Client
from
monitor.client
import
Client
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
...
@@ -41,3 +44,27 @@ def measure_response_time():
...
@@ -41,3 +44,27 @@ def measure_response_time():
'time'
:
time
(),
'time'
:
time
(),
}
}
])
])
@celery.task
(
ignore_result
=
True
)
def
check_celery_queues
():
graphite_string
=
lambda
component
,
hostname
,
celery
,
is_alive
,
time
:
(
"
%
s.
%
s.celery-queues.
%
s
%
d
%
s"
%
(
component
,
hostname
,
celery
,
1
if
is_alive
else
0
,
time
)
)
metrics
=
[]
for
n
in
Node
.
objects
.
all
():
# disabled, offline nodes?
for
s
in
[
"fast"
,
"slow"
]:
is_queue_alive
=
check_queue
(
n
.
host
.
hostname
,
"vm"
,
s
)
metrics
.
append
(
graphite_string
(
"circle"
,
n
.
host
.
hostname
,
"vm-"
+
s
,
is_queue_alive
,
time
()))
for
ds
in
DataStore
.
objects
.
all
():
for
s
in
[
"fast"
,
"slow"
]:
is_queue_alive
=
check_queue
(
ds
.
hostname
,
"vm"
,
s
)
metrics
.
append
(
graphite_string
(
"storage"
,
ds
.
hostname
,
"vm-"
+
s
,
is_queue_alive
,
time
()))
Client
()
.
send
(
metrics
)
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