-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvarnish-live.html
43 lines (39 loc) · 1.57 KB
/
varnish-live.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<html>
<head>
<title>Varnish HTTP Requests</title>
<script type="text/javascript" src="/smoothie.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
</head>
<body>
<canvas id="mycanvas" width="800" height="300"></canvas>
<script>
canvas = document.getElementById("mycanvas");
canvas.width = $(document).width() - 30;
canvas.height = $(document).height() - 30;
var smoothie = new SmoothieChart({
grid: { strokeStyle:'rgb(40, 40, 40)', fillStyle:'rgb(10, 10, 10)',
lineWidth: 1, millisPerLine: 250, verticalSections: 4, },
labels: { fillStyle:'rgb(255, 255, 255)' }
});
smoothie.streamTo(document.getElementById("mycanvas"), 1000);
// Data
var total = new TimeSeries();
var hits = new TimeSeries();
var misses = new TimeSeries();
smoothie.addTimeSeries(total,
{ strokeStyle:'rgb(0, 0, 255)', fillStyle:'rgba(0, 0, 255, 0.2)', lineWidth:3 });
smoothie.addTimeSeries(hits,
{ strokeStyle:'rgb(0, 255, 0)', fillStyle:'rgba(0, 255, 0, 0.2)', lineWidth:3 });
smoothie.addTimeSeries(misses,
{ strokeStyle:'rgb(255, 0, 0)', fillStyle:'rgba(255, 0, 0, 0.2)', lineWidth:3 });
var socket = new io.Socket('control-rs1.ck.urspeedy.net');
socket.connect();
socket.on('message', function(metrics){
total.append(new Date().getTime(), Number(metrics['total']));
hits.append(new Date().getTime(), Number(metrics['hits']));
misses.append(new Date().getTime(), Number(metrics['misses']));
})
</script>
</body>
</html>