1 # -*- coding: utf-8 -*-
3 # Copyright 2010 Thomas Perl and Stefan Kögl. All rights reserved.
5 # Developed for a practical course (Large-scaled distributed computing) at the
6 # University of Technology Vienna in the 2010 summer term.
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions are met:
11 # 1. Redistributions of source code must retain the above copyright notice,
12 # this list of conditions and the following disclaimer.
14 # 2. Redistributions in binary form must reproduce the above copyright notice,
15 # this list of conditions and the following disclaimer in the documentation
16 # and/or other materials provided with the distribution.
18 # THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
19 # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
21 # EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25 # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26 # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 from __future__
import absolute_import
36 JS
= open(os
.path
.join(os
.path
.dirname(__file__
) or '.', '..', 'all.js')).read()
39 <script type="text/javascript">
40 window.onload = function() {
41 var paper = new Raphael(0, 0, 640, 480);
42 paper.g.linechart(0, 0, 640, 480, %s, %s);
51 class RequestHandler(BaseHTTPServer
.BaseHTTPRequestHandler
):
52 """HTTP Request handler (returns monitoring data)
54 This is a simple request handler used by the built-in
55 HTTP server to visualize the monitoring data.
60 """Handler for HTTP GET requests
62 self
.send_response(200)
63 self
.send_header('Content-type', 'text/html')
64 self
.send_header('Refresh', '5')
67 x
, yy
= self
.monitor
.get_datapoints()
69 self
.wfile
.write('<html><head><script type="text/javascript">')
71 self
.wfile
.write('</script>')
72 self
.wfile
.write(HTML
% (repr(x
), repr(yy
)))
74 #server = BaseHTTPServer.HTTPServer(('', 8000), RequestHandler)
76 # server.handle_request()