iPerf3 Web Interface: Real-time Performance Monitoring
<!-- index.html -->
<!DOCTYPE html>
<html>
<head>
<title>iPerf3 Web Interface</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script>
$(document).ready(function() {
var output = $('#output');
<pre><code> $('#start').click(function() {
$.ajax({
url: '/start',
type: 'POST',
success: function(response) {
output.empty();
output.text('Command started.');
var source = new EventSource('/stream');
source.onmessage = function(event) {
output.append(event.data + '\n');
};
}
});
});
$('#stop').click(function() {
$.ajax({
url: '/stop',
type: 'POST',
success: function(response) {
output.text('Command stopped.');
}
});
});
});
</script>
</code></pre>
</head>
<body>
<h1>iPerf3 Web Interface</h1>
<button id="start">Start Command</button>
<button id="stop">Stop Command</button>
<pre id="output"></pre>
</body>
</html>
<p>This web interface allows you to start and stop iPerf3 commands and view the output directly in your browser. The interface uses AJAX to communicate with a server-side application that runs iPerf3 and streams the output back to the client.</p>
<p><strong>Features:</strong></p>
<ul>
<li>Real-time monitoring of iPerf3 output</li>
<li>Start and stop iPerf3 commands with a click</li>
<li>Easy to use and configure</li>
</ul>
<p><strong>Instructions:</strong></p>
<ol>
<li>Ensure that you have a server running the necessary backend code to handle the <code>/start</code>, <code>/stop</code>, and <code>/stream</code> routes.</li>
<li>Open the <code>index.html</code> file in your web browser.</li>
<li>Click "Start Command" to begin an iPerf3 test. The output will be displayed in the <code>pre</code> element.</li>
<li>Click "Stop Command" to end the test.</li>
</ol>
<p><strong>Note:</strong> The backend code is not provided and will need to be implemented by you. Ensure the backend code correctly handles the <code>/start</code>, <code>/stop</code>, and <code>/stream</code> routes to function with the interface.</p>
原文地址: http://www.cveoy.top/t/topic/qx9M 著作权归作者所有。请勿转载和采集!