from haproxystats import HAProxyServer

class HAProxyServer:
    for b in haproxy.backends:
        print('%s: %s' % (b.name, b.status))

if i run the above code i am getting error

python3.6 hatop.py

  File "hatop.py", line 3, in <module>
    from haproxystats import HAProxyServer
ImportError: cannot import name 'HAProxyServer'```

This means that, the module "HAProxyServer" is not present in your python module. You will have to install it using the below command:

pip install haproxy-stats

Please refer the official documentation:


  • ERROR:haproxystats:Error fetching stats from x.x.x.x:5222/;csv;norefresh: ('Connection aborted.', BadStatusLine("<?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='etherx.jabber.org/streams' id='2954829834' from='xxxxx' version='1.0' xml:lang=''><stream:error><xml-not-well-formed xmlns='urn:ietf:params:xml:ns:xmpp-streams'></xml-not-well-formed></stream:error></stream:stream>",)) – Deepu Nov 12 '19 at 9:06
  • i am using the code from github.com/bcicen/haproxy-stats – Deepu Nov 12 '19 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.