README.md
1HAProxyctl
2==========
3
4HAProxy control tool
5
6Build Status
7------------
8
9[![Build Status](https://travis-ci.org/neurogeek/haproxyctl.png?branch=master)](https://travis-ci.org/neurogeek/haproxyctl)
10
11About
12--------
13
14HAProxyctl is a tool to manage the various aspects of HAProxy that can be controlled by means of its socket.
15
16With HAProxyctl, it is possible to do the following:
17
18(New in 0.5)
19* Support for Python3.
20
21(New in 0.4)
22* Ability to pass a tcp:// or a unix:// socket address to -k|--socket
23
24(New in 0.3)
25* frontends - Lists available Frontends. Arguments: None
26* backends - Lists available Backends. Arguments: None
27
28(New in 0.2)
29* info - Shows errors on HAProxy instance. Arguments: None
30* enable - Enables given backend/server Arguments: backend,server
31* disable - Disables given backend/server Arguments: backend,server
32* get-weight - Get weight for a given backend/server. Arguments: backend,server
33* set-weight - Set weight for a given backend/server. Arguments: backend,server,weight
34* servers - Lists servers in the given backend Arguments: backend
35
36Modes
37-----
38
39HAProxyctl can be used in 2 modes. CLI mode and Python API mode.
40CLI mode, as the name implies, gives you a command, haproxyctl, that can be used to control HAProxy.
41
42You can use the Python API mode to integrate HAProxyctl directly in your Python project.
43
44Every command in HAProxyctl has at least two methods: getResut and getResultObj.
45
46The method getResult returns a formatted string with the results obtained by executing the given HAProxy command, while getResultObj returns a Python object with the results, making it easy to use this results in some Python code.
47
48CLI Usage
49---------
50
51```
52usage: haproxyctl [-h] [-v] [-c COMMAND] [-l] [-H] [-s SERVER] [-b BACKEND]
53 [-w WEIGHT] [-k SOCKET]
54
55Tool to interact with HAProxy
56
57optional arguments:
58 -h, --help show this help message and exit
59 -v, --verbose Be verbose.
60 -c COMMAND, --command COMMAND
61 Type of command. Default info
62 -l, --list-commands Lists available commands.
63 -H, --help-command Shows help for the given command.
64 -s SERVER, --server SERVER
65 Attempt action on given server.
66 -b BACKEND, --backend BACKEND
67 Set backend to act upon.
68 -w WEIGHT, --weight WEIGHT
69 Specify weight for a server.
70 -k SOCKET, --socket SOCKET
71 Socket to talk to HAProxy. It accepts
72 unix:///path/to/socket or tcp://1.2.3.4[:port]
73 addresses. If there is no match
74 for protocol, then it assumes a UNIX socket file.
75```
76