Ordering and smoothing munin graphs.

This commit is contained in:
Samuel Clay 2012-09-27 16:51:52 -07:00
parent e3ad4486e3
commit c258bbdd11
5 changed files with 27 additions and 14 deletions

View file

@ -9,8 +9,9 @@ class NBMuninGraph(MuninGraph):
'graph_category' : 'NewsBlur',
'graph_title' : 'NewsBlur Browser Breakdown',
}
servers = dict((("%s.label" % s['_id'], s['_id']) for s in self.stats))
graph.update(servers)
stats = self.stats
graph.update(dict((("%s.label" % s['_id'], s['_id']) for s in stats)))
graph.update(dict((("%s.draw" % s['_id'], 'LINE1') for s in stats)))
return graph
def calculate_metrics(self):

View file

@ -9,8 +9,11 @@ class NBMuninGraph(MuninGraph):
'graph_category' : 'NewsBlur',
'graph_title' : 'NewsBlur Paths',
}
servers = dict((("%s.label" % s['_id'], s['_id']) for s in self.stats))
graph.update(servers)
stats = self.stats
graph.update(dict((("%s.label" % s['_id'], s['_id']) for s in stats)))
graph.update(dict((("%s.draw" % s['_id'], 'LINE1') for s in stats)))
return graph
def calculate_metrics(self):

View file

@ -10,12 +10,15 @@ class NBMuninGraph(MuninGraph):
'graph_title' : 'NewsBlur Task Codes',
'graph_vlabel' : 'Status codes on feed fetch',
}
servers = dict((("_%s.label" % s['_id'], s['_id']) for s in self.stats))
graph.update(servers)
stats = self.stats
graph.update(dict((("_%s.label" % s['_id'], s['_id']) for s in stats)))
graph['graph_order'] = ' '.join(sorted(("_%s" % s['_id']) for s in stats))
return graph
def calculate_metrics(self):
servers = dict((("_%s" % s['_id'], s['feeds']) for s in self.stats))
return servers
@property

View file

@ -1,5 +1,8 @@
#!/usr/bin/env python
from utils.munin.base import MuninGraph
import datetime
from django.conf import settings
class NBMuninGraph(MuninGraph):
@ -11,8 +14,10 @@ class NBMuninGraph(MuninGraph):
'graph_vlabel' : '# of fetches / server',
'total.label': 'total',
}
servers = dict((("%s.label" % s['_id'], s['_id']) for s in self.stats))
graph.update(servers)
stats = self.stats
graph.update(dict((("%s.label" % s['_id'], s['_id']) for s in stats)))
graph.update(dict((("%s.draw" % s['_id'], "LINESTACK") for s in stats)))
graph['graph_order'] = ' '.join(sorted(s['_id'] for s in stats))
return graph
def calculate_metrics(self):
@ -22,13 +27,10 @@ class NBMuninGraph(MuninGraph):
@property
def stats(self):
import datetime
from django.conf import settings
stats = settings.MONGOANALYTICSDB.nbanalytics.feed_fetches.aggregate([{
"$match": {
"date": {
"$gt": datetime.datetime.now() - datetime.timedelta(minutes=5),
"$gte": datetime.datetime.now() - datetime.timedelta(minutes=5),
},
},
}, {

View file

@ -10,8 +10,12 @@ class NBMuninGraph(MuninGraph):
'graph_title' : 'NewsBlur Task Server Times',
'graph_vlabel' : 'Feed fetch time / server',
}
servers = dict((("%s.label" % s['_id'], s['_id']) for s in self.stats))
graph.update(servers)
stats = self.stats
graph['graph_order'] = ' '.join(sorted(s['_id'] for s in stats))
graph.update(dict((("%s.label" % s['_id'], s['_id']) for s in stats)))
graph.update(dict((("%s.draw" % s['_id'], 'LINE1') for s in stats)))
return graph
def calculate_metrics(self):