Spaces:
Paused
Paused
Create index.html
Browse files- index.html +89 -0
index.html
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
| 6 |
+
<title>Layer7 - DSTAT</title>
|
| 7 |
+
<style>
|
| 8 |
+
html,
|
| 9 |
+
body {
|
| 10 |
+
height: 100%;
|
| 11 |
+
margin: 0;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
body {
|
| 15 |
+
display: flex;
|
| 16 |
+
align-items: center;
|
| 17 |
+
justify-content: center;
|
| 18 |
+
flex-direction: column;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
body > div {
|
| 22 |
+
width: 100%;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
#chart {
|
| 26 |
+
width: 80%;
|
| 27 |
+
margin: auto;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
#info {
|
| 31 |
+
margin-top: 2em;
|
| 32 |
+
text-align: center;
|
| 33 |
+
font-family: Arial, Helvetica, sans-serif;
|
| 34 |
+
}
|
| 35 |
+
</style>
|
| 36 |
+
</head>
|
| 37 |
+
|
| 38 |
+
<body>
|
| 39 |
+
<div>
|
| 40 |
+
<h2 id="info"></h2>
|
| 41 |
+
<div id="chart"></div>
|
| 42 |
+
</div>
|
| 43 |
+
<script src="https://code.highcharts.com/highcharts.js"></script>
|
| 44 |
+
<script src="https://code.highcharts.com/modules/exporting.js"></script>
|
| 45 |
+
<script>
|
| 46 |
+
window.onload = () => {
|
| 47 |
+
let info = document.getElementById("info");
|
| 48 |
+
|
| 49 |
+
let chart = Highcharts.chart("chart", {
|
| 50 |
+
exporting: {
|
| 51 |
+
enabled: true,
|
| 52 |
+
},
|
| 53 |
+
chart: {
|
| 54 |
+
type: "area",
|
| 55 |
+
},
|
| 56 |
+
title: {
|
| 57 |
+
text: "Layer7 DSTAT",
|
| 58 |
+
},
|
| 59 |
+
xAxis: {
|
| 60 |
+
type: "datetime",
|
| 61 |
+
},
|
| 62 |
+
yAxis: {
|
| 63 |
+
title: {
|
| 64 |
+
text: "",
|
| 65 |
+
},
|
| 66 |
+
},
|
| 67 |
+
series: [
|
| 68 |
+
{
|
| 69 |
+
name: "Requests",
|
| 70 |
+
data: [],
|
| 71 |
+
},
|
| 72 |
+
],
|
| 73 |
+
});
|
| 74 |
+
|
| 75 |
+
info.innerText = "Capturing requests from " + location.host + "/dstat";
|
| 76 |
+
|
| 77 |
+
let ws = new WebSocket(
|
| 78 |
+
(location.protocol === "https:" ? "wss" : "ws") + "://" + location.host + "/"
|
| 79 |
+
);
|
| 80 |
+
|
| 81 |
+
ws.onmessage = (event) => {
|
| 82 |
+
let requests = Number(event.data);
|
| 83 |
+
let time = new Date().getTime();
|
| 84 |
+
chart.series[0].addPoint([time, requests], true, chart.series[0].points.length > 60);
|
| 85 |
+
};
|
| 86 |
+
};
|
| 87 |
+
</script>
|
| 88 |
+
</body>
|
| 89 |
+
</html>
|