-
Notifications
You must be signed in to change notification settings - Fork 33
/
index.html
89 lines (80 loc) · 2.03 KB
/
index.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Layer7 - DSTAT</title>
<style>
html,
body {
height: 100%;
margin: 0;
}
body {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
body > div {
width: 100%;
}
#chart {
width: 80%;
margin: auto;
}
#info {
margin-top: 2em;
text-align: center;
font-family: Arial, Helvetica, sans-serif;
}
</style>
</head>
<body>
<div>
<h2 id="info"></h2>
<div id="chart"></div>
</div>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script>
window.onload = () => {
let info = document.getElementById("info");
let chart = Highcharts.chart("chart", {
exporting: {
enabled: true,
},
chart: {
type: "area",
},
title: {
text: "Layer7 DSTAT",
},
xAxis: {
type: "datetime",
},
yAxis: {
title: {
text: "",
},
},
series: [
{
name: "Requests",
data: [],
},
],
});
info.innerText = "Capturing requests from " + location.host + "/dstat";
let ws = new WebSocket(
(location.protocol === "https:" ? "wss" : "ws") + "://" + location.host + "/"
);
ws.onmessage = (event) => {
let requests = Number(event.data);
let time = new Date().getTime();
chart.series[0].addPoint([time, requests], true, chart.series[0].points.length > 60);
};
};
</script>
</body>
</html>