- mode = request.args.get('mode', 'full')
- if mode == 'consolidated':
- if begin is None or end is None:
- pass
+ mode = request.args.get('mode', 'full')
+ if mode == 'consolidated':
+ if begin is None or end is None:
+ pass
+ else:
+ # copied from munin/master/_bin/munin-cgi-graph.in
+ resolutions = dict(
+ day = 300,
+ week = 1800,
+ month = 7200,
+ year = 86400,
+ )
+ duration = (end - begin).total_seconds()
+ day = 60 * 60 * 24
+ if duration < day:
+ resolution = resolutions['day']
+ elif duration < 7 * day:
+ resolution = resolutions['week']
+ elif duration < 31 * day:
+ resolution = resolutions['month']