2020-12-03 14:05:32 -05:00
|
|
|
#!/srv/newsblur/venv/newsblur3/bin/python
|
2010-07-21 12:49:33 -04:00
|
|
|
|
|
|
|
from utils.munin.base import MuninGraph
|
2020-12-10 12:40:12 -05:00
|
|
|
import os
|
2021-01-19 09:40:13 -05:00
|
|
|
os.environ["DJANGO_SETTINGS_MODULE"] = "newsblur_web.settings"
|
2020-12-10 12:42:12 -05:00
|
|
|
import django
|
|
|
|
django.setup()
|
2010-07-21 12:49:33 -04:00
|
|
|
|
2012-09-27 10:45:40 -07:00
|
|
|
class NBMuninGraph(MuninGraph):
|
2010-07-21 12:49:33 -04:00
|
|
|
|
2012-09-27 10:45:40 -07:00
|
|
|
@property
|
|
|
|
def graph_config(self):
|
|
|
|
return {
|
|
|
|
'graph_category' : 'NewsBlur',
|
|
|
|
'graph_title' : 'NewsBlur Fetching History',
|
|
|
|
'graph_vlabel' : 'errors',
|
2012-09-28 09:50:12 -07:00
|
|
|
'graph_args' : '-l 0',
|
2012-09-27 10:45:40 -07:00
|
|
|
# 'feed_errors.label': 'Feed Errors',
|
|
|
|
'feed_success.label': 'Feed Success',
|
|
|
|
# 'page_errors.label': 'Page Errors',
|
2013-08-16 16:02:56 -07:00
|
|
|
# 'page_success.label': 'Page Success',
|
2012-09-27 10:45:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
def calculate_metrics(self):
|
|
|
|
from apps.statistics.models import MStatistics
|
|
|
|
statistics = MStatistics.all()
|
2011-03-23 15:43:15 -04:00
|
|
|
|
2012-09-27 10:45:40 -07:00
|
|
|
return {
|
|
|
|
'feed_success': statistics['feeds_fetched'],
|
|
|
|
}
|
2010-07-21 12:49:33 -04:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2012-09-27 10:45:40 -07:00
|
|
|
NBMuninGraph().run()
|