NewsBlur/utils/munin/newsblur_feeds.py

27 lines
912 B
Python
Raw Normal View History

2010-06-08 11:19:41 -04:00
#!/usr/bin/env python
import datetime
2010-06-08 11:19:41 -04:00
from utils.munin.base import MuninGraph
from apps.rss_feeds.models import Feed
from apps.reader.models import UserSubscription
from django.db.models import Q
2010-06-08 11:19:41 -04:00
graph_config = {
'graph_category' : 'NewsBlur',
2010-08-30 22:58:41 -04:00
'graph_title' : 'NewsBlur Feeds & Subscriptions',
2010-06-08 11:19:41 -04:00
'graph_vlabel' : 'Feeds & Subscribers',
'feeds.label': 'feeds',
'subscriptions.label': 'subscriptions',
'update_queue.label': 'update_queue',
'exception_feeds.label': 'exception_feeds',
2010-06-08 11:19:41 -04:00
}
metrics = {
'feeds': Feed.objects.count(),
'subscriptions': UserSubscription.objects.count(),
'exception_feeds': Feed.objects.filter(Q(has_feed_exception=True) | Q(has_page_exception=True)).count(),
'update_queue': Feed.objects.filter(next_scheduled_update__lte=datetime.datetime.now(), active=True).count(),
2010-06-08 11:19:41 -04:00
}
if __name__ == '__main__':
MuninGraph(graph_config, metrics).run()