HaproxyCfg - file /etc/haproxy/haproxy.cfg

Contents of the haproxy.cfg file look like:

global
    daemon
    group       haproxy
    log         /dev/log local0
    user        haproxy
    maxconn     20480
    pidfile     /var/run/haproxy.pid

defaults
    retries     3
    maxconn     4096
    log         global
    timeout     http-request 10s
    timeout     queue 1m
    timeout     connect 10s

If there are duplicate key items, merge them in to one. Like:

option  tcpka
                        }--->    option: ["tcpka","tcplog"]
option  tcplog
insights.parsers.haproxy_cfg.data

Dictionary of all parsed sections.

Type

dict

insights.parsers.haproxy_cfg.lines

List of all non-commented lines.

Type

list

Examples

>>> cfg = shared[HaproxyCfg]
>>> cfg.data['global']
{"daemon": "", "group": "haproxy", "log": " /dev/log local0",
 "user": "haproxy", "maxconn": "20480", "pidfile": "/var/run/haproxy.pid"}
>>> cfg.data['global']['group']
"haproxy"
>>> 'global' in cfg.data
True
>>> 'user' in cfg.data.get('global')
True
class insights.parsers.haproxy_cfg.HaproxyCfg(context)[source]

Bases: insights.core.Parser

Class to parse file haproxy.cfg.

parse_content(content)[source]

This method must be implemented by classes based on this class.