NewsBlur-viq/utils/munin/newsblur_feeds.py

32 lines
1.1 KiB
Python
Raw Normal View History

2010-06-08 11:19:41 -04:00
#!/usr/bin/env python
from utils.munin.base import MuninGraph
class NBMuninGraph(MuninGraph):
2010-06-08 11:19:41 -04:00
@property
def graph_config(self):
return {
'graph_category' : 'NewsBlur',
'graph_title' : 'NewsBlur Feeds & Subscriptions',
'graph_vlabel' : 'Feeds & Subscribers',
'graph_args' : '-l 0',
'feeds.label': 'feeds',
'subscriptions.label': 'subscriptions',
'profiles.label': 'profiles',
'social_subscriptions.label': 'social_subscriptions',
}
def calculate_metrics(self):
from apps.rss_feeds.models import Feed
from apps.reader.models import UserSubscription
from apps.social.models import MSocialProfile, MSocialSubscription
return {
2013-06-26 13:03:44 -07:00
'feeds': Feed.objects.latest('pk').pk,
'subscriptions': UserSubscription.objects.latest('pk').pk,
'profiles': MSocialProfile.objects.count(),
'social_subscriptions': MSocialSubscription.objects.count(),
}
2010-06-08 11:19:41 -04:00
if __name__ == '__main__':
NBMuninGraph().run()