2016-11-20 11:05:14 -08:00
|
|
|
#!/srv/newsblur/venv/newsblur/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.settings"
|
2010-06-08 11:19:41 -04:00
|
|
|
|
2012-09-27 10:45:40 -07:00
|
|
|
class NBMuninGraph(MuninGraph):
|
2010-06-08 11:19:41 -04:00
|
|
|
|
2012-09-27 10:45:40 -07:00
|
|
|
@property
|
|
|
|
def graph_config(self):
|
|
|
|
return {
|
|
|
|
'graph_category' : 'NewsBlur',
|
|
|
|
'graph_title' : 'NewsBlur Classifiers',
|
|
|
|
'graph_vlabel' : '# of classifiers',
|
2012-09-28 09:50:12 -07:00
|
|
|
'graph_args' : '-l 0',
|
2012-09-27 10:45:40 -07:00
|
|
|
'feeds.label': 'feeds',
|
|
|
|
'authors.label': 'authors',
|
|
|
|
'tags.label': 'tags',
|
|
|
|
'titles.label': 'titles',
|
|
|
|
}
|
|
|
|
|
|
|
|
def calculate_metrics(self):
|
|
|
|
from apps.analyzer.models import MClassifierFeed, MClassifierAuthor, MClassifierTag, MClassifierTitle
|
|
|
|
|
|
|
|
return {
|
|
|
|
'feeds': MClassifierFeed.objects.count(),
|
|
|
|
'authors': MClassifierAuthor.objects.count(),
|
|
|
|
'tags': MClassifierTag.objects.count(),
|
|
|
|
'titles': MClassifierTitle.objects.count(),
|
|
|
|
}
|
2010-06-08 11:19:41 -04:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2012-09-27 10:45:40 -07:00
|
|
|
NBMuninGraph().run()
|