Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added munin graphs stats page

  • Loading branch information...
commit 1cd677271c6cf7d2f83cafa43a2913549dcac790 1 parent faf5216
@calaldees authored
View
1  website/karakara/__init__.py
@@ -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:.*}')
View
1  website/karakara/templates/html/home.mako
@@ -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
View
35 website/karakara/templates/html/stats.mako
@@ -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>
+
View
5 website/karakara/views/misc.py
@@ -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
View
2  website/production.inidiff
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.