2 Simple statistics plugin
4 To use it, go to http://127.0.0.1:8000/stat
6 from modules.PluginInterface import VPProxyPlugin
9 class Stat(VPProxyPlugin):
12 def __init__(self, VPConfig, VPStuff):
13 self.config = VPConfig
16 def handle(self, connection):
17 connection.send_response(200)
18 connection.send_header('Content-type', 'text/html')
19 connection.end_headers()
20 connection.wfile.write(
21 '<html><body><h4>Connected clients: ' + str(self.stuff.clientcounter.total) + '</h4>')
22 connection.wfile.write(
23 '<h5>Concurrent connections limit: ' + str(self.config.maxconns) + '</h5>')
24 for i in self.stuff.clientcounter.clients:
25 connection.wfile.write(str(i) + ' : ' + str(self.stuff.clientcounter.clients[i][0]) + ' ' +
26 str(self.stuff.clientcounter.clients[i][1]) + '<br>')
27 connection.wfile.write('</body></html>')