2010-12-23 13:29:31 -05:00
|
|
|
#!/usr/bin/env python
|
|
|
|
from utils.munin.base import MuninGraph
|
|
|
|
|
|
|
|
graph_config = {
|
|
|
|
'graph_category' : 'NewsBlur',
|
|
|
|
'graph_title' : 'NewsBlur Feed Counts',
|
|
|
|
'graph_vlabel' : 'Feeds Feed Counts',
|
|
|
|
'exception_feeds.label': 'exception_feeds',
|
|
|
|
'exception_pages.label': 'exception_pages',
|
|
|
|
'inactive_feeds.label': 'inactive_feeds',
|
|
|
|
'duplicate_feeds.label': 'duplicate_feeds',
|
|
|
|
'active_feeds.label': 'active_feeds',
|
2012-02-01 22:49:46 -08:00
|
|
|
'known_good_feeds.label': 'known_good',
|
2012-03-27 18:48:36 -07:00
|
|
|
'push_feeds.label': 'push_feeds',
|
2012-03-28 17:35:51 -07:00
|
|
|
'push_feeds_failed.label': 'push_feeds_failed',
|
2010-12-23 13:29:31 -05:00
|
|
|
}
|
2011-03-23 15:43:15 -04:00
|
|
|
def calculate_metrics():
|
|
|
|
from apps.rss_feeds.models import Feed, DuplicateFeed
|
2012-03-27 18:48:36 -07:00
|
|
|
from apps.push.models import PushSubscription
|
2011-03-23 15:43:15 -04:00
|
|
|
|
|
|
|
return {
|
|
|
|
'exception_feeds': Feed.objects.filter(has_feed_exception=True).count(),
|
|
|
|
'exception_pages': Feed.objects.filter(has_page_exception=True).count(),
|
|
|
|
'inactive_feeds': Feed.objects.filter(active=False).count(),
|
|
|
|
'duplicate_feeds': DuplicateFeed.objects.count(),
|
|
|
|
'active_feeds': Feed.objects.filter(active_subscribers__gt=0).count(),
|
2012-02-01 22:32:57 -08:00
|
|
|
'known_good_feeds': Feed.objects.filter(known_good=True).count(),
|
2012-03-28 17:35:51 -07:00
|
|
|
'push_feeds': PushSubscription.objects.filter(verified=True).count(),
|
|
|
|
'push_feeds_failed': PushSubscription.objects.filter(verified=False).count(),
|
2011-03-23 15:43:15 -04:00
|
|
|
}
|
2010-12-23 13:29:31 -05:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2011-03-23 15:43:15 -04:00
|
|
|
MuninGraph(graph_config, calculate_metrics).run()
|