Permalink
Browse files

Added munin graphs stats page

  • Loading branch information...
1 parent faf5216 commit 1cd677271c6cf7d2f83cafa43a2913549dcac790 @calaldees committed Mar 2, 2014
@@ -119,6 +119,7 @@ def append_format_pattern(route):
config.add_route('settings' , append_format_pattern('/settings') )
config.add_route('random_images' , append_format_pattern('/random_images') )
config.add_route('inject_testdata' , append_format_pattern('/inject_testdata') )
+ config.add_route('stats' , append_format_pattern('/stats') )
config.add_route('search_tags' , '/search_tags/{tags:.*}')
config.add_route('search_list' , '/search_list/{tags:.*}')
@@ -44,5 +44,6 @@
<a href="/admin_lock" data-role="button" class="admin">Admin Lock</a>
<a href="/remote" data-role="button" class="admin">Remote Control</a>
<a href="/inject_testdata" data-role="button" class="admin">Inject Test Data</a>
+ <a href="/stats" data-role="button" class="admin">Server Stats</a>
<a href="/admin" data-role="button" class="admin">Exit Admin Mode</a>
% endif
@@ -0,0 +1,35 @@
+<%
+ # Example URL
+ # http://localhost/munin/munin-cgi-graph/localdomain/localhost.localdomain/cpu-pinpoint=1393675625,1393783625.png?&lower_limit=&upper_limit=&size_x=800&size_y=400
+
+ import datetime
+ from collections import namedtuple
+ from externals.lib.misc import epoc, now
+
+ munin_graph_path = '/munin/munin-cgi-graph/localdomain/localhost.localdomain/'
+
+ Size = namedtuple('Size', ['x','y'])
+ graph_size = Size(400, 200)
+ graph_types = (
+ 'if_eth0',
+ 'diskstats_iops/sda',
+ 'diskstats_throughput/sda',
+ 'cpu',
+ 'load',
+ 'memory',
+ )
+ graph_end = now()
+ graph_start = graph_end - datetime.timedelta(hours=2)
+%>
+<html>
+ <head>
+ </head>
+
+ <body>
+ <h1>Stats</h1>
+ % for graph_type in graph_types:
+ <img src="${munin_graph_path}${graph_type}-pinpoint=${epoc(graph_start)},${epoc(graph_end)}.png?&lower_limit=&upper_limit=&size_x=${graph_size.x}&size_y=${graph_size.y}" alt="${graph_type}">
+ % endfor
+ </body>
+</html>
+
@@ -33,6 +33,11 @@ def generate_cache_key_homepage(request):
def home(request):
return action_ok()
+@view_config(route_name='stats')
+@web
+def stats(request):
+ return action_ok()
+
@view_config(route_name='admin_lock')
@web
@admin_only
@@ -4,6 +4,8 @@ pyramid.debug_templates = false
karakara.server.mode = production
+karakara.player.title = KaraKara (Beta)
+
karakara.queue.group.split_markers = [0:15:00, 0:30:00] -> timedelta
karakara.queue.track.padding = 0:00:60 -> timedelta

0 comments on commit 1cd6772

Please sign in to comment.