HEX
Server: LiteSpeed
System: Linux ws4.angoweb.net 5.14.0-611.13.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 11 04:57:59 EST 2025 x86_64
User: tswangoe (2287)
PHP: 8.1.33
Disabled: show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open
Upload Files
File: //usr/local/lib/python3.9/site-packages/agent360/plugins/__pycache__/haproxy.cpython-39.pyc
a

q�dg��@sHddlZddlZddlZddlZGdd�dej�ZedkrDe���dS)�Nc@seZdZdZdd�ZdS)�Plugin�haproxycCsNt�}t�}z$|�dd�}|�dd�}||f}Wnd}Yn0|�dd�}d|vr^|d}tj||d�}t��|d<|��}	|jd	ur�|j�d
�}
nd�|j�Sd}d
}t	�
|
�}
t�}ttg}|
D�]h}i||dd|d<i||dd|d<z$|	d|	|dd|dd<Wn,t
�yNi|	|dd|d<Yn0|��D]�\}}|D](}z||�}Wnt�y�Yn0�qd||v�r�|||dd|d|<nx||v�rXt|�tu�rX|�|t|�|	|dd|d�||dd|d|<t|�||dd|d|<n�qXq�t��|d<|�|�|S)Nr�username�passwordF�status_page_urlz;csv)�auth�ts���
z&Could not load haproxy status page: {})ZqcurZqmaxZscurZsmaxZslimZstotZweightZqlimitZthrottleZlbtotZtrackedZrateZrate_limZrate_maxZhanafailZreq_rateZreq_rate_maxZreq_totZ	conn_rateZ
conn_rate_maxZconn_tot)�binZboutZcli_abrtZsrv_abrtZinterceptedZhrsp_1xxZhrsp_2xxZhrsp_3xxZhrsp_4xxZ
check_riseZ
check_fallZcheck_healthZ
agent_riseZ
agent_fallZhrsp_5xxZcomp_inZcomp_outZcomp_bypZcomp_rspZ
hrsp_otherZdconZdreqZdrespZereqZeconZerespZwretrZwredisZdsesz# pxname�/Zsvname)�dict�get�requests�timeZget_agent_cache�status_code�text�split�format�csv�
DictReader�str�float�KeyError�items�
ValueError�typeZabsolute_to_per_secondZset_agent_cache)�self�config�resultsZ
next_cacherr�	user_passr�requestZ
prev_cache�responseZ	non_delta�deltaZ
csv_reader�data�constructors�row�k�v�c�r*�B/usr/local/lib/python3.9/site-packages/agent360/plugins/haproxy.py�runsX

1

$

>"
z
Plugin.runN)�__name__�
__module__�__qualname__r,r*r*r*r+r	sr�__main__)rZpluginsrrZ
BasePluginrr-�executer*r*r*r+�<module>s