Code Monkey home page Code Monkey logo

haproxy-stats's Introduction

haproxy-stats

Documentation Status

Haproxy-stats is a small Python library for fetching and parsing realtime stats from HAProxy

Installing

pip install haproxy-stats

Usage

from haproxystats import HAProxyServer

haproxy = HAProxyServer('127.0.0.1:3212')

for b in haproxy.backends:
    print('%s: %s' % (b.name, b.status))
backend1: UP
backend2: UP
backend3: UP
haproxy.to_json()
{
  "127.0.0.1": {
    "backends": [
      {
        "status": "UP",
        "lastchg": 497805,
        "weight": 0,
         "..."
        "listeners": []
      }
    ],
    "frontends": []
  }
}

full docs available in the docs/ folder

haproxy-stats's People

Contributors

bcicen avatar james-portman avatar tisc0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

haproxy-stats's Issues

ImportError: cannot import name HAProxyServer

error observed in Python 2.7.17 and Python 3.6.9 and works fine with Python 2.7.12

Traceback (most recent call last):
File "lb.py", line 3, in
from haproxystats import HAProxyServer
ImportError: cannot import name HAProxyServer

No handlers could be found for logger "haproxystats"

I am getting an error "No handlers could be found for logger "haproxystats"" if I run below commands:

from haproxystats import HAProxyServer
haproxy = HAProxyServer('192.168.122.215:9001')
for b in haproxy.backends:
print('%s: %s' % (b.name, b.status))
I have stored above commands in one file and kept it in a same folder where HAProxy server resides. When I run these commands, I am getting an error(specified above).

Can you please check it once and tell me where am I going wrong?

Thanks.

Wrong usage example

In README.md

hs = HaproxyStats(base_urls,user='<username>',user_pass='<password>')

but correct version i think is

hs = HaproxyStats(base_urls,user='<username>',password='<password>')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.