All Projects → unixsurfer → Haproxyadmin

unixsurfer / Haproxyadmin

Licence: apache-2.0
A python library to interact with HAProxy over UNIX socket

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Haproxyadmin

Integrated Examples
以Xray或v2ray为主、caddy或nginx为辅,结合trojan或trojan-go及naiveproxy等打造科学上网的优化配置及最优组合示例,分享给大家食用及备份。
Stars: ✭ 249 (+186.21%)
Mutual labels:  haproxy
Haproxy Ingress
HAProxy Ingress
Stars: ✭ 702 (+706.9%)
Mutual labels:  haproxy
Esa Restlight
ESA Restlight is a lightweight and rest-oriented web framework.
Stars: ✭ 67 (-22.99%)
Mutual labels:  haproxy
Tks
Enable enthusiasts and administrators alike to easily provision highly available and production-ready Kubernetes clusters on Proxmox VE.
Stars: ✭ 319 (+266.67%)
Mutual labels:  haproxy
Haproxy exporter
Simple server that scrapes HAProxy stats and exports them via HTTP for Prometheus consumption
Stars: ✭ 465 (+434.48%)
Mutual labels:  haproxy
Fullstack
Full-stack DevOps demo
Stars: ✭ 19 (-78.16%)
Mutual labels:  haproxy
dns-resolver-infra
Privacy DNS infrastructure
Stars: ✭ 39 (-55.17%)
Mutual labels:  haproxy
Docker Cloud Platform
使用Docker构建云平台,Docker云平台系列共三讲,Docker基础、Docker进阶、基于Docker的云平台方案。OpenStack+Docker+RestAPI+OAuth/HMAC+RabbitMQ/ZMQ+OpenResty/HAProxy/Nginx/APIGateway+Bootstrap/AngularJS+Ansible+K8S/Mesos/Marathon构建/探索微服务最佳实践。
Stars: ✭ 86 (-1.15%)
Mutual labels:  haproxy
Multitor
Create multiple TOR instances with a load-balancing.
Stars: ✭ 624 (+617.24%)
Mutual labels:  haproxy
Ansible Config encoder filters
Ansible role used to deliver the Config Encoder Filters.
Stars: ✭ 48 (-44.83%)
Mutual labels:  haproxy
Kubernetes Ingress
HAProxy ingress controller for K8s
Stars: ✭ 367 (+321.84%)
Mutual labels:  haproxy
Marathon Lb
Marathon-lb is a service discovery & load balancing tool for DC/OS
Stars: ✭ 449 (+416.09%)
Mutual labels:  haproxy
Kanary
Kubernetes Operator to manage canary deployment using HAProxy
Stars: ✭ 14 (-83.91%)
Mutual labels:  haproxy
Tcp Shaker
💓 Performing TCP handshake without ACK in Go, useful for health checking, that is SYN, SYN-ACK, RST.
Stars: ✭ 289 (+232.18%)
Mutual labels:  haproxy
Haproxy Rest
REST interface for HAproxy written in GO
Stars: ✭ 79 (-9.2%)
Mutual labels:  haproxy
docker-haproxy-certbot
Dockerized HAProxy with Let's Encrypt certificates automatic renewal
Stars: ✭ 28 (-67.82%)
Mutual labels:  haproxy
Rotating Proxy
Rotating TOR proxy with Docker
Stars: ✭ 739 (+749.43%)
Mutual labels:  haproxy
Voyager
🚀 Secure HAProxy Ingress Controller for Kubernetes
Stars: ✭ 1,276 (+1366.67%)
Mutual labels:  haproxy
Ansible Haproxy
Ansible role to set up (the latest version of) HAProxy in Ubuntu systems
Stars: ✭ 83 (-4.6%)
Mutual labels:  haproxy
Lethean Vpn
Lethean Virtual Private Network (VPN)
Stars: ✭ 29 (-66.67%)
Mutual labels:  haproxy

.. haproxyadmin .. README.rst

============ haproxyadmin

*A Python library to manage HAProxy via stats socket.*

.. contents::

Introduction

haproxyadmin is a Python library for interacting with HAProxy_ load balancer to perform operations such as enabling/disabling servers. It does that by issuing the appropriate commands over the stats socket_ provided by HAProxy. It also uses that stats socket for retrieving statistics and changing settings.

