Because just graduated from poor college students, and friends rented a server opened a number of ports to provide SS services, too lazy to configure Ss-panel, used Ss-bash to monitor the traffic of different ports, but each time to wait on the server to see traffic usage, very troublesome, so wrote a simple page to provide WEB access, specific content through this article study it
Because just graduated from poor college students, and friends rented a server opened a number of ports to provide SS services, too lazy to configure Ss-panel, used Ss-bash to monitor the traffic of different ports, but each time to wait on the server to see traffic usage, very troublesome, so wrote a simple page to provide WEB access.
JavaScript version
Use crontab timing to copy the traffic log files to the WEB directory, write a JS script for data processing.
function Successfunction (data) {var allrows = Data.split (/\r?\n|\r/); var table = ' <table class= "Table Table-hover" St Yle= "width:50%; Margin:auto; " > '; for (var singlerow = 0; singlerow < allrows.length; singlerow++) { if (singlerow = = = 0) { table + = ' <THEAD&G t; '; Table + = ' <tr> '; } else { table + = ' <tr> '; } var rowcells = Allrows[singlerow].split (', '); for (var Rowcell = 0; Rowcell < rowcells.length; rowcell++) { if (singlerow = = = 0) { table + = ' <th class= ' te Xt-right ">"; Table + = Rowcells[rowcell]; Table + = ' </th> '; } else { table + = ' <td class= "text-right" > "; Table + = Rowcells[rowcell]; Table + = ' </td> '; } } if (singlerow = = = 0) { table + = ' </tr> '; Table + = ' </thead> '; Table + = ' <tbody> '; } else { table + = ' </tr> '; }} Table + = ' </tbody> '; Table + = ' </table> '; $ (' body '). Append (table);}
Home
<! DOCTYPE html>
PHP version
The server is already installed PHP, so it is a matter of course to use PHP.
<! DOCTYPE html>The above is a small series to introduce to the SS bash to write a WEB page to view traffic, I hope to help you, if you have any questions please give me a message, small series will promptly reply to you. Thank you very much for the support of the Scripting House website!
How to write a page for SS bash to view traffic on the WEB side