2010-06-08 11:19:41 -04:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2010-07-24 14:16:25 -04:00
|
|
|
import datetime
|
2010-06-08 11:19:41 -04:00
|
|
|
from utils.munin.base import MuninGraph
|
|
|
|
from django.contrib.auth.models import User
|
2010-07-24 14:16:25 -04:00
|
|
|
from apps.profile.models import Profile
|
2010-06-08 11:19:41 -04:00
|
|
|
|
|
|
|
graph_config = {
|
|
|
|
'graph_category' : 'NewsBlur',
|
|
|
|
'graph_title' : 'NewsBlur Users',
|
|
|
|
'graph_vlabel' : 'users',
|
|
|
|
'all.label': 'all',
|
2010-07-24 14:16:25 -04:00
|
|
|
'monthly.label': 'monthly',
|
2010-06-08 11:19:41 -04:00
|
|
|
}
|
|
|
|
|
2010-07-24 14:16:25 -04:00
|
|
|
last_month = datetime.datetime.now() - datetime.timedelta(days=30)
|
|
|
|
|
2010-06-08 11:19:41 -04:00
|
|
|
metrics = {
|
|
|
|
'all': User.objects.count(),
|
2010-07-24 14:16:25 -04:00
|
|
|
'monthly': Profile.objects.filter(last_seen_on__gte=last_month).count()
|
2010-06-08 11:19:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
MuninGraph(graph_config, metrics).run()
|