HAProxy is a multi-process daemon and each process can only be accessed by a distinct stats socket. There isn't any shared memory for all these processes. That means that if a frontend or backend is managed by more than one processes, you have to find which stats socket you need to send the query/command. This makes the life of a sysadmin a bit difficult as he has to keep track of which stats socket to use for a given object(frontend/backend/server).

haproxyadmin resolves this problem by presenting objects as single entities even when they are managed by multiple processes. It also supports aggregation for various statistics provided by HAProxy. For instance, to report the requests processed by a frontend it queries all processes which manage that frontend and return the sum.

The library works with Python 2.7 and Python 3.6, but for development and testing Python 3.6 is used. The Six Python 2 and 3 Compatibility Library_ is being used to provide the necessary wrapping over the differences between these 2 major versions of Python.

.. code-block:: python

>>> from haproxyadmin import haproxy
>>> hap = haproxy.HAProxy(socket_dir='/run/haproxy')
>>> frontends = hap.frontends()
>>> for frontend in frontends:
...     print(frontend.name, frontend.requests, frontend.process_nb)
...
frontend_proc2 0 [2]
haproxy 0 [4, 3, 2, 1]
frontend_proc1 0 [1]
frontend1_proc34 0 [4, 3]
frontend2_proc34 0 [4, 3]
>>>
>>>
>>> backends = hap.backends()
>>> for backend in backends:
...    print(backend.name, backend.requests, backend.process_nb)
...    servers = backend.servers()
...    for server in servers:
...       print(" ", server.name, server.requests)
...
backend_proc2 100 [2]
  bck_proc2_srv4_proc2 25
  bck_proc2_srv3_proc2 25
  bck_proc2_srv1_proc2 25
  bck_proc2_srv2_proc2 25
haproxy 0 [4, 3, 2, 1]
backend1_proc34 16 [4, 3]
  bck1_proc34_srv1 6
  bck_all_srv1 5
  bck1_proc34_srv2 5
backend_proc1 29 [1]
  member2_proc1 14
  member1_proc1 15
  bck_all_srv1 0
backend2_proc34 100 [4, 3]
  bck2_proc34_srv2 97
  bck2_proc34_srv1 2
  bck_all_srv1 1
>>>

The documentation of the library is available at http://haproxyadmin.readthedocs.org

Features

  • HAProxy in multi-process mode (nbproc >1)
  • UNIX stats socket, no support for querying HTTP statistics page
  • Frontend operations
  • Backend operations
  • Server operations
  • ACL operations
  • MAP operations
  • Aggregation on various statistics
  • Change global options for HAProxy

Installation

Use pip::

pip install haproxyadmin

From Source::

sudo python setup.py install

Build (source) RPMs::

python setup.py clean --all; python setup.py bdist_rpm

Build a source archive for manual installation::

python setup.py sdist

Release

#. Bump versions in docs/source/conf.py and haproxyadmin/init.py

#. Commit above change with::

  git commit -av -m'RELEASE 0.1.3 version'

#. Create a signed tag, pbr will use this for the version number::

  git tag -s 0.1.3 -m 'bump release'

#. Create the source distribution archive (the archive will be placed in the dist directory)::

  python setup.py sdist

#. pbr will update ChangeLog file and we want to squeeze them to the previous commit thus we run::

  git commit -av --amend

#. Move current tag to the last commit::

  git tag -fs 0.1.3 -m 'bump release'

#. Push changes::

  git push;git push --tags

Development

I would love to hear what other people think about haproxyadmin and provide feedback. Please post your comments, bug reports, wishes on my issues page <https://github.com/unixsurfer/haproxyadmin/issues>_.

Licensing

Apache 2.0

Acknowledgement

This program was originally developed for Booking.com. With approval from Booking.com, the code was generalised and published as Open Source on github, for which the author would like to express his gratitude.

Contacts

Project website: https://github.com/unixsurfer/haproxyadmin

Author: Pavlos Parissis [email protected]

.. _HAProxy: http://www.haproxy.org/ .. _stats socket: http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#9.2 .. _Six Python 2 and 3 Compatibility Library: https://pythonhosted.org/six/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].