NewsBlur/utils/munin/newsblur_stories.py

32 lines
838 B
Python
Raw Normal View History

2020-12-03 14:05:32 -05:00
#!/srv/newsblur/venv/newsblur3/bin/python
2010-06-08 11:19:41 -04:00
from utils.munin.base import MuninGraph
2020-12-10 12:40:12 -05:00
import os
os.environ["DJANGO_SETTINGS_MODULE"] = "newsblur_web.settings"
2020-12-10 12:42:12 -05:00
import django
django.setup()
2010-06-08 11:19:41 -04:00
class NBMuninGraph(MuninGraph):
@property
def graph_config(self):
return {
'graph_category' : 'NewsBlur',
'graph_title' : 'NewsBlur Stories',
'graph_vlabel' : 'Stories',
'graph_args' : '-l 0',
2013-07-11 15:55:37 -07:00
'stories.label': 'Stories',
'starred_stories.label': 'Starred stories',
}
def calculate_metrics(self):
2013-07-11 15:55:37 -07:00
from apps.rss_feeds.models import MStory, MStarredStory
return {
2013-07-11 15:55:37 -07:00
'stories': MStory.objects.count(),
'starred_stories': MStarredStory.objects.count(),
}
2010-06-08 11:19:41 -04:00
if __name__ == '__main__':
NBMuninGraph().run()