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/states/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

;j��@sFdZddlmZdgZddd�Zdd	�Zd
d�Zdd
�Zddd�ZdS)a�
Disk monitoring state

Monitor the state of disk resources.

The ``disk.status`` function can be used to report that the used space of a
filesystem is within the specified limits.

.. code-block:: sls

    used_space:
      disk.status:
        - name: /dev/xda1
        - maximum: 79%
        - minimum: 11%

It can be used with an ``onfail`` requisite, for example, to take additional
action in response to or in preparation for other states.

.. code-block:: sls

    storage_threshold:
      disk.status:
        - name: /dev/xda1
        - maximum: 97%

    clear_cache:
      cmd.run:
        - name: rm -r /var/cache/app
        - onfail:
          - disk: storage_threshold

To use kilobytes (KB) for ``minimum`` and ``maximum`` rather than percents,
specify the ``absolute`` flag:

.. code-block:: sls

    used_space:
      disk.status:
        - name: /dev/xda1
        - minimum: 1024 KB
        - maximum: 1048576 KB
        - absolute: True
�)�path�status��%c	Cs�d}zt|t�r|�d|�}t|�}Wnttfy)||�d�7}Y||fSwt|�dkrD||dks<||dkrD|d�||�7}||fS)zp
    Validate the named integer within the supplied limits inclusive and
    strip supplied unit characters
    �� z must be an integer �r�z*{0} must be in the range [{1[0]}, {1[1]}] )�
isinstance�str�strip�int�	TypeError�
ValueError�len�format)�name�valueZlimitsr�commentrr�D/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/disk.py�
_validate_int5s
��rc	Csd|rt||d�}t||d�}nt||d�d��}d|}|||d<t|||||||�S)N�used�	availableZcapacityr�d�data)r
r�_check_min_max)	r�ret�minimum�maximum�absolute�freerrrrrr�
_status_mountLsr!c	Cst�|�durd|d<|dd�|�7<|Std|�}|r9t||d�t||d�}t||d�}nCt||d�dkrHd}d}n4ttt||d�t||d��t||d�d	d
�}tt||d�t||d�d	d
�}||d<t|||||||�S)NF�resultrz1Directory {} does not exist or is not a directoryzstatus.diskusage�totalrrrr	r)r�isdirr�__salt__r
�round�floatr)	�	directoryrrrrr rrrrrr�_status_path[s>� "������r)cCs�|rdnd}|dur+|r||krd�|||�|d<|Sn||kr+d�|||�|d<|S|durP|rA||kr@d�|||�|d<|Sn||krPd�|||�|d<|Sd|d<d	|d
<|S)N�KBrz;Disk available space is below minimum of {0} {2} at {1} {2}rz6Disk used space is below minimum of {0} {2} at {1} {2}z;Disk available space is above maximum of {0} {2} at {1} {2}z6Disk used space is above maximum of {0} {2} at {1} {2}z#Disk used space in acceptable rangeTr")r)rr rrrrrZunitrrrr~s@
����
����rNFcCs|ddiid�}|dur*|std|ddg�\}}n	td|dd	�\}}|d
|7<|durL|s;td|ddg�\}}n	td|dd	�\}}|d
|7<|dur`|dur`||kr`|d
d7<|d
rf|Std
�}||vr�|d
d|�d�7<t||||||�St|||||||�S)a(
    Return the current disk usage stats for the named mount point

    name
        Disk mount or directory for which to check used space

    maximum
        The maximum disk utilization

    minimum
        The minimum disk utilization

    absolute
        By default, the utilization is measured in percentage. Set
        the `absolute` flag to use kilobytes.

        .. versionadded:: 2016.11.0

    free
        By default, `minimum` & `maximum` refer to the amount of used space.
        Set to `True` to evaluate the free space instead.
    Fr)rr"rZchangesrNrrrr*)rrrz"minimum must be less than maximum z
disk.usagezDisk mount z not present. )rr%r)r!)rrrrr rrrrrrr�s4�	
)rr)NNFF)	�__doc__�osrZ__monitor__rr!r)rrrrrr�<module>s-�
#)

Youez - 2016 - github.com/yon3zu
LinuXploit