mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Adding celery queue counts to munin.
This commit is contained in:
parent
bff8d5f88e
commit
2413079ebe
1 changed files with 9 additions and 3 deletions
|
@ -5,20 +5,26 @@ graph_config = {
|
|||
'graph_category' : 'NewsBlur',
|
||||
'graph_title' : 'NewsBlur Updates',
|
||||
'graph_vlabel' : '# of updates',
|
||||
'update_queue.label': 'Queued Feeds',
|
||||
'update_queue.label': 'Queued Feeds last hour',
|
||||
'feeds_fetched.label': 'Fetched feeds last hour',
|
||||
'celery_update_feeds.label': 'Celery - Queued Feeds',
|
||||
'celery_update_feeds.label': 'Celery - Queued Feeds',
|
||||
}
|
||||
|
||||
|
||||
def calculate_metrics():
|
||||
import datetime
|
||||
import commands
|
||||
from apps.rss_feeds.models import Feed
|
||||
|
||||
hour_ago = datetime.datetime.utcnow() - datetime.timedelta(hours=1)
|
||||
|
||||
update_feeds_query = "ssh db01 \"sudo rabbitmqctl list_queues -p newsblurvhost | grep %s\" | awk '{print $2}'"
|
||||
|
||||
return {
|
||||
'update_queue': Feed.objects.filter(queued_date__gte=hour_ago).count(),
|
||||
'feeds_fetched': Feed.objects.filter(last_update__gte=hour_ago).count()
|
||||
'feeds_fetched': Feed.objects.filter(last_update__gte=hour_ago).count(),
|
||||
'celery_update_feeds': commands.getoutput(update_feeds_query % 'update_feeds'),
|
||||
'celery_new_feeds': commands.getoutput(update_feeds_query % 'new_feeds'),
|
||||
}
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Add table
Reference in a new issue