Hacked By AnonymousFox
�
)�fP6 � �� � d dl mZ d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZd dl m
Z
mZ d dlm
Z
mZmZ d dlmZ d dlmZ dZ G d � d
e� � Z G d� de� � Z G d
� de� � ZdS )� )�absolute_import)�divisionN)�run_command�ExternalProgramFailed)�atomic_write_csv�atomic_write_str�deserialize_lve_id)�LveStatsPlugin)�mempages_to_bytes�iseletskc �8 � e Zd Zdd�Zd� Zed� � � Zd� ZdS )� FileSaver�
/var/lve/infoc �F � || _ t j d� � | _ dS )z:type fname: strzplugin.file_saverN��fname�logging� getLogger�log��selfr s ��/builddir/build/BUILDROOT/lve-stats-4.2.8-1.el8.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/lvestats/plugins/generic/persistors.py�__init__zFileSaver.__init__ s � ���
��$�%8�9�9����� c � � t | j |� � dS # t $ r0}| j � d| j � d|� �� � Y d}~dS d}~ww xY w)z9
:type output: list
:rtype: None
�Error during saving the "�" file: N)r r �OSErrorr �error)r �output�es r �writezFileSaver.write s| � �
P��T�Z��0�0�0�0�0��� P� P� P��H�N�N�N�t�z�N�N�1�N�N�O�O�O�O�O�O�O�O�O����� P���s � �
A�%A�Ac � � | j |j k pR| j |j k pB| j |j k p2| j |j k p"| j |j k p| j dz |j k }|dk r| j |j k }nd}|p|S )z�
:type LVE_VERSION: int
:type lve_usage: lvestats.plugins.generic.aggregators.AggregatedLveUsage
:type lve_stat: lvestat.LVEStat
� � F)�lep�cpu�lcpu�lmem�lmemphy�lnproc�io�liops)�lve_stat� lve_usage�LVE_VERSION�res1�res2s r �compare_limitszFileSaver.compare_limits) s� � �
�L�I�M�)�
/��L�I�N�*�
/��M�Y�^�+�
/�
�� � 1�1�
/�
�O�y�/�/�
/�
�K�$��)�,�.�
� ��?�?��>�Y�_�4�D�D��D��|�t�r c �` � |d }|� di � � }|d }g }|� � � D �]"\ }}g }|� |t |j � � t |j � � t |j � � t |j � � t |j � � t |j � � t |j
� � t |j � � t |j � � t |j
� � t |j � � t |j � � t |j � � t |j � � dt |j � � dz t |j � � dz g� � |dk r;|� t |j � � t |j � � g� � |� dgdt- |� � z
z � � |� |j � � |� |j � � |� |j � � |� |� � ��$|� � � D �]�\ }} t7 |� � \ }}
|
r�|�r�||v�rd|vr| j � d � � �B| � | |d |�
� � �rAg }|� |dt | j � � dt | j � � dt | j � � ddt | j � � ddt | j � � ddddt | j � � g� � |dk r)|� t | j � � dg� � |� dgdt- |� � z
z � � |� d� � |� d� � |� d� � |� |� � ���| � |� � dS )z:type lve_data: dictr0 �lve_usage_5s�statsr r$ � � � z/No defaults collected to compare with, skipping)r. r/ r0 N)!�get�items�extend�int�mepr&