ok
Mini Shell
�
���f����ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl
Z
ddlZddlZddl
Z
ddlZddlmZmZddlmZmZddlmZddlmZddlmZddlmZddlmZdd lmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%ddl&Z'ddl(Z(ddl)Z)ddl*Z*dd
l+m,Z,ddl-m.Z.ddl/m0Z0m1Z1m2Z2dd
l3m4Z4ddl5m6Z6m7Z7ddl8m9Z9ddl:m;Z;m<Z<m=Z=ddl>m?Z?ddl@mAZAddlBmCZCddlDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOddlPmQZQmRZRmSZSddlTmUZUddlVmWZWmXZXddlYmZZZm[Z[ddl\m]Z]ddl^m_Z_ddl`maZbddlcmdZdddlemfZfmgZgddlhmiZimjZjmkZkmlZlmmZmmnZnmoZompZpmqZqmrZrmsZsmtZtmuZumvZvmwZwmxZxmyZyddlzm{Z{m|Z|m}Z}dd l~mZd!d"l�m�Z�d!d#l�m�Z� dd$l�m�Z�dd%l�m�Z�m�Z�m�Z�m�Z�m�Z�m�Z�dd&l�m�Z�dd'l�m�Z�ddl�maZ�n#e�$rejZ�ejZ�ejZ�ejZ�ejZ�ejZ�ejZ�dZ�dZ�dZ�YnwxYw dd(l�m�Z�n#e�$rd)�Z�YnwxYwd*Z�ej�d+��Z�d,Z�d-Z�d.Z�d/Z�d0Z�d1Z�d2Z�d3Z�d4e�d5e�fd6�Z�Gd7�d8��Z�d9�Z�dS):�N)�Counter�defaultdict)� lru_cache�partial)�groupby)� cpu_count)�
attrgetter)�Path)�getfqdn)�Any�AnyStr�Callable�Dict�List�Optional�Tuple�Union)�get_hidepid_typing_from_mounts)�cpapi)�
find_wp_paths�get_wp_cache_plugin� get_wp_paths_with_enabled_module)�Feature)�is_panel_feature_supported�is_wp2_environment)�
MySQLGovernor)�
CLEditions�is_cl_shared_edition�is_cl_solo_edition)�client_activation_data)�ACCELERATE_WP_INSTALLED_FROM_CM)�
SysCtlConf)�ExternalProgramFailed�get_cl_version�get_rhn_systemid_value�
get_virt_type�grep�is_litespeed_running�is_nginx_running�is_secureboot_enabled�is_testing_enabled_repo� is_ubuntu�run_command)�cagefs_statistics_config�clconfig_utils�db_governor_lib)�is_email_notification_enabled)�print_dictionary�replace_params)�DEFAULTS�LimitsDataStorage)�EMPTY_LIMITS)�ALL_MODULES)�PKG_VERSION)�LvpMap)�CONFIG_PATH�_read_config_file)�
SummaryStatus�dummy_none_function�get_cl_plus_sender_status�get_client_data_from_jwt_token� get_packages_with_lve_extensions�$get_statistics_send_status_from_file�is_active_cloudlinux_license�is_nodejs_selector_installed�is_php_selector_installed�is_python_selector_installed�is_ruby_selector_installed�is_sending_process_running�is_statistic_enabled�is_statistic_rpm_enabled� set_statistic_collection_enabled�$set_statistic_rpm_collection_enabled�$write_statistics_send_status_to_file)�NotSupported�get_cpu_metrics�get_memory_metrics)�get_rpm_packages_info�)�parse_cloudlinux_summary_opts)�StatisticsDict)�get_default_version)�get_default_php_version�get_mode_of_php_selector�get_native_version_safe�get_php_selector_usage�get_versions_statistics�iter_server_applications)�CloudlinuxSelectorLib)�PKG_RELEASE)�list_flags_infoc��gS�N�r`��H/opt/cloudlinux/venv/lib64/python3.11/site-packages/clsummary/summary.pyr]r]�s��� raz/var/log/cloudlinux-summary.logzcloudlinux-summary�unknown� installed�
not_installed�not_initialized�not_selected�enabled�disabledz-42� site_dict�returnc�n�ttd�|d�������S)zB
Checks if wordpress site has at least one enabled module
c��|dS)Nrhr`)�modules rb�<lambda>z*site_has_enabled_modules.<locals>.<lambda>�s��&��"3�ra�modules)�any�map�values)rjs rb�site_has_enabled_modulesrt�s1���s�3�3�Y�y�5I�5P�5P�5R�5R�S�S�T�T�Trac���eZdZdZdZejgd�eje j
��eje j��eje j��g��Z
dZdZdZd�Zed���Zed ���Zed
efd���Zed���Zed
���Zed���Zd
efd�Zed���Zd�Zd�Zed
e fd���Z!ed���Z"eded
efd���Z#d�Z$d�Z%ed���Z&d�Z'ed�d���Z(d�Z)ed���Z*ed���Z+ed e,e-e-fd
e fd!���Z.d"�Z/d#�Z0ed$e1d%e2d
dfd&���Z3d'e,e2e1fd(e2d)e d
dfd*�Z4d+�Z5ed,���Z6d-�Z7d.�Z8ed
efd/���Z9d�d0�Z:d�d1�Z;ed2���Z<ed3���Z=d4�Z>ed5���Z?d�d6�Z@d
eAe1fd7�ZBd
eAe1fd8�ZCed
eAe1fd9���ZDd�d:�ZEd;eFd
dfd<�ZGd;eFd
dfd=�ZHd;eFd
dfd>�ZId�d?�ZJd�d@�ZKdA�ZLdB�ZMdC�ZNdD�ZOedEedFePfdG���ZQd
eRePeSePeSe,ee1fffdH�ZTd
eReUeeUeffdI�ZVdJedKedLe,eefd
e,eeWePefffdM�ZXdNed
efdO�ZYeeZd�P��dQ�����Z[d�dR�Z\d�dS�Z]edTe1dUe1d
eAe1fdV���Z^edTe1dWe1d
eAe1fdX���Z_edYe`d
e1fdZ���ZaedYe`d
e1fd[���ZbedYe`d
e1fd\���ZcedYe`d
edfd]���ZedYe`d
e1fd^�ZfedYe`d
e1fd_���ZgedYe`d
e1fd`���ZhdYe`d
efda�Ziedbedced
e`efdd���Zjeded
e`fde���Zkd�df�Zled
efdg���Zmd�dh�Znedi���Zodj�Zpedk���Zqedl���Zredm���Zsed
e fdn���Zted
e fdo���Zued
e1fdp���Zved
efdq���Zwedr���Zxds�Zydt�Zzdue2d
eAe1fdv�Z{dw�Z|dx�Z}dy�Z~dz�Zed
e,fd{���Z�d|�Z�d}�Z�d
eRe1e1e1ffd~�Z�ed
eRe1effd���Z�d��Z�d��Z�d�d��Z�d�d��Z�d�d��Z�d��Z�d��Z�d��Z�d��Z�d��Z�ed����Z�d��Z�d
eAe1fd��Z�d
eAe1fd��Z�e�d����Z�ed����Z�ed����Z�d;eFd
e`e�e1efd�ffd��Z�d�e1d;eFd
eAeRe1effd��Z�d��Z�e d�d�ed�e�dzd�e1d�e dzd
e�j�f
d����Z�ed�d�ed�e1d
eAdfd����Z�ed
eAe,fd����Z�ed����Z�ed����Z�ed����Z�ed����Z�ed
eAe,fd����Z�ed
efd����Z�ed�ed
e1fd����Z�ed
eAe,fd����Z�d
e,fd��Z�ed
eAe,fd����Z�ed
eAe,fd����Z�dS)��CloudlinuxSummaryz/var/lve/dashboard_certificatez/etc/cl_plus/.disabled)�python�ruby�nodejsz5https://papi.g.geo.mycache.org/api/stat-api/clos-statz,https://papi.g.geo.mycache.org/api/rpm-statsz=https://1.mirror.g.cdn.mycache.org/static/cl-settings-v1.jsonc���i|_d|_t��|_d|_d|_|���|_d|_t��|_
dSr_)�_opts�_security_tokenrS�
statistics�_lvpmap�
_system_id�_is_process_not_limited�is_process_not_limited�packages_by_lenr"�sysctl��selfs rb�__init__zCloudlinuxSummary.__init__�sW����
�#���*8�*:�*:���������&*�&B�&B�&D�&D��#�#��� �l�l����rac��ttj�d����}ttj�d����}|o|S)zm
Return true if process is running outside LVE or it's not running by
utility `nice`
�RUNNING_BY_NICE�RUNNING_IN_LVE)�bool�os�environ�get)�is_running_by_nice�is_running_in_lves rbr�z)CloudlinuxSummary._is_process_not_limited�sP��"�"�*�.�.�1B�"C�"C�D�D�� �����0@�!A�!A�B�B��%�%�?�.?�*?�?rac�D�|j�t��|_|jS)z.
Load lvpmap only when needed
)r~�_get_lvpmapr�s rb�lvpmapzCloudlinuxSummary.lvpmap�s��
�<��&�=�=�D�L��|�rarkc�F�|j�td��|_|jS)N� system_id)rr%r�s rbr�zCloudlinuxSummary.system_id�s#���?�"�4�[�A�A�D�O���rac�&�t��rdndS)N�ubuntu� rhel_like)r,r`rarb�
_get_platformzCloudlinuxSummary._get_platform�s��$�;�;�7�x�x�K�7rac�:�t��rtntSr_)r*�ENABLED�DISABLEDr`rarb�_detect_securebootz$CloudlinuxSummary._detect_secureboot�s��/�1�1�?�w�w�x�?rac���tjtjz�d��fd�t d��D����}|S)N�c3�@�K�|]}tj���V��dSr_)�random�choice)�.0�_�range_for_random_choices �rb� <genexpr>z=CloudlinuxSummary._generate_security_token.<locals>.<genexpr>�s.����� [� [�A���/F�!G�!G� [� [� [� [� [� [ra�@)�string�
ascii_letters�digits�join�range)�security_tokenr�s @rb�_generate_security_tokenz*CloudlinuxSummary._generate_security_token�sI���"(�"6���"F����� [� [� [� [�QV�WY�QZ�QZ� [� [� [�[�[���rac���i}|j�3d}t�|��|�d|i��d|j��}t�|��|j|jd�}d} tj|j|d���}n\#tj $rJ}t|��}t�|��|�d|i��Yd}~nd}~wwxYw|jsCd|j�d|j
��}t�|��|�d|i��t�d �� |���d}t|dt ��r-|d�|�����t�d
��n�#t&t(f$r6d}t�|��|�d|i��Yndt*$rX}t�dt|��|j��|�dd
t.�d�i��Yd}~nd}~wwxYw|S)NzSecurity token is empty�resultzGetting statistics from server )r�r��<)�params�timeout�Server answer is: HTTP code �
; Reason: z!Received response from the serverz,SUCCESS: received statistics from the serverz Can't parse api response to jsonz=Invalid json response from server, field %s not found in "%s"z"Invalid response from server. See z
for details.)r��
app_logger�error�_error_and_exit�SUMMARY_URL�infor��requestsr��RequestException�str�ok�status_code�reason�json�
isinstance�dict�update�_get_smart_advice_statistics� TypeError�
ValueError�KeyError�text�LOG_FILE)r�� stat_data�messager��response�es rb�_get_remote_dataz"CloudlinuxSummary._get_remote_data�s���� ���&�/�G����W�%�%�%�� � �(�G�!4�5�5�5�F�D�4D�F�F������ � � ���"�1�
�
���� 6��|�D�$4�V�R�P�P�P�H�H���(� 6� 6� 6��!�f�f�G����W�%�%�%�� � �(�G�!4�5�5�5�5�5�5�5�5����� 6����
�{� 6�f�X�5I�f�f�U]�Ud�f�f�G��O�O�G�$�$�$�� � �(�G�!4�5�5�5����;�<�<�<� L� �
�
����1�I��)�H�-�t�4�4�
P��(�#�*�*�4�+L�+L�+N�+N�O�O�O�
�O�O�J�K�K�K�K���:�&� 6� 6� 6�8�G����W�%�%�%�� � �(�G�!4�5�5�5�5�5�� n� n� n����\�^a�bc�^d�^d�fn�fs�t�t�t�� � �(�,k�T\�,k�,k�,k�!l�m�m�m�m�m�m�m�m����� n�����s:�3B�C)�AC$�$C)�A"G�AI5� I5�AI0�0I5c��|j�|jStj�|j��r|���|_n2|���}|�|��r|nd|_|jSr_)r|r��path�isfile�DASHBOARD_CERTIFICATE�_read_token_from_filer��_write_token_to_file)r��tokens rbr�z CloudlinuxSummary.security_tokens�����+��'�'�
�7�>�>�$�4�5�5� W�#'�#=�#=�#?�#?�D� � ��1�1�3�3�E�,0�,E�,E�e�,L�,L�#V�5�5�RV�D� ��#�#rac�R� t|jdd���5}|�|��ddd��n#1swxYwYtj|jd��dS#t
tf$r3}t�dt|����Yd}~dSd}~wwxYw) z�
Write security token to file and return success/fail status
:param token: generated security token
:return: T/F status
�w�utf-8��encodingNi�Tz,Error while writing secure token to file: %sF)
�openr��writer��chmod�IOError�OSErrorr�r�r�)r�r��fr�s rbr�z&CloudlinuxSummary._write_token_to_file!s��� ��d�0�#��H�H�H�
�A��������
�
�
�
�
�
�
�
�
�
�
����
�
�
�
��H�T�/��7�7�7��4����!� � � ����K�S�QR�V�V�T�T�T��5�5�5�5�5����� ���s4�A"�;�A"�?�A"�?�A"�"B&�3(B!�!B&c�D� t|jdd���5}|������pdcddd��S#1swxYwYdS#tt
f$r3}t�dt|����Yd}~dSd}~wwxYw)N�rr�r�z.Error while reading file with secure token: %s) r�r��read�stripr�r�r�r�r�)r�r�r�s rbr�z'CloudlinuxSummary._read_token_from_file0s��� ��d�0�#��H�H�H�
0�A��v�v�x�x�~�~�'�'�/�4�
0�
0�
0�
0�
0�
0�
0�
0�
0�
0�
0�
0����
0�
0�
0�
0�
0�
0����!� � � ����M�s�ST�v�v�V�V�V��4�4�4�4�4����� ���s:�A�(A�A�A�A�A�A�B�,(B�Bc�F�tjtjddd���S)z�
Detect old LVE limits integration presence according to
https://docs.cloudlinux.com/index.html?lve_limits_with_packages.html
:return: True/False - present/absent
�CUSTOM_GETPACKAGE_SCRIPT�=F)� file_name�
param_name� separator�default_val)�detect�get_boolean_param�CL_CONFIG_FILEr`rarb�_detect_old_lve_integrationz-CloudlinuxSummary._detect_old_lve_integration8s-���'��+�1���
�
�
�
rac�@�tj�d��S)zO
Detects presence/absence of lsapi
:return: True/False
�/usr/bin/switch_mod_lsapi�r�r��existsr`rarb�_is_lsapi_presentz#CloudlinuxSummary._is_lsapi_presentGs���w�~�~�9�:�:�:ra�interpreterc��|dkrt��stSnY|dkrt��rtntS|dkrt ��stSn|dkrt��stSt
|��}|�tS|dvr@ |���drtntS#t$r
tcYSwxYw|dkr"|�
��rtntStd|�����) zP
Get selector status for nodejs, python, ruby and php selectors
rwrxry�phpN)ryrw�selector_enabledzUnknown interpreter: )rE�
NOT_INSTALLEDrFr�rCrDr[�get_selector_statusr�r��php_selector_is_disabledr�)r��libs rb�_get_status_of_selectorz)CloudlinuxSummary._get_status_of_selectorOs8���(�"�"�/�1�1�
%�$�$�
%�
�F�
"�
"�8�:�:�M�7�7�
�M�
�H�
$�
$�/�1�1�
%�$�$�
%�
�E�
!�
!�*C�*E�*E�
!� � �#�K�0�0���;� � ��.�.�.�
%�"%�"9�"9�";�";�<N�"O�]�w�w�U]�]���
%�
%�
%�$�$�$�$�
%����
�E�
!�
!�"�;�;�=�=�J�8�8�7�J��>��>�>�?�?�?s�'B;�;C�Cc�� tj|d������}|S#tj$rW}t�dt
|����|�dt
|��i��Yd}~dSd}~wttf$r3}t�dt
|����Yd}~dSd}~wwxYw)N�
)r�z3Request exception while getting remote settings: %sr�z'Error while parsing remote settings: %s)
r�r�r�r�r�r�r�r�r�r�)r��settings_url�settingsr�s rb�_get_remote_settingsz&CloudlinuxSummary._get_remote_settingsms��� ��|�L�"�=�=�=�B�B�D�D�H��O���(� 5� 5� 5����R�TW�XY�TZ�TZ�[�[�[�� � �(�C��F�F�!3�4�4�4�4�4�4�4�4�4������I�&� � � ����F��A���O�O�O��4�4�4�4�4����� ���s!�),�C�AB
�
C�!(C�Cc��|j�d��rdSttj�d����}|rdS|�|j��}|�dS |dd}|ddo|�|��S#t$rW}t�
d t|����|�d
t|��i��Yd}~dSd}~wwxYw)z-
Return cl-statistics status
�--force-collectT�CL_TEST_SYSTEMNFz
cl-statisticsz
rollout-grouprhz4Error occurred while trying to get rollout group: %sr�)
r{r�r�r�r�r�SETTINGS_URL�
_match_serverr�r�r�r�r�)r��is_test_environmentr�
rollout_groupr�s rb�_is_statistics_enabledz(CloudlinuxSummary._is_statistics_enabledxs���:�>�>�+�,�,� ��4�"�2�:�>�>�2B�#C�#C�D�D��� ��4��,�,�T�->�?�?�����5� 5�$�_�5�o�F�M��O�,�Y�7�]�D�<N�<N�}�<]�<]�]��� 5� 5� 5����S�UX�YZ�U[�U[�\�\�\�� � �(�C��F�F�!3�4�4�4�4�4�4�4�4�4����� 5���s�,0B�
C>�'AC9�9C>c�"�t|d��S)N���int)�hash_servers rb�
_to_numberzCloudlinuxSummary._to_number�s���;��#�#�#rac���|j�dStj|j��������dd�}|�|��d|zzdkS)NT��r)r��hashlib�sha256�encode� hexdigestr)r��url_numrs rbrzCloudlinuxSummary._match_server�sa���>�!��4��n�T�^�%:�%:�%<�%<�=�=�G�G�I�I�#�2�#�N������,�,�q�'�z�9�a�?�?raNc��d}|r9t��s/|dz}tjd��|rt���)dSdSdSdS)zC
Wait for running background process of cl-summary
�2rQg�������?N)rG�time�sleep)�retriess rb�_wait_for_background_processz.CloudlinuxSummary._wait_for_background_process�su��
��� �8�:�:� ��q�L�G��J�s�O�O�O�� �8�:�:� � � � � � � � � rac�L
�|jds
|jdrBt|jd��tj��dd�}t|d��dS|jds
|jdrBt |jd��tj��dd�}t|d��dS|jdrpt��rd nd
}tj��|dd�}|�dt��i��t|d��tj d
��|j�
d��r7|���}|�|t�����|j�
d��r�t��s3|j�
d��s|�ddid
���|���|j�
d��r=|�|j|jd���t(�d��nt|jd��dS|���sIt.jdtj��d�}t3|��|�ddid
���|j�
d��r�|j�
d��sWt��sIt.jdtj��d�}t3|��|�ddid
���|j�ld}t(�|��t.jdt8�d �tj��d�}t3|��|�d|i��|j�
d!��r�t��rtj��d dd�}npt3t.jtj��dd"���t=jd#dd$d�%��|� ��tj��dd�}t|d��tj d
��|jdr�|j!rMtd�&��r=tj��d dd�}t|d��tj d
��dSt3t.jtj��dd"���dSdS)'N�enable�disable�success�� timestampr�T�
enable-rpm�disable-rpm�status�
collecting�ready)r$r'r��sending_statusr�
get-remote)�datarH�rpm-packagesrr�z\Sending RPM statistics is disabled by admin. Use --force-collect to ignore admin`s settings.)�
error_code�--sendF��summary�url�save_statuszRPM statistics sentzkStatistics collection is disabled globally. Please, try again later or contact support if it happens again.)r�r�r$zYCollecting statistics is disabled globally. Use --force-collect to ignore global settingsz_Statistics collection is disabled by admin. Run `cloudlinux-summary enable` and then try again.zXSending statistics is disabled by admin. Use --force-collect to ignore admin`s settings.z8Statistics was not sent, because security token is emptyz^We are not able to collect statistics because we are not able to make a security token. Check z for details or contact support.�--async)r�r$r�z9/usr/sbin/cloudlinux-summary --send --json &> /dev/null &� /bin/bash)�shell�
executable�check)�acquire_lock)"r{rJrr2rKrGr�rA�sys�exitr�r��_print_result_and_exitrHrIr��_get_rpm_packages_summary� _send_statistics_and_save_statusr}�RPM_PACKAGES_URLr�r�r
r<�FAILEDrLr�r�r��IN_PROGRESS�
subprocess�runrr�)r�r,r'r��status_dictr�s rb�&_actions_before_run_process_as_limitedz8CloudlinuxSummary._actions_before_run_process_as_limited�sq���:�h�� �4�:�i�#8� �,�T�Z��-A�B�B�B�!%���� �B�B�D��T�4�(�(�(��F��:�l�#� �t�z�-�'@� �0���L�1I�J�J�J�!%���� �B�B�D��T�4�(�(�(��F��:�h�� �%?�%A�%A�N�\�\�w�F�!%�����)�T�T�D��K�K�)�+O�+Q�+Q�R�S�S�S��T�4�(�(�(��H�Q�K�K�K��:�>�>�,�'�'� b��*�*�,�,�F��'�'�V�J^�J`�J`�'�a�a�a��:�>�>�.�)�)� �+�-�-�
�d�j�n�n�EV�6W�6W�
��$�$� �#J�� !�%����
�*�*�,�,�,��z�~�~�h�'�'�
8��5�5� �O��-� %�6����
��� 5�6�6�6�6� ���$�7�7�7��F��*�*�,�,� �'�.�R�!�Y�[�[� ��K�
1��=�=�=�� � ��D���
!�
�
�
��:�>�>�(�#�#� :��:�>�>�"3�4�4�
�=Q�=S�=S�
�+�2�J�!%���� ���5�[�A�A�A��$�$� �#J�� !�%�����"�*�T��� � ��)�)�)�+�2�6�GO�6�6�6�"&�������5�[�A�A�A��$�$�h��%8�9�9�9��:�>�>�)�$�$� �)�+�+�
G�&*�Y�[�[�L�T]�^�^���5�,�8�t�y�{�{�^b�c�c������O��*�� �����1�1�3�3�3�%)�Y�[�[�I�F�F���T�4�(�(�(��H�Q�K�K�K��:�h�� ��*�
�/I�W[�/\�/\�/\�
�&*�Y�[�[�L�T]�^�^�� ��t�,�,�,���������5�,�8�t�y�{�{�^b�c�c������ � rac��tjtjddd�����}tj|��5}|�dt|��g��t
jddt|��dg|zttj
d tjtj
���
�����cddd��S#1swxYwYdS)
z�
Run same command in lve and set environ RUNNING_IN_LVE=1
in order to check it in child process.
:return:
�ri@)�ls_cpu�ls_cpus�
ls_memory_phy�--lve-idz/bin/lve_suwrapper�-n�/usr/sbin/cloudlinux-summary�1)r��CPU_DATA��envN)� lvectllib�make_liblve_settings�create_liblve_settings�
temporary_lve�extendr�rB�callr�r�r�r��dumps�CPUINFO_DATA)�argsr�lve_ids rb�_run_self_in_lvez"CloudlinuxSummary._run_self_in_lve1s���1��,���,�
�
�
�
�
���
$�X�
.�
.� �&��K�K��S��[�[�1�2�2�2��?�%�t�S��[�[�:X�Y�\`�`���J�#&�"�Z� �(>�?�?�
���
�
�
� � � � � � � � � � � � ���� � � � � � s�BC�C�Cc�j�tjgd�|zttjd������S)z�
Run same command using utility `nice` and set environ RUNNING_BY_NICE=1
in order to check it in child process.
:return:
)z
/usr/bin/nicerL�19rMrN)r�rP)rBrWr�r�r�)rZs rb�_run_self_by_nicez#CloudlinuxSummary._run_self_by_niceMsE����I�I�I�D�P���
� #����
�
�
�
ra�optsc�|��t�fd�dD����rdSt�fd�dD����rdSdS)zK
Check that passed command should run as unlimited process
c3�(�K�|]}�|V��
dSr_r`�r��optionr`s �rbr�zECloudlinuxSummary._should_run_as_unlimited_process.<locals>.<genexpr>as;�����
�
��
��L�
�
�
�
�
�
ra)r-r'r+r r!r%r&Tc3�(�K�|]}�|V��
dSr_r`rcs �rbr�zECloudlinuxSummary._should_run_as_unlimited_process.<locals>.<genexpr>ns;�����
�
��
��L�
�
�
�
�
�
ra)r/r4�--jsonrF)rq)r`s`rb� _should_run_as_unlimited_processz2CloudlinuxSummary._should_run_as_unlimited_process\s����
�
�
�
�
��
�
�
�
�
� ��4��
�
�
�
��
�
�
�
�
� ��5��urac��|�|��|_|j�r)|���|�|j��rtjd��dSttj ��s+|�
|��}tj|��dS |�|��}tj|��dS#tj
$rc}d|��}t|��tjt"��}|�|d���tjd��Yd}~dSd}~wwxYw|�|j��r]d}t'j��|d�}t(�||j���t-|d��tjd ��|���dS)
Nrz"failed to run task in lve, error: T)�exc_info���z|You shouldn't use env var "RUNNING_IN_LVE" or "RUNNING_BY_NICE" for run of any command except collection of main statistics.r#)�extrarQ)�_parse_argsr{r�rErgr:r;rr�LVEr_r\rR�
PyLveError�print�logging� getLogger�__name__� exceptionrr�r�r2�run_get_summary)r��argv�rcr�� error_msg�log�err_msgr,s rbrCzCloudlinuxSummary.runzs����%�%�d�+�+��
��&�( #�
�7�7�9�9�9��4�4�T�Z�@�@�
!���������/���<�<�
!��+�+�D�1�1����������!��.�.�t�4�4�B��H�R�L�L�L�L�L�� �+�!�!�!� H�Q� H� H�I��)�$�$�$�!�+�H�5�5�C��M�M�)�d�M�;�;�;��H�R�L�L�L�L�L�L�L�L�L�����!�����4�4�T�Z�@�@�
�*��"&����%����� � ���
� �;�;�;� ��t�,�,�,�������� � �"�"�"�"�"s�,)C�E �&AE�E c���tj��}|���tj��|z
}||jd<|jdr0|j�t|j|��ddd��|j�d��r>|�|j|j d���t�d ��dSt|jd��dS)
N�cl_summary_execution_timerKr��cl_summary_max_mem_usedz,Can't get memory usage by cloudlinux-summaryr/Tr0zMain statistics sent)
r�_get_summaryr}r{�
add_metricr�_get_max_memoryr�r>r�r�r�r2)r��
start_time�running_times rbrtz!CloudlinuxSummary.run_get_summary�s����Y�[�[�
��������y�{�{�Z�/��7C���3�4��:�j�!� ��O�&�&���,�l�;�;��)�>�
�
�
��:�>�>�(�#�#� 4��1�1����$� �
2�
�
�
�
�O�O�2�3�3�3�3�3��T�_�d�3�3�3�3�3rar$�summary_resultc�v�tj|d�}|dkr||d<tj|d<t|��dS)z@
Save status of sending statistics to json file
�r�r$r"r�r�N)r<�SUCCESSr@rL)r$r�rDs rb�_save_statuszCloudlinuxSummary._save_status�sJ��"/�!6�Y�O�O���Y�&�&�$2�K��!�$1�$8�K��!�,�[�9�9�9�9�9rar1r2r3c���ttj����}||d<|�||���}||d�}t|d��|r|�||��dSdS)zH
Send statistics data to server and save status to file
r$)r2r�TN)rr�_send_statisticsr2r�)r�r1r2r3r$�s_resultr�s rbr>z2CloudlinuxSummary._send_statistics_and_save_status�s����� ���$�$� �(�����(�(��c�(�:�:��$�9�=�=�����&�&�&�� ������
�
�
�
�
� � rac��|dz}|dkrdSdddt|jd��ddd ttj|�����d
�g} t|d���\}}}n3#t$r&}t�d
|��Yd}~dSd}~wwxYw|dkrLtj
|��} td�|dD����S#ttf$rYdSwxYwt�d||��dS)Nr�rQz/usr/sbin/lveinforfz--idrKz--show-columns�mPMemz--period�mT��return_full_outputz Unable to run lveinfo, error: %src3�&K�|]}|dV��
dS)r�Nr`�r��xs rbr�z4CloudlinuxSummary._get_max_memory.<locals>.<genexpr>�s&����C�C�!�1�W�:�C�C�C�C�C�Crar,z-lveinfo failed with exit code: %i, output: %s)r�r{r�math�ceilr-r#r��warningr��loads�maxr�r�r�) r�r��time_minutes�cmdrv�json_strr�r��parsed_datas rbrz!CloudlinuxSummary._get_max_memory�sM��#�b�(���!����4������
�:�&�'�'�����4�9�\�*�*�+�+�.�.�.�
�� �)�#�$�G�G�G�O�B��!�!��$� � � ����A�1�E�E�E��4�4�4�4�4����� ������7�7��*�X�.�.�K�
��C�C�{�6�/B�C�C�C�C�C�C����)�
�
�
��t�t�
�������H�"�h�W�W�W��ts*�A)�)
B�3B�B�7C�C+�*C+c�f�d} d|��}t�|��tjd��}t d��D]P} tj||d���}n7#tj$r#}|}tjd|z��Yd}~�Id}~wwxYw|�|j d krt�d
��n,d|j �d|j
��}t�|��nE#tj$r3}t|��}t�|��Yd}~nd}~wwxYw|S)
z�
Sends statistics to server
:param data: Statistics data dict
:return: string - message for JSON 'result' key
r"zSending statictics to server z*Unknown exception while sending statistics�r�)r�r��N��zSending statictics OKr�r�)
r�r�r�r�r��post�ConnectionErrorrrr�r�r�r�)r,r2�out_messager��expected_err�ir��errs rbr�z"CloudlinuxSummary._send_statistics�st�� �� *�;�c�;�;�G��O�O�G�$�$�$�#�4�5a�b�b�L��1�X�X�
#�
#���'�}�S�t�R�H�H�H�H�
�E�� �/�%�%�%�#&�L��J�q�!�t�$�$�$�$�$�$�$�$�����%����#�"��#�s�*�*���� 7�8�8�8�8�n�X�=Q�n�n�]e�]l�n�n������,�,�,����(� *� *� *��c�(�(�K����[�)�)�)�)�)�)�)�)����� *�����sC�AC,� A"� C,�"B�1B�
C,�B�AC,�,D.�;)D)�)D.c��dtj��d�}|���|j�|��|S�NrQ)�versionr$)r�_prepare_cl_normal_statisticsr}r��r�r�s rbr}zCloudlinuxSummary._get_summarysB���T�Y�[�[�9�9���*�*�,�,�,�����v�&�&�&��
rac��dtj��d�}|���|j�|��|Sr�)r�'_fill_dict_with_rpm_packages_statisticsr}r�r�s rbr=z+CloudlinuxSummary._get_rpm_packages_summary!sB���T�Y�[�[�9�9���4�4�6�6�6�����v�&�&�&��
rac�@�tj��tjS)z.
Get version of control panel
)r��getCP�
CP_VERSIONr`rarb�_get_panel_versionz$CloudlinuxSummary._get_panel_version's�� ������ � rac�.�|j�tjd��\}}|st|jd<dS|�H||jd<|j�d�ddd��|j�d �ddd
��dSt|jd<dS)zN
Fill dict with statistics by statistics about MySQL governor
zCan't get MySQL governor mode�mysql_governor_statusN�mysql_governor_modec�B�t�����Sr_)r�get_governor_versionr`rarbrozCCloudlinuxSummary._fill_mysql_governor_statistics.<locals>.<lambda>>s��
���<�<�>�>�rar��mysql_governor_versionz Can't get MySQL governor versionc�N�t�����dS�Nr)r�get_governor_statusr`rarbrozCCloudlinuxSummary._fill_mysql_governor_statistics.<locals>.<lambda>Ds��
���;�;�=�=�a�@�razCan't get MySQL governor status)r}�
evaluate_safer0�get_gov_mode_operation�ERRORr~r�)r�r"�mysql_gov_modes rb�_fill_mysql_governor_statisticsz1CloudlinuxSummary._fill_mysql_governor_statistics0s���
#'�/�"?�"?��2�+�#
�#
����� E�7<�D�O�3�4�4�4�
�
'�5C�D�O�1�2��O�&�&�>�>��(�2�
�
�
�
�O�&�&�@�@��'�1�
�
�
�
�
�8E�D�O�3�4�4�4rac��|j�tjddd��|j�d�ddd��|j�|jddd ��|j�|jdd
d��|j�tdd
d��|j�d�ddd��tj��tjkr"|j�|j ddd��|j�|j
ddd��|j�tddd��dS)zM
Fill dict with statistics by statistics about control panel
r��control_panel_namezCan't get control panel namec�`�d�tj�����D��S)Nc��g|] \}}|�|��
Sr`r`)r��name�is_supporteds rb�
<listcomp>zVCloudlinuxSummary._fill_control_panel_statistics.<locals>.<lambda>.<locals>.<listcomp>Xs#��n�n�n�0�d�L�am�n�T�n�n�nra)r�get_supported_cl_features�itemsr`rarbrozBCloudlinuxSummary._fill_control_panel_statistics.<locals>.<lambda>Xs*��n�n�E�4S�4U�4U�4[�4[�4]�4]�n�n�n�ra�str_list�supported_cl_featuresz8Can't get list of supported cl features by control panel�control_panel_versionzCan't get control panel version�control_panel_apachezCan't get control panel apacher�
nginx_runningzCan't get control panel nginxc�B�ttj����Sr_)�lenr�cpusersr`rarbrozBCloudlinuxSummary._fill_control_panel_statistics.<locals>.<lambda>ks��3�u�}���+?�+?�ra�users_totalzCan't get amount of users�installed_via_plesk_extz8Can't determine if CL was installed from Plesk Extension�login_via_whmcs_in_usez)Can't determine if Login via WHMCS in userz Can't if that is WP2 environmentN)r}r~r�� getCPNamer��_get_control_panel_apacher)r�
PLESK_NAME�_is_installed_via_plesk_ext�_is_login_via_whmcs_in_userr�s rb�_fill_control_panel_statisticsz0CloudlinuxSummary._fill_control_panel_statisticsLs���
��"�"���� �*�
�
�
�
��"�"�n�n��#�F�
�
�
�
��"�"��#��#�-�
�
�
�
��"�"��*��"�,�
�
�
�
��"�"�#3�U�O�Ml�m�m�m���"�"�#?�#?��
�Wr�s�s�s������!1�1�1��O�&�&��0��)�J�
�
�
�
��"�"��+��$�7�
�
�
�
��"�"���';�=_�
�
�
�
�
rac ��d}tj��tjkr|Sgd�}t j|ddd���}t
j|j��}d|vr{d|dvrq|ddD]b}|ddkrTd }t|�
d
d��|�
dd��|�
d
d��g��rd}n�c|S)zA
Determine whether the login method is via WHMCS
rj)z/usr/local/cpanel/bin/whmapi1�&get_available_authentication_providersz--output=jsonprettyT)�capture_outputr�r8r,� providers�
provider_name�whmcsr�whostmgrd_enabledF�cpaneld_enabled�webmaild_enabledrQ)r�r�r�CPANEL_NAMErBrCr�r��stdoutrqr�)r'�commandr�r,�providers rbr�z,CloudlinuxSummary._is_login_via_whmcs_in_uses��
�������!2�2�2��M�t�t�t������4�t�T�T�T���z�&�-�(�(���T�>�>�k�T�&�\�9�9� ��L��5�
�
���O�,��7�7��F��$�L�L�)<�e�D�D�$�L�L�):�E�B�B�$�L�L�);�U�C�C����#�"#���E�8��
rac�P�d}d}tj�|��rd}|S)a
cldeploy-plesk-ext.log is always created by cldeploy-precheck when it downloads the cldeploy script,
if it exists it means there was an attempt to launch cldeploy from the Plesk Extension.
Since this function is in package lve-utils, which depends on lve, it means that the current OS is CloudLinux,
therefore the conversion was successful.
Possible false positives:
- if there was failed attempt to convert os from Plesk Ext,
and then it was successfully converted after manual run of cldeploy,
it will be considered as CLOS installed via Plesk extension
- if user has CL already installed and goes to CLOS Plesk Ext and tries to run conversion from there
Possible false negatives:
- if /var/log/cldeploy-plesk-ext.log was deleted or renamed/archived (e.g. via logrotate)
Fz/var/log/cldeploy-plesk-ext.logTr�)r��ext_logs rbr�z-CloudlinuxSummary._is_installed_via_plesk_ext�s.�� ��3��
�7�>�>�'�"�"� ��F��
rac���t��r/tj��rd}nDtj��rd}n.d}n+|jddkrtj��rdnd}nd}|S) z�
Wrapper to retrieve control panel Apache version:
EA3 or EA4 for cPanel, native otherwise
:return: EA3|EA4|native
� litespeed�
openlitespeed�unknown_litespeedr��cPanel�EA4�EA3�native)r(r��detect_enterprise_litespeed�detect_open_litespeedr}�is_ea4r�s rbr�z+CloudlinuxSummary._get_control_panel_apache�s~�� �!�!� ��1�3�3�
-�$����-�/�/�
-�(���-���
�_�1�
2�h�
>�
>�$�m�o�o�8�U�U�5�F�F��F��
rac��tj��}|�|Stjttjt
dtdti}|�|d��S)z�
Wrapper to convert internal values from cagefs_statistics_config.get_cagefs_status function to values
for statistics
:return:
N�Enabled�Disabled�Unknown) r.�get_cagefs_status�CAGEFS_STATUS_NOT_INSTALLEDr��CAGEFS_STATUS_NOT_INITIALIZED�NOT_INITIALIZEDr�r�r�)�
cagefs_status�cagefs_status_maps rb�_cagefs_status_wrapperz(CloudlinuxSummary._cagefs_status_wrapper�sX��1�B�D�D�
�� � � �$�@�-�$�B�O��w���
��!�$�$�]�I�>�>�>rac��|j�|jddd��|jdttfvrd|jd<n'|j�t
jddd��|j�tt
jd��ddd ��|j�tt
jd
��ddd��dS)
zF
Fill dict with statistics by statistics about CageFS
r�r�zCan't get CageFS statusN�cagefs_user_modezCan't get CageFS user modeT�cagefs_enabled_quantityz/Can't get quantity of users with enabled CageFSF�cagefs_disabled_quantityz0Can't get quantity of users with disabled CageFS) r}r~r�r�r�r.�get_cagefs_user_moder�get_quantityr�s rb�_fill_cagefs_statisticsz)CloudlinuxSummary._fill_cagefs_statistics�s���
��"�"��'���%�
�
�
��?�?�+�
��/O�O�O�26�D�O�.�/�/��O�&�&�(�=��"�,�
�
�
�
��"�"��,�9�4�@�@��%�=�
�
�
�
��"�"��,�9�5�A�A��&�>�
�
�
�
�
rac�D�� td�|j���D����}n#tj$rYdSwxYwt|jj������t�fd�|� ��D����S)zJ
Get amount of end-users which belong to active resellers
c3�,K�|]\}}|dk�|V��dS�rNr`�r�r��lvps rbr�zLCloudlinuxSummary._get_amount_of_endusers_under_resellers.<locals>.<genexpr>�2����Y�Y���3�QT�WX�QX�QX��QX�QX�QX�QX�Y�YraNc3� �K�|]}|�vV�� dSr_r`)r��lvp_id�enabled_lvp_ids �rbr�zLCloudlinuxSummary._get_amount_of_endusers_under_resellers.<locals>.<genexpr>s(�����O�O��6�^�+�O�O�O�O�O�Ora)
rr��
lve_lvp_pairsrrM�set�name_map�id_list�sum�elements)r�� lvp_countrs @rb�'_get_amount_of_endusers_under_resellersz9CloudlinuxSummary._get_amount_of_endusers_under_resellers�s���� ��Y�Y�$�+�2K�2K�2M�2M�Y�Y�Y�Y�Y�I�I���!� � � ��4�4� �����T�[�1�9�9�;�;�<�<���O�O�O�O�)�:L�:L�:N�:N�O�O�O�O�O�Os�04�A�Ac��� td�|j���D����}n#tj$rYdSwxYwt|�����S)z/
Get total amount of end-users
c3�,K�|]\}}|dk�|V��dSrr`rs rbr�zBCloudlinuxSummary._get_total_amount_of_endusers.<locals>.<genexpr>r raN)rr�r
rrMrrs)r�rs rb�_get_total_amount_of_endusersz/CloudlinuxSummary._get_total_amount_of_enduserssr�� ��Y�Y�$�+�2K�2K�2M�2M�Y�Y�Y�Y�Y�I�I���!� � � ��4�4� �����9�#�#�%�%�&�&�&s�03�A�Ac�p� ttj����S#tj$rYdSwxYw)z)
Get amount of resellers
N)r�r� resellersrMr`rarb�_get_amount_of_resellersz*CloudlinuxSummary._get_amount_of_resellerssB��
��u��(�(�)�)�)���!� � � ��D�D� ���s�"�5�5c����j�tjjddd���j�tjjddd���j�tjjddd���j��jddd ���j��jdd
d���j��j ddd
���j��fd�ddd���jdr �j�d�ddd��dSd�jd<d�jd
<d�jd<dS)zP
Fill dict with statistics by varied statistics about resellers
r� reseller_limits_supported_kernelz8Can't detect status of support reseller limits by kernel�'reseller_limits_supported_control_panelz?Can't detect status of support reseller limits by control panel�reseller_limits_enabledz1Can't detect status of support of reseller limits�resellers_totalz#Can't get total amount of resellers�(resellers_endusers_under_reseller_limitsz>Can't get amount of end-users which belong to active resellers�resellers_endusers_totalz#Can't get total amount of end-usersc�,������Sr_)�_get_resellers_with_faultsr�s�rbroz>CloudlinuxSummary._fill_resellers_statistics.<locals>.<lambda>Fs���D�3�3�5�5�ra�resellers_with_faultsz:Can't get amount of resellers with faults for the past 24hc�\�tttj������Sr_)r��listrR�lvp_listr`rarbroz>CloudlinuxSummary._fill_resellers_statistics.<locals>.<lambda>Ms���D��!3�!5�!5�6�6�7�7�ra�resellers_activez$Can't get amount of active resellersN)
r}r~rR�lve�is_lve10�is_panel_supported�reseller_limit_supportedrrrr�s`rb�_fill_resellers_statisticsz,CloudlinuxSummary._fill_resellers_statisticss����
��"�"��M�"��.�F�
�
�
�
��"�"��M�,��5�M�
�
�
�
��"�"��M�2��
&�?�
�
�
�
��"�"��)���1�
�
�
�
��"�"��8��6�L�
�
�
�
��"�"��.��&�1�
�
�
�
��"�"�5�5�5�5��#�H�
�
�
��?�4�5�
<��O�&�&�7�7��"�6�
�
�
�
�
�37�D�O�.�/�JN�D�O�F�G�7;�D�O�3�4�4�4ra�xml_cfg_providerc���|j�t|j�jt
j�jt
j��ddd��|j�t|j�jt
j��ddd��|j��fd�ddd ��|j��fd
�ddd��|j��fd
�ddd��|j��fd�ddd��|j��fd�ddd��|j�t|j �jt
j
��ddd��|j�t|j �jt
j��ddd��dS)zN
Fill dict with statistics by statistics about default limits
r�default_limit_speedzCan't get default speed limitr��default_limit_cpu_origin_unitsz+Can't get cpu origin units of default limitc�2���jtjSr_)�defaultsr4�ncpu�r.s�rbrozCCloudlinuxSummary._fill_default_limits_statistics.<locals>.<lambda>m����$�-�h�7�<�ra�default_limit_ncpuzCan't get default ncpu limitc�2���jtjSr_)r3r4�ior5s�rbrozCCloudlinuxSummary._fill_default_limits_statistics.<locals>.<lambda>s����$�-�h�7�:�ra�default_limit_iozCan't get default io limitc�2���jtjSr_)r3r4�nprocr5s�rbrozCCloudlinuxSummary._fill_default_limits_statistics.<locals>.<lambda>ys���$�-�h�7�=�ra�default_limit_nproczCan't get default nproc limitc�2���jtjSr_)r3r4�epr5s�rbrozCCloudlinuxSummary._fill_default_limits_statistics.<locals>.<lambda>r:ra�default_limit_epzCan't get default ep limitc�2���jtjSr_)r3r4�iopsr5s�rbrozCCloudlinuxSummary._fill_default_limits_statistics.<locals>.<lambda>�r6ra�default_limit_iopszCan't get default iops limit�default_limit_vmem_mbzCan't get default vmem limit�default_limit_pmem_mbzCan't get default pmem limitN)r}r~r�_cpu_limit_to_percentsr3r4�cpur4�_get_cpu_limit_units�_mempages_to_mb�vmem�pmem�r�r.s `rb�_fill_default_limits_statisticsz1CloudlinuxSummary._fill_default_limits_statisticsWs���
��"�"���+� �)�(�3�7� �)�(�3�8�
�
�
�!�+�
�
�
�
��"�"��D�-�/?�/H��/R�/V�W�W��,�9�
�
�
�
��"�"�<�<�<�<�� �*�
�
�
�
��"�"�:�:�:�:���(�
�
�
�
��"�"�=�=�=�=��!�+�
�
�
�
��"�"�:�:�:�:���(�
�
�
�
��"�"�<�<�<�<�� �*�
�
�
�
��"�"��D�(�*:�*C�H�*M�*R�S�S��#�*�
�
�
�
��"�"��D�(�*:�*C�H�*M�*R�S�S��#�*�
�
�
�
�
rac���|j��fd�ddd��|j��fd�ddd��|j��fd�dd d
��|j�|jddd��d
S)z�
Fill dict with statistics by other statistics about limits:
packages_total, users_total, amount users/packages with custom limits
c�,��t�j��Sr_)r��packagesr5s�rbrozACloudlinuxSummary._fill_other_limits_statistics.<locals>.<lambda>�s���C�(�1�2�2�rar�packages_totalz"Can't get total amount of packagesc�F��t������Sr_)r��get_packages_with_custom_limitsr5s�rbrozACloudlinuxSummary._fill_other_limits_statistics.<locals>.<lambda>�s���C�(�H�H�J�J�K�K�ra�packages_with_custom_limitsz/Can't get amount of packages with custom limitsc�F��t������Sr_)r��get_users_with_custom_limitsr5s�rbrozACloudlinuxSummary._fill_other_limits_statistics.<locals>.<lambda>�s���C�(�E�E�G�G�H�H�ra�users_with_custom_limitsz,Can't get amount of users with custom limits�users_with_faultsz6Can't get amount of users with faults for the past 24hN)r}r~�_get_users_with_faultsrMs `rb�_fill_other_limits_statisticsz/CloudlinuxSummary._fill_other_limits_statistics�s����
��"�"�2�2�2�2���0�
�
�
�
��"�"�K�K�K�K��)�=�
�
�
�
��"�"�H�H�H�H��&�:�
�
�
�
��"�"��'���D�
�
�
�
�
rac�����tdd��D�]�}�j�t�j||��d|�d���\}�|r��dS�j��fd�dd|�d �d�
���j��fd�dd|�d
�d�
���j���fd�dd|�d�d�
���j���fd�dd|�d�d�
���j��fd�dd|�d�d�
���j��fd�dd|�d�d�
���j��fd�dd|�d�d�
���j��fd�dd|�d�d�
���j��fd�dd|�d�d�
���j���fd�dd|�d�d�
���j���fd�dd|�d�d�
�����dS) zV
Fill dict with statistics by statistics about top packages on server
rQr�zCan't get top z package by usersNc����djS�NrQ�r���
top_results�rbrozACloudlinuxSummary._fill_top_packages_statistics.<locals>.<lambda>�s���
�1�
�*�rar��top_�
_package_name��log_messagec�.��t�d��Sr�r
r`s�rbrozACloudlinuxSummary._fill_top_packages_statistics.<locals>.<lambda>�s����J�q�M�*�*�rar�_package_users_numc������djptj�djptj��Sr^)rG�limitsr6rHr4�r�ras��rbrozACloudlinuxSummary._fill_top_packages_statistics.<locals>.<lambda>�s;����3�3���]�)�9�\�>���]�)�9�\�?���ra�_package_limit_speedc�\�����djptj��Sr^)rIrir6rHrjs��rbrozACloudlinuxSummary._fill_top_packages_statistics.<locals>.<lambda>�s)����1�1���]�)�9�\�>���ra�_package_limit_cpu_origin_unitsc�6���djptjSr^)rir6r4r`s�rbrozACloudlinuxSummary._fill_top_packages_statistics.<locals>.<lambda>������A��-�=��C�ra�_package_limit_ncpuc�6���djptjSr^)rir6r9r`s�rbrozACloudlinuxSummary._fill_top_packages_statistics.<locals>.<lambda>������A��-�=��A�ra�_package_limit_ioc�6���djptjSr^)rir6r=r`s�rbrozACloudlinuxSummary._fill_top_packages_statistics.<locals>.<lambda>�s����A��-�=��D�ra�_package_limit_nprocc�6���djptjSr^)rir6r@r`s�rbrozACloudlinuxSummary._fill_top_packages_statistics.<locals>.<lambda>�rrra�_package_limit_epc�6���djptjSr^)rir6rCr`s�rbrozACloudlinuxSummary._fill_top_packages_statistics.<locals>.<lambda>�rora�_package_limit_iopsc�\�����djptj��Sr^)rJrir6rKrjs��rbrozACloudlinuxSummary._fill_top_packages_statistics.<locals>.<lambda>�$����,�,�j��m�.B�.R�l�-X�Y�Y�ra�_package_limit_vmem_mbc�\�����djptj��Sr^)rJrir6rLrjs��rbrozACloudlinuxSummary._fill_top_packages_statistics.<locals>.<lambda>
r{ra�_package_limit_pmem_mb)r�r}r�r�#_get_top_package_by_number_of_usersr~)r�r.r�r"ras` @rb�_fill_top_packages_statisticsz/CloudlinuxSummary._fill_top_packages_statistics�ss�����q�!���R �R �A�"&�/�"?�"?���@�!�EU�V�V�5��5�5�5�#�#��G�Z��
�j�0����
�O�&�&�*�*�*�*��'�q�'�'�'� �
'�
�
�
�
�O�&�&�*�*�*�*��,�q�,�,�,� �
'�
�
�
�
�O�&�&�������.�q�.�.�.� �
'�
�
�
�
�O�&�&�������9�q�9�9�9� �
'�
�
�
�
�O�&�&�C�C�C�C��-�q�-�-�-� �
'�
�
�
�
�O�&�&�A�A�A�A��+�q�+�+�+� �
'�
�
�
�
�O�&�&�D�D�D�D��.�q�.�.�.� �
'�
�
�
�
�O�&�&�A�A�A�A��+�q�+�+�+� �
'�
�
�
�
�O�&�&�C�C�C�C��-�q�-�-�-� �
'�
�
�
�
�O�&�&�Y�Y�Y�Y�Y��0�q�0�0�0� �
'�
�
�
�
�O�&�&�Y�Y�Y�Y�Y��0�q�0�0�0� �
'�
�
�
�
�[R �R rac��t��}|�|��|�|��|�|��dS)zN
Fill dict with statistiscs by varied statistics about limits
N)r5rNr[r�rMs rb�_fill_limits_statisticsz)CloudlinuxSummary._fill_limits_statisticssU��-�.�.���,�,�-=�>�>�>��*�*�+;�<�<�<��*�*�+;�<�<�<�<�<rac�0��|j�|jd��\}�|st|jd<dS���L|j��fd�ddd���|j��fd�dd d���|j��fd
�ddd���|j��fd�dd
d���|j��fd�ddd���|j��fd�ddd���|j��fd�ddd���|j��fd�ddd���|j��fd�ddd���|j��fd�ddd���dSt
|jd<dS)zI
Fill dict with statistics by statistics about mod_lsapi
zCan't get raw mod_lsapi info�lsapi_mod_statusNc� ���ddS)N�criur'r`��raw_lsapi_infos�rbroz:CloudlinuxSummary._fill_lsapi_statistics.<locals>.<lambda>)s����v�.�x�8�rar��lsapi_criu_service_statusrdc� ���ddS)Nr�r�r`r�s�rbroz:CloudlinuxSummary._fill_lsapi_statistics.<locals>.<lambda>/s����v�.�y�9�ra�lsapi_criu_service_versionc� ���ddS)N� lsapiConf�
lsapi_criur`r�s�rbroz:CloudlinuxSummary._fill_lsapi_statistics.<locals>.<lambda>5s����{�3�L�A�ra�lsapi_option_criuc� ���ddS)Nr��lsapi_with_connection_poolr`r�s�rbroz:CloudlinuxSummary._fill_lsapi_statistics.<locals>.<lambda>;s����{�3�4P�Q�ra�lsapi_option_connection_poolc����dS)N�
libVersionr`r�s�rbroz:CloudlinuxSummary._fill_lsapi_statistics.<locals>.<lambda>A�����|�4�ra�lsapi_lib_versionc����dS)N� modStatusr`r�s�rbroz:CloudlinuxSummary._fill_lsapi_statistics.<locals>.<lambda>Gs����{�3�rac����dS)N�
modVersionr`r�s�rbroz:CloudlinuxSummary._fill_lsapi_statistics.<locals>.<lambda>Mr�ra�lsapi_mod_versionc����dS)N�totalDomainr`r�s�rbroz:CloudlinuxSummary._fill_lsapi_statistics.<locals>.<lambda>Ss����}�5�rar�lsapi_total_domain_countc����dS)N�
domainStatr`r�s�rbroz:CloudlinuxSummary._fill_lsapi_statistics.<locals>.<lambda>Yr�ra�int_dict�lsapi_domain_statc����dS)N�controlPanelr`r�s�rbroz:CloudlinuxSummary._fill_lsapi_statistics.<locals>.<lambda>_s����~�6�ra�lsapi_apache_environment)r}r��get_raw_lsapi_infor�r~r�)r�r"r�s @rb�_fill_lsapi_statisticsz(CloudlinuxSummary._fill_lsapi_statisticss����#'�/�"?�"?��#�*�#
�#
�����A @�27�D�O�.�/�/�/�
�
'��O�&�&�8�8�8�8��+� �
'�
�
�
�
�O�&�&�9�9�9�9��,� �
'�
�
�
�
�O�&�&�A�A�A�A��#� �
'�
�
�
�
�O�&�&�Q�Q�Q�Q��.� �
'�
�
�
�
�O�&�&�4�4�4�4��#� �
'�
�
�
�
�O�&�&�3�3�3�3��"� �
'�
�
�
�
�O�&�&�4�4�4�4��#� �
'�
�
�
�
�O�&�&�5�5�5�5��*� �
'�
�
�
�
�O�&�&�4�4�4�4��#� �
'�
�
�
�
�O�&�&�6�6�6�6��*� �
'�
�
�
�
�
�3@�D�O�.�/�/�/rac�J�|j�|jddd��dS)N�str_dict�
wmt_configz!Cant get status of wmt_api_config)r}r~�_get_wmt_api_configr�s rb�_fill_wmt_settings_statisticsz/CloudlinuxSummary._fill_wmt_settings_statisticsgs3����"�"��$�j�,�@c�
�
�
�
�
rac������ |���\�}�nF#t$r9}t�dt |����ggic�}�Yd}~nd}~wwxYwtt
���t
|��z
��} |�|��\��nD#t$r7}t�dt |����iic��Yd}~nd}~wwxYw|r$��dt|��i��|j
��fd�ddd��|j
��fd�d d
d��|j
��fd�d d
d��|j
��fd�ddd��|j
��fd�ddd��|j
��fd�d dd��dS)Nz+Error while getting WordPress statistics %sz3Error while getting WordPress plugins statistics %s�cloudlinux_wpos_object_cachec�"��t���Sr_�r�)�all_wp_pathss�rbroz7CloudlinuxSummary._fill_wp_statistics.<locals>.<lambda>�s���C��%�%�rar�wordpress_installed_totalz,Can't get total count of installed wordpressc����Sr_r`��object_cache_pluginss�rbroz7CloudlinuxSummary._fill_wp_statistics.<locals>.<lambda>�s���(�rar��wordpress_object_cache_pluginsz&Can't get WP object cache plugins infoc����Sr_r`��advanced_cache_pluginss�rbroz7CloudlinuxSummary._fill_wp_statistics.<locals>.<lambda>�s���*�ra� wordpress_advanced_cache_pluginsz(Can't get WP advanced cache plugins infoc�F��t������Sr_�rrsr�s�rbroz7CloudlinuxSummary._fill_wp_statistics.<locals>.<lambda>�s���C�,�3�3�5�5�6�6�ra�$wordpress_object_cache_plugins_totalz,Can't get WP object cache total plugins infoc�F��t������Sr_r�r�s�rbroz7CloudlinuxSummary._fill_wp_statistics.<locals>.<lambda>�s���C�.�5�5�7�7�8�8�ra�&wordpress_advanced_cache_plugins_totalz.Can't get WP advanced cache total plugins infoc����Sr_r`)�wp_php_versionss�rbroz7CloudlinuxSummary._fill_wp_statistics.<locals>.<lambda>�s���O�ra�wordpress_php_versionszCan't get WP php version info)�_prepare_wp_statistics� Exceptionr�r�r�r&r�_prepare_wp_plugins_statisticsr�r�r}r~)r��paths_with_wpos_object_cacher��without_wpos_object_cacher�r�r�r�s @@@@rb�_fill_wp_statisticsz%CloudlinuxSummary._fill_wp_statisticsls������� U�JN�Je�Je�Jg�Jg�G�L�6����� U� U� U����J�C�PQ�F�F�S�S�S�JL�b�RT�G�L�6����������� U����%)��\�):�):�S�A]�=^�=^�)^�$_�$_�!� B�;?�;^�;^�)�<�<�8� �"8�"8��� B� B� B����R�TW�XY�TZ�TZ�[�[�[�;=�r�8� �"8�"8�"8�"8�"8�"8����� B����(� m� �'�'�)G��Mi�Ij�Ij�(k�l�l�l���"�"�%�%�%�%��'�:�
�
�
�
��"�"�(�(�(�(��,�4�
�
�
�
��"�"�*�*�*�*��.�6�
�
�
�
��"�"�6�6�6�6��2�:�
�
�
�
��"�"�8�8�8�8��4�<�
�
�
�
��"�"�#�#�#�#�Z�1I�Kj�
�
�
�
�
s,��
A"�/A�A"�B+�+
C,�5-C'�'C,c�B��� |���\��nC#t$r6}t�dt |����g�g�Yd}~nd}~wwxYw|j��fd�ddd��|j��fd�ddd��dS) Nz4Error while getting per-user WordPress statistics %sc�"��t���Sr_r�)�
users_with_wps�rbroz@CloudlinuxSummary._fill_per_user_wp_statistics.<locals>.<lambda>�s���C�
�&�&�rar�$users_count_with_wordpress_installedz7Can't get total count of users with wordpress installedc�"��t���Sr_r�)�users_with_wp_and_litespeeds�rbroz@CloudlinuxSummary._fill_per_user_wp_statistics.<locals>.<lambda>�s���C�3�4�4�ra�0users_count_with_wordpress_and_lscache_installedzECan't get total count of users with wordpress and LiteSpeed installed)�_prepare_per_user_wp_statisticsr�r�r�r�r}r~)r�r�r�r�s @@rb�_fill_per_user_wp_statisticsz.CloudlinuxSummary._fill_per_user_wp_statistics�s����� -�9=�9]�9]�9_�9_�6�M�6�6��� -� -� -����S�UX�YZ�U[�U[�\�\�\��M�*,�'�'�'�'�'�'����� -����
��"�"�&�&�&�&��2�E�
�
�
�
��"�"�4�4�4�4��>�S�
�
�
�
�
s��
A�,A�Ac�b�|�d|��}|�d|��}||fS)zq
Prepares dict with plugin-counter pairs
e.g: {'w3-total-cache': 4, 'redis': 1, 'ls': 2}
�object-cache�advanced-cache)�_get_plugin_info)r��wp_pathsr�r�s rbr�z0CloudlinuxSummary._prepare_wp_plugins_statistics�s=��
$�4�4�^�X�N�N��!%�!6�!6�7G��!R�!R��#�%;�;�;ra�plugin_typer�c���ttd�fd�|D������}tt��}|D]}||xxdz
cc<�|S)Nc�0��g|]}t|�����Sr`)r)r�r�r�s �rbr�z6CloudlinuxSummary._get_plugin_info.<locals>.<listcomp>�s%���1n�1n�1n�]a�2E�d�K�2X�2X�1n�1n�1nrarQ)r&�filterrr)r�r�r��object_plugin_counter_pairs�plugins` rbr�z"CloudlinuxSummary._get_plugin_info�ss���#�F�4�1n�1n�1n�1n�em�1n�1n�1n�$o�$o�p�p��&1�#�&6�&6�#�*� 5� 5�F�'��/�/�/�1�4�/�/�/�/�*�*rac�j�gg}}tt��}tj��}|D�]} tj|��}n#t
$rY�%wxYwtt��}|D]?\}} tj� | ��r|| �
|���@|D]~} |�|| |��}
|
d}|
d}|�|��|�|
d��|r#|dkr||xxt|��z
cc<���|||fS)z�
Return Wordpress absolute paths, paths with install WPOS object cache module
and counter of php versions that are used by these Wordpresses.
r��php_version�'wp_paths_with_enabled_wpos_object_cache� undefined)rrrr��userdomainsr�r&r�r�r��append�_get_docroot_wp_inforVr�)
r�r��$paths_with_enabled_wpos_object_cache�php_versions�panel_users�user�domains_info�docroot_domains_map�domain�docroot�docroot_info�docroot_wp_paths�docroot_php_versions
rbr�z(CloudlinuxSummary._prepare_wp_statistics�s���
>@��:��"�3�'�'���m�o�o��� O� O�D�
�$�0��6�6�����
�
�
���
����#.�d�"3�"3��#/�
@�
@�����7�>�>�'�*�*�@�'��0�7�7��?�?�?��.�
O�
O��#�8�8��w�H[�\�\��#/�
�#;� �&2�=�&A�#��#�#�$4�5�5�5�4�;�;�L�Ir�<s�t�t�t�#�O�(;�{�(J�(J� �!4�5�5�5��=M�9N�9N�N�5�5�5��
O��A�<�O�Os�A�
A�Ac��t��t��}}tj��}|D�]&} tj|��}n?#t$r2}t
�dt|����Yd}~�Pd}~wwxYwtt��}|D]?\}} tj�| ��r|| �
|���@|D]u} |�|| |��}
t|
d��dkr|�|��t|
d��dkr|�|���v��(||fS)z]
Return Wordpress absolute paths, paths with install LiteSpeed cache plugin.
z(Can't get user's domains info, error: %sNr�r�%wp_paths_with_enabled_litespeed_cache)rrr�r�r�r�r�r�rr&r�r�r�r�r�r��add)r�r�r�r�r�r�r�r�r�r�r�s rbr�z1CloudlinuxSummary._prepare_per_user_wp_statistics�sz��69�U�U�C�E�E�2�
��m�o�o��� :� :�D�
�$�0��6�6�����
�
�
�� � �!K�S�QR�V�V�T�T�T����������
����#.�d�"3�"3��#/�
@�
@�����7�>�>�'�*�*�@�'��0�7�7��?�?�?��.�
:�
:��#�8�8��w�H[�\�\���|�J�/�0�0�1�4�4�!�%�%�d�+�+�+��|�$K�L�M�M�PQ�Q�Q�/�3�3�D�9�9�9��
:��9�9�9s�A�
B�(B�Br�r�r�c����ggt��dd�}��fd�t���D��}|s|S�fd�|D��|d<�fd�t||��D��|d<|dD]d}t|d��}|�d
|vr|d�|��t|d��}|�d
|vr|d�|���e��D]$} |�| ��}
|
dkr|
|d
<n�%|S)zM
Return data about docroot's WP paths and used php versions.
r�)r�r�r�r�c���g|]J}tj��|���ks"tj��|���v�H|��KSr`)r�r�r�)r��wp_pathr�r�s ��rbr�z:CloudlinuxSummary._get_docroot_wp_info.<locals>.<listcomp>sZ���
�
�
������W�g�.�.�'�9�9�R�W�\�\�'�SZ�=[�=[�cv�=v�=v�
�=v�=v�=vrac�T��g|]$}t����|����%Sr`�r
�joinpath�r�r�r�s �rbr�z:CloudlinuxSummary._get_docroot_wp_info.<locals>.<listcomp>s-���#V�#V�#V�T�D��M�M�$:�$:�4�$@�$@�#V�#V�#Vrar�c�X��g|]&}|�t����|����'Sr_r�r�s �rbr�z:CloudlinuxSummary._get_docroot_wp_info.<locals>.<listcomp>s@���C
�C
�C
����
��M�M�"�"�4�(�(���rar�r�Nr�r�r�r�)rrrrr��_get_php_version_for_domain)r�r�r�r�r�r�r��object_cache_plugin�advanced_cache_pluginr�r�s `` rbr�z&CloudlinuxSummary._get_docroot_wp_infos������79�58�U�U�&�
�
��
�
�
�
�
�(��1�1�
�
�
��� ���#V�#V�#V�#V�X�#V�#V�#V��Z� �C
�C
�C
�C
�8��x�H�H�C
�C
�C
��>�?�!��,� P� P�D�"5�d�N�"K�"K��"�.�;�BU�3U�3U��D�E�I�I�$�O�O�O�$7��>N�$O�$O�!�$�0�[�DY�5Y�5Y��D�E�I�I�$�O�O�O��)�'�2� � �F��:�:�6�B�B�K��k�)�)�.9��]�+���*��rar�c��tj��tjtjtjfvrdS|���\}}}|�|i��}|�dd��}tj��tjkr||kr|S|���D],\}}||vr#|dkrd|� dd����} | cS�-tj��tjkrd|� dd����}
|
Stj��tjkrE|�dd��}|d t|����d
��}|pdS|S)z�
Return php version that is used for specified domain.
Determine whether of MultiPHP Manager or PHP Selector is used.
r��php_version_idr�zalt-php�.r�zda-php�handler_typeN�-)r�r�rr��DIRECTADMIN_NAMEr��_get_system_php_infor�r��replacer�r�)
r�r��system_default_php_version�domains_php_info�selector_php_info�php_info�multi_php_versionr��domains�alt_php_version�da_php_version�handlerr�s
rbr�z-CloudlinuxSummary._get_php_version_for_domain6s���
����e�&7��9O�QV�Qa�%b�b�b��;�JN�Jc�Jc�Je�Je�G�"�$4�6G�$�'�'���3�3��$�L�L�)9�;�G�G��
�����!2�2�2�7Q�Uf�7f�7f�$�$�!2� 7� 7� 9� 9� '� '��G�W��� � �W��%8�%8�"F�G�O�O�C��,D�,D�"F�"F��&�&�&�&�������!7�7�7�J�&7�&?�&?��R�&H�&H�J�J�N�!�!������!1�1�1��l�l�>�2�6�6�G�+�O�s�7�|�|�m�O�<�B�B�3�G�G�K��-�+�-� � ra)�maxsizec��� tj��d}n#t$rd}YnwxYwtj��}t ��}|� |d}ni}|||fS)z�
Return info about:
- system_php_version (implemented only on cPanel)
- domains_php_info (php versions and handlers turned on in MultiPHP)
- selector_php_info (php version used by panel users via PHP Selector)
�default_version_idN�domains_by_php_version)r�get_system_php_infor��get_domains_php_inforX)�system_php_versionr�php_selector_usagers rbrz&CloudlinuxSummary._get_system_php_info\s��� &�!&�!:�!<�!<�=Q�!R����� &� &� &�!%���� &����!�5�7�7��3�5�5���)� 2�3K� L��� "��!�#3�5F�F�Fs��+�+c���|j�|jd��\}�|st|jd<dS���B|j��fd�ddd��|j��fd�d d
d��|j��fd�d dd
��|j��fd�d dd��|j��fd�d dd��|j��fd�ddd��|j��fd�d dd��|j��fd�ddd��|j��fd�ddd ��|j��fd!�d"d#d$��dSt
|jd<dS)%z/
Fill dict with SSA statistics
zCan't get SSA statistics�
ssa_statusNc����dS)N�configr`�� ssa_statss�rbroz8CloudlinuxSummary._fill_ssa_statistics.<locals>.<lambda>�����y��/B�rar��
ssa_configzCan't get SSA configc����dS)Nr�r`rs�rbroz8CloudlinuxSummary._fill_ssa_statistics.<locals>.<lambda>�s��� �)�,�rar��ssa_versionzCan't get version of SSAc����dS)Nr'r`rs�rbroz8CloudlinuxSummary._fill_ssa_statistics.<locals>.<lambda>�rrazCan't get state of SSAc����dS)N�agent_statusr`rs�rbroz8CloudlinuxSummary._fill_ssa_statistics.<locals>.<lambda>�s��� �.�1�ra�ssa_agent_statuszCan't get state of SSA agentc� ���ddS)N�autotracingr'r`rs�rbroz8CloudlinuxSummary._fill_ssa_statistics.<locals>.<lambda>�s��� �-�0��:�ra�autotracing_statusz"Can't get state of SSA Autotracingc� ���ddS)Nr%�disabled_users_quantityr`rs�rbroz8CloudlinuxSummary._fill_ssa_statistics.<locals>.<lambda>�s��� �-�0�1J�K�rar�#autotracing_disabled_users_quantityz1Can't get state of SSA Autotracing disabled usersc� ���ddS)Nr%�
rules_versionr`rs�rbroz8CloudlinuxSummary._fill_ssa_statistics.<locals>.<lambda>����� �-�0��A�ra�autotracing_rules_versionz'Can't get SSA Autotracing rules versionc� ���ddS)Nr%�urls_processedr`rs�rbroz8CloudlinuxSummary._fill_ssa_statistics.<locals>.<lambda>�s��� �-�0�1A�B�ra�autotracing_urls_processedz.Can't get SSA Autotracing processed URLs countc� ���ddS)Nr%�
urls_selectedr`rs�rbroz8CloudlinuxSummary._fill_ssa_statistics.<locals>.<lambda>�r,ra�autotracing_urls_selectedz-Can't get SSA Autotracing selected URLs countc� ���ddS)Nr%�rejectsr`rs�rbroz8CloudlinuxSummary._fill_ssa_statistics.<locals>.<lambda>�s��� �-�0��;�rar��autotracing_rejectsz!Can't get SSA Autotracing rejects)r}r��
get_ssa_statsr�r~r�)r�r"rs @rb�_fill_ssa_statisticsz&CloudlinuxSummary._fill_ssa_statisticsts;���"�_�:�:���&�
�
����
� �,1�D�O�L�)��F�� ��O�&�&�'B�'B�'B�'B�J�P\�^t�u�u�u��O�&�&�,�,�,�,�e�]�D^�
�
�
�
�O�&�&�'B�'B�'B�'B�E�<�Yq�r�r�r��O�&�&�1�1�1�1�5�:L�Nl�
�
�
�
�O�&�&�:�:�:�:��$�4�
�
�
�
�O�&�&�K�K�K�K��5�C�
�
�
�
�O�&�&�A�A�A�A��+�9�
�
�
�
�O�&�&�B�B�B�B��,�@�
�
�
�
�O�&�&�A�A�A�A��+�?�
�
�
�
�O�&�&�;�;�;�;��%�3�
�
�
�
�
�-:�D�O�L�)�)�)rac���|j�d�d��\}}|st|jd<dS|���|j�t |jd��ddd��|j�t |j|t��dd d�
��|j�t |j|t��ddd�
��|j�tddd
��|j�tddd��|j�td��jddd��|j�tddd��|j�td��\}�|r��d|jd<d|jd<dS|j��fd�ddd�
��|j��fd�ddd�
��dSt|jd<dS)zS
Fill dict with statistics by varied statistics about PHP selector
c� �td��S)Nr�)rYr`rarbrozACloudlinuxSummary._fill_php_selector_statistics.<locals>.<lambda>�s��+�E�2�2�raz+Can't get statistics about PHP interpreters�selector_php_statusNr�r�z Can't get status of PHP selectorr��selector_php_versions_installedrd�selector_php_versions_enabled�selector_php_version_defaultz,Can't get default version of PHP interpreter�selector_php_version_nativez+Can't get native version of PHP interpreterr�selector_php_enabled_uiz%Can't get state of UI of PHP selector�selector_php_modezCan't get mode of PHP selectorz'Can't get summary usage of PHP selector�'selector_php_num_domains_by_interpreter�%selector_php_num_users_by_interpreterc�L��d��d���D��S)Nc�4�i|]\}}|t|����Sr`r��r��vr
s rb�
<dictcomp>zUCloudlinuxSummary._fill_php_selector_statistics.<locals>.<lambda>.<locals>.<dictcomp>�s$��s�s�s���G�Q��G���s�s�srar�r���php_usage_summarys�rbrozACloudlinuxSummary._fill_php_selector_statistics.<locals>.<lambda>�s)���s�s�?P�Qi�?j�?p�?p�?r�?r�s�s�s�rar�c�L��d��d���D��S)Nc�4�i|]\}}|t|����Sr`r�rFs rbrHzUCloudlinuxSummary._fill_php_selector_statistics.<locals>.<lambda>.<locals>.<dictcomp>�s$��q�q�q���G�Q��G���q�q�qra�users_by_php_versionrIrJs�rbrozACloudlinuxSummary._fill_php_selector_statistics.<locals>.<lambda>�s)���q�q�?P�Qg�?h�?n�?n�?p�?p�q�q�q�ra)r}r�r�r~rr��"_get_list_versions_of_interperters� INSTALLEDr�rUrWr[�php_selector_is_enabledrVrXr�)r�r"�php_interpretersrKs @rb�_fill_php_selector_statisticsz/CloudlinuxSummary._fill_php_selector_statistics�s����
%)�O�$A�$A�2�2�4a�%
�%
�!��!��B C�5:�D�O�1�2�2�2�
�
)��O�&�&���4�e�<�<��%�2�
�
�
�
�O�&�&���?�AQ�S\�]�]��1� �
'�
�
�
�
�O�&�&���?�AQ�SZ�[�[��/� �
'�
�
�
�
�O�&�&�'��.�>�
�
�
�
�O�&�&�'��-�=�
�
�
�
�O�&�&�%�e�,�,�D��)�7�
�
�
�
�O�&�&�(��#�0�
�
�
�*.��)F�)F�&�9�*�*�&�G�&��
�/�7�MQ��� I�J�KO��� G�H�H�H���*�*�s�s�s�s��=� $� +������*�*�q�q�q�q��;� $� +������6C�D�O�1�2�2�2ra�
total_apps�amount_of_apps_per_domainc�(�|dks|dkrdS||zS)z�
Get average amount of applications per domain
:param total_apps: total amount of applications
:param amount_of_apps_per_domain: amount of applications per domain
rQNr`)rTrUs rb�_get_average_apps_per_domainz.CloudlinuxSummary._get_average_apps_per_domain�s)����>�>�6��:�:��4��6�6�6ra�amount_of_apps_per_userc�(�|dks|dkrdS||zS)z�
Get average amount of applications per user
:param total_apps: total amount of applications
:param amount_of_apps_per_user: amount of applications per user
rQNr`)rTrXs rb�_get_average_apps_per_userz,CloudlinuxSummary._get_average_apps_per_users)����>�>�4�q�8�8��4��4�4�4ra�appsc�4�td�|D����S)z
Get amount of running applications on server
:param apps: list of applications for something selector
c�6�g|]}|j� |jdk�|��S)�started)�
app_status)r��apps rbr�z@CloudlinuxSummary._get_amount_of_runned_apps.<locals>.<listcomp>s,��Z�Z�Z�C�3�>�Z�c�n�PY�>Y�>Y�C�>Y�>Y�>Yrar�)r[s rb�_get_amount_of_runned_appsz,CloudlinuxSummary._get_amount_of_runned_appss!���Z�Z�4�Z�Z�Z�[�[�[rac��t��}|D]}||jxxdz
cc<�|�d��pdg}|ddS)z�
Get maximum amount of applications per domain
:param apps: list of applications for something selector
rQ�rrr)r�doc_root�most_common)r[�apps_per_domainr`�most_commonss rb�_get_max_apps_per_domainz*CloudlinuxSummary._get_max_apps_per_domain sh��"�)�)��� /� /�C��C�L�)�)�)�Q�.�)�)�)�)�'�2�2�1�5�5�A�&����A��q�!�!rac��t��}|D]}||jxxdz
cc<�|�d��pdg}|ddS)z~
Get maximum amount of applications per user
:param apps: list of applications for something selector
rQrcr)rr�re)r[�
apps_per_userr`rgs rb�_get_max_apps_per_userz(CloudlinuxSummary._get_max_apps_per_user0sh�� � � �
�� )� )�C��#�(�#�#�#�q�(�#�#�#�#�%�0�0��3�3�?��x���A��q�!�!rac�V�t��}|D]}||jxxdz
cc<�|S)z�
Get Counter object which contains amount applications per version of interpreter
:param apps: list of applications for something selector
rQ)rr�)r[�apps_per_versionr`s rb�_get_counter_apps_per_versionz/CloudlinuxSummary._get_counter_apps_per_version@sD��#�9�9��� /� /�C��S�[�)�)�)�Q�.�)�)�)�)��rac�x�|�|��}|�d��pdg}|ddS)z�
Get maximum amount of applications per version of interpreter
:param apps: list of applications for something selector
rQrcr)rnre)r�r[rmrgs rb�_get_max_apps_per_versionz+CloudlinuxSummary._get_max_apps_per_versionMsC�� �=�=�d�C�C��(�3�3�A�6�6�B�6�(���A��q�!�!rac�z�t��}|D]}|�|j���t|��S)zz
Get amount of domains with applications
:param apps: list of applications for something selector
)rr�rdr�)r[r
r`s rb� _get_amount_of_domains_with_appsz2CloudlinuxSummary._get_amount_of_domains_with_appsZs?���%�%��� &� &�C��K�K���%�%�%�%��7�|�|�rac�z�t��}|D]}|�|j���t|��S)zx
Get amount of users with applications
:param apps: list of applications for something selector
)rr�r�r�)r[�usersr`s rb�_get_amount_of_users_with_appsz0CloudlinuxSummary._get_amount_of_users_with_appsgs?������� � �C��I�I�c�h������5�z�z�rac�J�|�|��}t|��S)z�
Get amount of applications per each version of interpeters
:param apps: list of applications for something selector
)rnr�)r�r[rms rb�4_get_amount_of_apps_per_each_version_of_interpreterszFCloudlinuxSummary._get_amount_of_apps_per_each_version_of_interpretersts'�� �=�=�d�C�C���$�%�%�%ra�interpreters_stats�statec�D���fd�|���D��S)z�
Get list of versions of interpreters on server
:param interpreters_stats: dict with varied statistics about each version of interpeters
:param state: state of interpeters (installed, enabled)
c�*��g|]\}}|��
|��Sr`r`)r��interpreter_stats�statrys �rbr�zHCloudlinuxSummary._get_list_versions_of_interperters.<locals>.<listcomp>�s,���k�k�k�&=�&7��_c�di�_j�k�!�k�k�krarI)rxrys `rbrOz4CloudlinuxSummary._get_list_versions_of_interperters~s-���l�k�k�k�AS�AY�AY�A[�A[�k�k�k�krac�F�t|��}|�t|��SgS)zI
Get list of apllications on server for defined selector
)rZr&)r�� iter_appss rb�_get_list_of_applicationsz+CloudlinuxSummary._get_list_of_applications�s(��-�[�9�9� �� �� �?�?�"�� rac
�X��|jD�]}|j�tt|��d|�d���\}}|�t
|jd|zdz<�P|st|jd|zdz<�h|j�t|j|��dd|zdz|rd|�d�nd��|j�t|j |t��d d|zd
zd���|j�t|j |t��d d|zdzd���|j�t|j|��d
|�d���\}�|s��Y|j��fd�dd|zdzd���|jd|zdzdk|jd|zdz<|j�t|j
���dd|zdzd���|j�tt|��d|�d���\}}|r|�||jd|zdz<|j�t|j���dd|zdzd|�d���|j�t|j���dd|zdzd|�d���|j�t|j���dd|zdzd|�d���|j�t|j���dd|zdzd |�d���|j�t|j|jd|zdz|jd|zdz��d!|�d���\}}|r|�||jd|zd"z<|j�t|j|jd|zdz|jd|zdz��d#|�d���\}}|r|�||jd|zd$z<|j�t|j���d%d|zd&zd'|�d�����!dS)(zc
Fill dict with statistics by varied statistics about ruby/nodejs/python selectors
zCan't get statistics about z
interpretersN� selector_�_statusr�zCan't get status of z selectorr��_versions_installedrd�_versions_enabledzCan't get list of z
applicationsc�"��t���Sr_r�)�interpreter_appss�rbroz>CloudlinuxSummary._fill_selectors_statistics.<locals>.<lambda>�s����,�-�-�rar�_applications_amountr�_used�_applications_runningzCan't get default version of �_default_version�_max_applications_per_domainz*Can't get max applications per domain for z interpreter�_max_applications_per_userz(Can't get max applications per user for �_num_users_with_appsz0Can't get amount of users with applications for z interpeter�_num_domains_with_appsz2Can't get amount of domains with applications for z8Can't get average amount of applications per domain for � _average_applications_per_domainz6Can't get average amount of applications per user for �_average_applications_per_userr�� _num_applications_by_interpreterz5Can't get amount of applications per each version of )� SELECTORSr}r�rrYr�r�r~r�rOrPr�r�rarTrhrkrurrrWrZrw)r��selectorr"rx�default_version_of_selector�average_apps_per_domain�average_apps_per_userr�s @rb�_fill_selectors_statisticsz,CloudlinuxSummary._fill_selectors_statistics�s����
��o �o �H�*.�/�*G�*G��/��:�:�E�h�E�E�E�+�+�'�G�'�"�)�FS����h� 6�� B�C���
�FK����h� 6�� B�C���O�&�&���4�h�?�?���h�&��2�>E�O�:�x�:�:�:�:�4�
�
�
�
�O�&�&���?�AS�U^�_�_���h�&�)>�>� �
'�
�
�
�
�O�&�&���?�AS�U\�]�]���h�&�)<�<� �
'�
�
�
�)-��(E�(E���6��A�A�<�X�<�<�<�)�)�%�G�%��
���O�&�&�-�-�-�-���h�&�)?�?� �
'�
�
�
����h� 6�9O� O�P�ST�T�
�O�K�(�2�W�<�=�
�O�&�&���7�9I�J�J���h�&�)@�@� �
'�
�
�
�48�?�3P�3P��+�X�6�6�C��C�C�C�4�4�0�G�0��
k�6�B�Oj����h� 6�9K� K�L��O�&�&���5�7G�H�H���h�&�)G�G�S�X�S�S�S�
�
�
�
�O�&�&���3�5E�F�F���h�&�)E�E�Q�8�Q�Q�Q�
�
�
�
�O�&�&���;�=M�N�N���h�&�)?�?�X�8�X�X�X�
�
�
�
�O�&�&���=�?O�P�P���h�&�)A�A�Z�X�Z�Z�Z�
�
�
�04��/L�/L���5��O�K�(�$:�=S�$S�T��O�K�(�$:�=U�$U�V���
b�8�a�a�a�
0�0�,�G�,��
w�2�>�_v����h� 6�9[� [�\�-1�_�-J�-J���3��O�K�(�$:�=S�$S�T��O�K�(�$:�=S�$S�T���
`��_�_�_�
.�.�*�G�*��
s�0�<�]r����h� 6�9Y� Y�Z��O�&�&���Q�Sc�d�d���h�&�)K�K�_��_�_�_�
�
�
�
�Uo �o rac��ddg}t|d���\}}}|dkrt|���tj|��}i}|d|d<d�|dD��}tD]#}|�|t��|d |z<�$|S)
zA
Get wizard status and list of installed modules
z/usr/sbin/cloudlinux-wizardr'Tr�r�
wizard_statusc�,�i|]}|d|d��S)r�r'r`)r�rns rbrHz<CloudlinuxSummary._get_wizard_statistics.<locals>.<dictcomp>s#��`�`�`�v�&��.�&��*:�`�`�`rarp�wizard_module_)r-r#r�r�r7r��NOT_SELECTED)r��ret_code�std_out�std_err�parsed_json�wizard_statistics�parsed_modulesrns rb�_get_wizard_statisticsz(CloudlinuxSummary._get_wizard_statistics s���-�h�7��%0���%N�%N�%N�"��'�7��q�=�=�'��0�0�0��j��)�)����-8��-I��/�*�`�`��U^�I_�`�`�`��!� d� d�F�;I�;M�;M�f�Vb�;c�;c��.��7�8�8� � rac�����|j�|jd��\}�|j��fd�ddd���tD]'�|j���fd�dd�zd����(dS) zX
Fill dict with statistics by varied statistics about cloudlinux-wizard
z,Can't get statistics about cloudlinux-wizardc����dS)Nr�r`)r�s�rbroz;CloudlinuxSummary._fill_wizard_statistics.<locals>.<lambda>)s
���%�o�6�rar�r�Nrdc����d�zS)Nr�r`)rnr�s��rbroz;CloudlinuxSummary._fill_wizard_statistics.<locals>.<lambda>0s���)�*:�V�*C�D�rar�)r}r�r�r~r7)r�r�rnr�s @@rb�_fill_wizard_statisticsz)CloudlinuxSummary._fill_wizard_statisticss����� $��<�<��'�:�
�
����
��"�"�6�6�6�6���� #�
�
�
�"� � �F��O�&�&�D�D�D�D�D�� �6�)� �
'�
�
�
�
� � rac��t��}g}|D],}|t||�����z
}�-|S)zH
Returns list of implemented scripts in integration.ini
)r;r&�keys)r�scripts�sections rb�$_get_implemented_integration_scriptsz6CloudlinuxSummary._get_implemented_integration_scripts6sL��
#�$�$����� 4� 4�G��t�F�7�O�0�0�2�2�3�3�3�G�G��rac��dgd�}tj�t��s|Sd|d<|���|d<|S)zh
Checks integration script exists and if exists
get list of implemented scripts
F)�integration_scripts_used�integration_scripts_specifiedTr�r�)r�r�r�r:r�r�s rb�_get_integration_infoz'CloudlinuxSummary._get_integration_infoAsT��
/4�VX�Y�Y���w�~�~�k�*�*� ��M�-1��)�*�26�2[�2[�2]�2]��.�/��
rac��d}tj��}t|j��|z}t|j��|z}||fS)zG
Gets memory usage: total and used memory in megabytes
i)�psutil�virtual_memory�float�total�used)�bytes_in_mb�mem� mem_total�mem_useds rb�_get_memory_usedz"CloudlinuxSummary._get_memory_usedMsH��
���#�%�%���#�)�$�$�{�2� ����?�?�[�0���(�"�"rac�H�tj��}d}d}ttj��rot
j�|��rPt|dd���5}|� ���
��}ddd��n#1swxYwY||fS)za
Gets kernel info release and module version (starting from 7h)
:return:
z/sys/module/kmodlve/versionNr�r�r�)�platform�releaserrrmr�r�r�r�r�r�)�kernel_release�kmodlve_version_file�kmodlve_versionr�s rb�_get_kernel_infoz"CloudlinuxSummary._get_kernel_infoXs���"�)�+�+��<����%�g�k�2�2� 3�r�w�~�~�FZ�7[�7[� 3��*�C�'�B�B�B�
3�a�"#�&�&�(�(�.�.�"2�"2��
3�
3�
3�
3�
3�
3�
3�
3�
3�
3�
3����
3�
3�
3�
3���.�.s�"'B�B�Bc�8�tt����S)zp
Gets info about lve extensions usage
Calculates amount of packages with lve extensions
)r�r@r`rarb�#_get_lve_extensions_packages_amountz5CloudlinuxSummary._get_lve_extensions_packages_amountgs���3�5�5�6�6�6rac� �d}tj�|��sdSt|dd���5}|������}ddd��n#1swxYwYt
t|����S)zk
Reads /proc/sys/fs/datacycle/enable in order to check
datacycle enabled parameter
z/proc/sys/fs/datacycle/enableFr�r�r�N)r�r�r�r�r�r�r�r)�datacycle_filer�r,s rb�$_is_kernel_datacycle_enabled_in_filez6CloudlinuxSummary._is_kernel_datacycle_enabled_in_fileos���9���w�~�~�n�-�-� ��5�
�.�#��
8�
8�
8� $�A��6�6�8�8�>�>�#�#�D� $� $� $� $� $� $� $� $� $� $� $���� $� $� $� $��C��I�I���s�'A)�)A-�0A-c��d\}}tj�|��sdSt|dd���5}|�������d��}ddd��n#1swxYwY||vS)zR
Checks if datacycle parameter was given
for current boot
)z
/proc/cmdline� datacycleFr�r�r�� N)r�r�r�r�r�r��split)�cmdline_filer�r�r,s rb�_is_datacycle_param_was_passedz0CloudlinuxSummary._is_datacycle_param_was_passed~s���$@� ��j��w�~�~�l�+�+� ��5�
�,��g�
6�
6�
6� /�!��6�6�8�8�>�>�#�#�)�)�#�.�.�D� /� /� /� /� /� /� /� /� /� /� /���� /� /� /� /��T�!�!s�:A?�?B�Bc��tj��}d}|D]&}|ttj|����z
}�'|S)z=
Returns general amount of domains on server
r)rr�r�r�)�cpusers_list�
domains_countr�s rb�_get_total_domains_amountz+CloudlinuxSummary._get_total_domains_amount�sH��
�}�����
� � :� :�D��S��!2�4�!8�!8�9�9�9�M�M��rac��t��}tt|�d������}tt|�d������}|r|rdS|rdS|rdSdS)zi
Returns is links traversal protection enabled on server
(symlinks or hardlinks)
zfs.protected_symlinks_createzfs.protected_hardlinks_create�all�
symlinks_only�hardlinks_only�no)r"r�rr�)r��symlink_protection_enabled�hardlink_protection_enableds rb�%_is_link_traversal_protection_enabledz7CloudlinuxSummary._is_link_traversal_protection_enabled�s�������%)�#�f�j�j�9W�.X�.X�*Y�*Y�%Z�%Z�"�&*�3�v�z�z�:Y�/Z�/Z�+[�+[�&\�&\�#�%� �*E� ��5�%� #�"�?�&� $�#�#��trac���d}d}d}tj�d��stj�d��r|Stj�d��r|S|S)N�iso�cldeploy�qcow2z/etc/cl-convert-savedz/var/log/cldeployz/etc/cloudlinux-qcow2-installr�)r�r�r�s rb�_get_cl_installation_sourcez-CloudlinuxSummary._get_cl_installation_source�sd��������
�7�>�>�1�2�2� �b�g�n�n�EX�6Y�6Y� ��O�
�7�>�>�9�:�:� ��L��
rac������������ttj��rg�j��jddd����j��jddd����j��fd�ddd���td� ��s#�j�tdd
d����j�tddd����j�tddd����j��jdd
d���j��j
ddd���j��fd�ddd���������j��fd�ddd����j��fd�ddd���������j��fd�ddd����j��fd�ddd����j��jddd���ttj��r �j��fd�ddd ���j�t"dd!d"���j�t$dd#d$���j��jdd%d&��dS)'Nr�lve_extension_packages_amountrdr��!link_traversal_protection_enabledc����dSr^r`��kernel_infos�rbroz;CloudlinuxSummary._fill_system_statistics.<locals>.<lambda>�s����A��ra�installed_kmod_lve_versionT��skip_jwt_check�cldiag_cron_check_enabled�
cpu_amount�testing_repository_enabled�base_distrozCan't detect platform for CLOS�secureboot_statusz+Can't detect whether secure boot is enabledc����dSr�r`r�s�rbroz;CloudlinuxSummary._fill_system_statistics.<locals>.<lambda>�s���K��N�rar�c����dS)Nr�r`��vendor_integration_infos�rbroz;CloudlinuxSummary._fill_system_statistics.<locals>.<lambda>�s���+�,F�G�rar�c����dS)Nr�r`r�s�rbroz;CloudlinuxSummary._fill_system_statistics.<locals>.<lambda>�s���+�,K�L�rar�r�c����dSr�r`��memory_usages�rbroz;CloudlinuxSummary._fill_system_statistics.<locals>.<lambda>�����L��O�rar��memory_total_mbc����dSr^r`r�s�rbroz;CloudlinuxSummary._fill_system_statistics.<locals>.<lambda>�r�ra�memory_used_mb�
domains_totalc�T������p����Sr_)r�r�r�s�rbroz;CloudlinuxSummary._fill_system_statistics.<locals>.<lambda> s$����B�B�D�D�m��Hk�Hk�Hm�Hm�ra�kernel_datacycle_usage_enabledz,Can't get kernel datacycle enabled parameter� virt_typez!Can't get the virtualization type�hostnamezCan't get the hostname�cloudlinux_installation_sourcezCan't get installation source)r�rrrmr}r~r�r�rr1rr+r�r�r�r�r�r&rr�)r�r�r�r�s`@@@rb�_fill_system_statisticsz)CloudlinuxSummary._fill_system_statistics�s��������+�+�-�-��%�g�k�2�2� ��O�&�&��8��/� �
'�
�
�
�
�O�&�&��:��3� �
'�
�
�
�
�O�&�&�&�&�&�&��,� �
'�
�
�
�"��6�6�6� ��O�&�&�-��+� �
'�
�
�
�
��"�"�9�e�\�t�"�T�T�T���"�"�#��(�� #�
�
�
�
��"�"�4�#5�u�m�Mm�n�n�n���"�"��#�U�,?�An�
�
�
�
��"�"�"�"�"�"�E�+;�� #�
�
�
�#'�"<�"<�">�">����"�"�G�G�G�G��&�� #�
�
�
�
��"�"�L�L�L�L��+�� #�
�
�
��,�,�.�.����"�"�#�#�#�#�W�.?�T� #�
�
�
�
��"�"�#�#�#�#�W�.>�D� #�
�
�
�
��"�"��*�E�?�PT� #�
�
�
�&�g�k�2�2� ��O�&�&�n�n�n�n��0�>�
�
�
�
��"�"��5�+�/R�
�
�
�
��"�"�7�E�:�?W�X�X�X���"�"��,��,�+�
�
�
�
�
rac�����j��fd�ddd���j�tddd���j�tddd ��dS)
Nc� ���jptSr_�r��UNKNOWN_RHN_IDr�s�rbrozKCloudlinuxSummary._fill_dict_with_rpm_packages_statistics.<locals>.<lambda> ����D�N�4�n�rar�r��Can't get system ID�
os_versionzCan't get version of OS�
rpm_stat_listrQz*Can't get info about client's rpm packages)r}r~r$rPr�s`rbr�z9CloudlinuxSummary._fill_dict_with_rpm_packages_statistics s�����"�"�4�4�4�4���!�
�
�
�
��"�"�>�5�,�Ha�b�b�b���"�"�!�?�J�@l�
�
�
�
�
ra�paramc�Z�tj|j�|����S)z�
Retrieve data from proc/mounts for param
:return: param_value - Optional[int],
if there is no value - None
)r/�
str_to_intr�r�)r�r s rb�_get_proc_paramz!CloudlinuxSummary._get_proc_param s#���(������)?�)?�@�@�@rac �H�dg}ttj��r|�gd���|D]I}|j�t
|j|��d|�dd��d|�����J|j�tddd��d S)
z�
Filling stats about mounting
- mount params from parameters list
- separate hidepid getting, since it is more complicated than
other mounting params
zkernel.memcg_oom_disable)
zfs.enforce_symlinksifownerzfs.symlinkown_gidzfs.protected_symlinks_allow_gidz fs.protected_hardlinks_allow_gidzfs.global_root_enablezfs.proc_can_see_other_uidzfs.proc_super_gidzfs.xfs.cap_res_quota_disablezubc.ubc_oom_disablezfs.process_symlinks_by_taskrr�r�z
Can't get �hidepidzCan't get hidepid valueN)
rrrmrVr}r~rrrr�r��
parameters�ps rb�_fill_proc_params_statisticsz.CloudlinuxSummary._fill_proc_params_statistics( s���
'�
�
�&�g�k�2�2� �
������
�
�
�� � �A��O�&�&���,�a�0�0��� � �#�s�#�#� �Q� � �
�
�
�
�
��"�"�*���%�
�
�
�
�
rac ��d}|D]9}|j�t|j|��dd|��d|�d����:dS)zJ
Fill dict with statistics about kmodlve parameters usage
)�lve_setuid_enterr�kmodlve_zCan't get "z" kmodlve parameter valueN)r}r~r�_get_kmodlve_param_valuers rb�_fill_kmodlve_params_statisticsz1CloudlinuxSummary._fill_kmodlve_params_statisticsU sk��+�
�� � �A��O�&�&���5�q�9�9���1���;�q�;�;�;�
�
�
�
� � rac����td����|j��fd�ddd��|j��fd�ddd ��|j��fd
�ddd��|j��fd
�ddd��|j��fd�ddd��|j�tt���ddd��dS)zv
Fill statistics fields from jwt token.
- jwt token metrics (cl_plus existence and client_id)
F)�check_expirationc�8����dn��dd��S)N�cl_plus�r��r,s�rbroz=CloudlinuxSummary._fill_cln_jwt_information.<locals>.<lambda>j s���D�L�D�D�d�h�h�y�$�.G�.G�rarrzCan't get cl_plus informationc�8����dn��dd��S)N� client_idrrs�rbroz=CloudlinuxSummary._fill_cln_jwt_information.<locals>.<lambda>p s���D�L�D�D�d�h�h�{�D�.I�.I�rarzCan't get client_id valuec�8����dn��dd��S)N�is_awp_premium_allowedrrs�rbroz=CloudlinuxSummary._fill_cln_jwt_information.<locals>.<lambda>v s���D�L�D�D�d�h�h�7O�QU�.V�.V�ra�jwt_is_awp_premium_allowedz&Can't get is_awp_premium_allowed valuec�8����dn��dd��S)N�is_awp_cdn_allowedrrs�rbroz=CloudlinuxSummary._fill_cln_jwt_information.<locals>.<lambda>| s���D�L�D�D�d�h�h�7K�T�.R�.R�ra�jwt_is_awp_cdn_allowedz"Can't get is_awp_cdn_allowed valuec�8����dn��dd��S)N�is_trialrrs�rbroz=CloudlinuxSummary._fill_cln_jwt_information.<locals>.<lambda>� s���D�L�D�D�d�h�h�z�4�.H�.H�ra�jwt_is_trial_licensez$Can't get jwt_is_trial_license value�license_activezCan't get license status valueN)r?r}r~rrB)r�r,s @rb�_fill_cln_jwt_informationz+CloudlinuxSummary._fill_cln_jwt_informationb sD���.�u�E�E�E����"�"�G�G�G�G���+�
�
�
�
��"�"�I�I�I�I���'�
�
�
�
��"�"�V�V�V�V��(�4�
�
�
�
��"�"�R�R�R�R��$�0�
�
�
�
��"�"�H�H�H�H��"�2�
�
�
�
��"�"��0�$�7�7��@P�Rr�
�
�
�
�
rac����j��fd�ddd���j�tddd��dS) za
Filling stats centralized management
- centralized management existence
c�L��tj��j��Sr_)r�r�r��CL_PLUS_CM_DISABLED_PATHr�s�rbrozKCloudlinuxSummary._fill_centralized_management_statistics.<locals>.<lambda>� s���B�G�N�N�4�#@�A�A�rar�centralized_management_disabledzCan't check CM disabling statusr��cl_plus_sender_service_statusz)Can't check cl plus sender service statusN)r}r~r>r�s`rb�'_fill_centralized_management_statisticsz9CloudlinuxSummary._fill_centralized_management_statistics� sf���
��"�"�A�A�A�A��-�-�
�
�
�
��"�"�%��+�7�
�
�
�
�
rac�2�i} t��}|D]H}|���D]1\}}|�d|��g���|���2�In9#tt
f$r%}t�d|��Yd}~nd}~wwxYw|S)a�
Prepare list of dicts with CPU metrics
Method get_cpu_metrics returns data in following format:
[
{
"id": 0,
"model": "QEMU Virtual CPU version 2.5+"
},
{
"id": 0,
"model": "QEMU Virtual CPU version 2.5+"
}
]
This helper produces a dict, where each key - metric_name,
value - list of values for all CPUs
"cpu_model": [
"QEMU Virtual CPU version 2.5+",
"QEMU Virtual CPU version 2.5+"
],
"cpu_id": [
0,
0
]
�cpu_zCPU metrics getting error: %sN)rNr��
setdefaultr�r�rMr�r�)r�� cpu_cores�cpu_core�metric�value�exs rb�make_flat_cpu_metricsz'CloudlinuxSummary.make_flat_cpu_metrics� s���:�� B�'�)�)�I�%�
I�
I��%-�^�^�%5�%5�I�I�M�F�E��%�%�o�V�o�o�r�:�:�A�A�%�H�H�H�H�I�
I����&� B� B� B����<�b�A�A�A�A�A�A�A�A����� B�����
s�AA�B�/B�Bc ��gd�}|���}|D]A}|dkrdnd}|j�t|j|d��||d|�d����B|j�t
dd d
��dS)z�
Filling stats about hardware metrics, specifically:
CPU:
- cache
- frequency
- model
- id
RAM:
- ram
- swap
)�cpu_id�cpu_cache_mb� cpu_model�cpu_frequency_mhzr=�int_listr�NzCan't parse z metric for all coresr��memoryzCan't parse memory metrics)r9r}r~rr�rO)r��exp_metrics�cpu_metricsr6�metric_types rb�_fill_hardware_statisticsz+CloudlinuxSummary._fill_hardware_statistics� s���S�R�R���0�0�2�2��!� � �F�(.�+�(=�(=�*�*�:�K��O�&�&������6�6���<�v�<�<�<�
�
�
�
�
��"�"����(�
�
�
�
�
rac��|���\|jd<|jd<|jd<tj�d��|jd<dS)am
Collect CageFS enter errors number:
1. "Act like CageFS is disabled (unable to create LVE).. %d"
2. "Act like CageFS is disabled (unable to enter into NameSpace).. %d"
3. "Act like CageFS is disabled (unable to acquire lock for user %s uid %d)"
4. File-marker /etc/cagefs/fail.on.error presense
:return None
�(act_cagefs_disabled_unable_to_create_lve�&act_cagefs_disabled_unable_to_enter_ns�)act_cagefs_disabled_unable_to_acqure_lockz/etc/cagefs/fail.on.error�"act_cagefs_disabled_marker_presentN)�*_scan_log_for_act_cagefs_disabled_messagesr}r�r�r�r�s rb�$_fill_act_cagefs_disabled_statisticsz6CloudlinuxSummary._fill_act_cagefs_disabled_statistics� s[��
�;�;�=�=�
��O�F�G��O�D�E��O�G�H�@B����Oj�@k�@k���<�=�=�=rac��� |���\}}|dkr�|�d��}ttddd|�����}t |��}ttddd|�����}t |��}ttddd|�����}t |��}nd}d}d}|||fS#t
tf$rYdSwxYw) a�
Scan /var/log/messages for all needed "Act like CageFS is disabled ..." messages for yesterday
:return tuple of ints:
Number of "Act like CageFS is disabled (unable to create LVE).. " messages,
Number of "Act like CageFS is disabled (unable to enter into NameSpace).. " messages,
Number of "Act like CageFS is disabled (unable to acquire lock for user %s uid %d)" messages
r�
z2Act like CageFS is disabled (unable to create LVE)T)�fixed_string�multiple_search�data_from_filez<Act like CageFS is disabled (unable to enter into NameSpace)z<Act like CageFS is disabled (unable to acquire lock for user)����rQrQ)�_get_data_from_logr�r&r'r�r�r�)r��
returncoder��
lines_list�found_lines_list�num_unable_to_create_lve�num_unable_to_enter_ns�num_unable_to_acqure_locks rbrJz<CloudlinuxSummary._scan_log_for_act_cagefs_disabled_messages� sA��( !�!%�!8�!8�!:�!:��J���Q���#�\�\�$�/�/�
�#'��L�%)�(,�'1� ���$�$� �,/�/?�+@�+@�(�#'��V�%)�(,�'1� ���$�$� �*-�-=�)>�)>�&�#'��V�%)�(,�'1� ���$�$� �-0�0@�,A�,A�)�)�,-�(�)*�&�,-�)�+�-C�E^�^�^����!� !� !� !� �=�=� !���s�C
C
�
C"�!C"c �D�t��}|dvrd}nOtj���tjd���z
}|�d��}d|�d�}t
j|ddd tjtj d
���}|j
|jfS)z�
Scan /var/log/messages for all needed "Act like CageFS is disabled ..." messages for yesterday
:return: Tuple (ret code, std_out string)
)�cl7�cl7h�cl8za/usr/bin/journalctl --since yesterday --until today | /usr/bin/grep 'Act like CageFS is disabled'rQ)�daysz%Y-%m-%dz/usr/share/cloudlinux/logs-at z< /var/log/messages | /bin/grep 'Act like CageFS is disabled'Tr5F)r�r6r7r��stderrr8)r$�datetime�date�today� timedelta�strftimerBrC�PIPE�DEVNULLrSr�)�os_type�s_cmd�yesterday_date�date_to_scanrs rbrRz$CloudlinuxSummary._get_data_from_log*
s���!�"�"���,�,�,�w�E�E�&�]�0�0�2�2�X�5G�Q�5O�5O�5O�O�N�)�2�2�:�>�>�L�N��N�N�N�
�
�N����"��?��%��
�
�
���|�Q�X�%�%rac����ttj��r"�j��jddd��t�jd<�j�ttj d���ddd ���j��j
dd
d���j��jddd
���j��jddd���j��fd�ddd���j��fd�ddd��t�!t�t�dt���jd<n
d�jd<����dS)Nr�old_way_of_integration_used�*Can't detect old LVE integration mechanism�lve_utils_versionF)�
verify_expr��
cl_editionzCan't get CloudLinux edition�is_solo_meta_file_presentz$Can't detect solo meta file presence�is_admin_meta_file_presentz%Can't detect admin meta file presence�is_container_meta_file_presentz)Can't detect container meta file presencec����jSr_�r�r�s�rbrozACloudlinuxSummary._prepare_cl_normal_statistics.<locals>.<lambda>e
�
���D�'�rar��$Can't get or generate security tokenc� ���jptSr_rr�s�rbrozACloudlinuxSummary._prepare_cl_normal_statistics.<locals>.<lambda>k
rrar�rr�lvemanager_version)rrrmr}r~r��LVE_UTILS_PKG_VERSIONrr�get_cl_edition�_is_solo_marker_exists�_is_admin_marker_exists�_is_container_marker_exists�LVEMANAGER_PKG_VERSION�LVEMANAGER_PKG_RELEASE�_fill_dict_with_statisticsr�s`rbr�z/CloudlinuxSummary._prepare_cl_normal_statisticsK
s����%�g�k�2�2� ��O�&�&��0��-�<�
�
�
�0E���+�,���"�"��J�-�%�@�@�@�%��Wu�
�
�
�
��"�"��'��0K�Ms�
�
�
�
��"�"��(�%�1M�Ov�
�
�
�
��"�"��,��,�7�
�
�
�
��"�"�'�'�'�'���2�
�
�
�
��"�"�4�4�4�4���!�
�
�
�"�-�2H�2T�7M�4h�4h�Pf�4h�4h�D�O�0�1�1�48�D�O�0�1��'�'�)�)�)�)�)rac���� �
���d� d�d�
d�d�d}tj�� ��sdSGd�d t������ �
��fd
�}�
d�d�di}d�tj� ��D��}|���|D]/} |||���#�$rY�t$r
|D]}d
||<�Y�,wxYw|�|j�<|�|j�<|�
|j�
<tj�d��rd|j|<dStj�d��rd|j|<dSd|j|<dS)z�
Filling stats lvemanager
- number of visits on X-Ray tab
- number of X-Ray installation
- number of LVEManager opens
z/var/log/cloudlinux/i�Q�lve_number_of_opens�xray_number_of_installation�xray_number_of_visits�xray_advanced_metrics_statusNc��eZdZdS)�ECloudlinuxSummary._fill_lvemanager_statistics.<locals>.BreakOuterLoopN)rr�
__module__�__qualname__r`rarb�BreakOuterLoopr��
s�������Drar�c���tj������}�|z}t|dd���5}d}|D�]} d�|�d��dd���}tj�|d�����}|�z
|cxkr|kr�nn�d�|����d��dd���} | dkr|�
xxd z
cc<n0| d
kr|�xxd z
cc<n| dkr|�xxd z
cc<nd}��#ttf$rY��wxYw|r�
� ddd��dS#1swxYwYdS)
Nr�r�r�Fr�rz%Y-%m-%d %H:%M:%S,%fzlvemanager-openedrQzxray-install-startedzxray-tab-clickedT)
r_�nowr$r�r�r��strptimer�r��AttributeError)�stats�file�current_date_timestamp� file_pathr��break_outer_loop�line�log_time�log_date_timestampr�r��COLLECTING_PERIOD�
LOG_FOLDER�LVE_NUMBER_OF_OPENS�XRAY_NUMBER_OF_INSTALLS�XRAY_NUMBER_OF_VISITSs ������rb�fill_statisticszFCloudlinuxSummary._fill_lvemanager_statistics.<locals>.fill_statistics�
s#���%-�%6�%:�%:�%<�%<�%F�%F�%H�%H�"�"�T�)�I��i��w�7�7�7�
)�1�#(� ��!�!�D�!�#&�8�8�D�J�J�s�O�O�B�Q�B�,?�#@�#@��-5�->�-G�-G��Rh�-i�-i�-s�-s�-u�-u�*�1�4E�E�HZ�s�s�s�s�]s�s�s�s�s�s�&)�h�h�t�z�z�|�|�/A�/A�#�/F�/F�q�r�r�/J�&K�&K�G�&�*=�=�=� %�&9� :� :� :�a� ?� :� :� :� :�!(�,B�!B�!B� %�&=� >� >� >�!� C� >� >� >� >�!(�,>�!>�!>� %�&;� <� <� <�� A� <� <� <��/3�,���&��7�!�!�!� ��!����#�)�(�(�)�%
)�
)�
)�
)�
)�
)�
)�
)�
)�
)�
)�
)����
)�
)�
)�
)�
)�
)s7� E<�C>E�E<�E'�#E<�&E'�'E<�<F�Frc�<�g|]}tjd|���|��S)z^lvemanager\.log(\.\d{1,2})?$)�re�match)r�r�s rbr�zACloudlinuxSummary._fill_lvemanager_statistics.<locals>.<listcomp>�
s+��q�q�q�d���Ii�ko�@p�@p�q�T�q�q�qrarjz./opt/alt/php-xray/php/advanced_metrics.enabledrhz//opt/alt/php-xray/php/advanced_metrics.disabledri�none) r�r��isdirr��listdir�sortr�r}r�)
r��XRAY_ADVANCED_METRICS_STATUSr�r}� log_files�log_filer}r�r�r�r�r�r�s
@@@@@@rb�_fill_lvemanager_statisticsz-CloudlinuxSummary._fill_lvemanager_statisticsv
s��������,�
�%��3��"?�� 7��'E�$��w�}�}�Z�(�(� ��F� � � � � �Y� � � � )� )� )� )� )� )� )� )� )� )�0*�1�.C�Q�H_�ab�c�
�
r�q�b�j��&<�&<�q�q�q� �������!� *� *�H�
*���
�H�5�5�5�5��!�
�
�
����
*�
*�
*�&�*�*�D�')�J�t�$�$�*�*�
*����2<�<Q�1R���-�.�3=�>U�3V���/�0�/9�:M�/N���+�,�
�7�>�>�J�K�K� C�<E�D�O�8�9�9�9�
�W�^�^�M�
N�
N� C�<F�D�O�8�9�9�9�<B�D�O�8�9�9�9s�B�B:�$B:�9B:c��d}d}|j�|jd��\}}|st|j|<dS|d|j|<|d|j|<dS)z9
Fill dict with Leapp upgrade statistics
�leapp_upgrade_status�centos7_cl7_cl8_transformationzCan't get Leapp statisticsN�leapp_status�discount_eligible)r}r��get_leapp_statsr�)r��LEAPP_STATUS�DISCOUNT_ELIGIBILITYr"�elevate_statuss rb�_fill_leapp_statisticsz(CloudlinuxSummary._fill_leapp_statistics�
s|��.�� @��"&�/�"?�"?�� �(�#
�#
����
� �,1�D�O�L�)��F�(6�~�(F����%�0>�?R�0S���,�-�-�-rac�r�t��}d�|D��|jd<d�|D��|jd<dS)z:
Fill dict with feature flags information
c��g|] }|j��
Sr`r_�r�r�s rbr�zDCloudlinuxSummary._fill_feature_flags_statistics.<locals>.<listcomp>�
s��4T�4T�4T��Q�V�4T�4T�4Tra�server_flags_availablec�*�g|]}|j� |j��Sr`)rhr�r�s rbr�zDCloudlinuxSummary._fill_feature_flags_statistics.<locals>.<listcomp>�
s#��2_�2_�2_�a�UV�U^�2_�1�6�2_�2_�2_ra�server_flags_enabledN)r]r})r��all_flags_infos rb�_fill_feature_flags_statisticsz0CloudlinuxSummary._fill_feature_flags_statistics�
sK��)�*�*��4T�4T�^�4T�4T�4T���0�1�2_�2_�>�2_�2_�2_���.�/�/�/rac��d}d}d}d}d}d}d}d}tj�|��r|}tj�|��r|}tj�|��r|}||j|<dS) z8
Fill out AccelerateWP promotion status
�accelerate_wp_promotion_status�enabled_for_current_server�enabled_for_all_servers�skippedz,/var/lve/clflags/enable_awp_all_servers.flagz,/var/lve/clflags/enable_awp_this_server.flagz$/var/lve/clflags/skip_awp_setup.flagN)r�r�r�r}) r��FIELD�ENABLED_FOR_CURRENT_SERVER�ENABLED_FOR_ALL_SERVERS�SKIPPED�enable_awp_all_servers_flag�enable_awp_this_server_flag�skip_awp_setupr's rb�(_fill_accelerate_wp_promotion_statisticsz:CloudlinuxSummary._fill_accelerate_wp_promotion_statistics�
s���
1��&B�"�";����'U�#�&T�#�?����
�7�>�>�5�6�6� -�,�F�
�7�>�>�5�6�6� 0�/�F�
�7�>�>�.�)�)� ��F�!'������rac�v���j��fd�ddd���j��fd�ddd��t�jd<t�!t�t�d t���jd
<n
d�jd
<�j��jddd
������dS)Nc����jSr_rtr�s�rbroz7CloudlinuxSummary._prepare_statistics.<locals>.<lambda>�
rurar�r�rvc� ���jptSr_rr�s�rbroz7CloudlinuxSummary._prepare_statistics.<locals>.<lambda>rrar�rrmrrxrrkrl)r}r~ryr~rr�r�r�s`rb�_prepare_statisticsz%CloudlinuxSummary._prepare_statistics�
s������"�"�'�'�'�'���2�
�
�
�
��"�"�4�4�4�4���!�
�
�
�0E���+�,�!�-�2H�2T�7M�4h�4h�Pf�4h�4h�D�O�0�1�1�48�D�O�0�1���"�"��,��)�8�
�
�
�
�'�'�)�)�)�)�)rac�R�ttj��r|���ttj��r(|���|���ttj��r|���ttj ��r(|�
��|���ttj��r|�
��ttj��s2ttj��sttj��r|���t%d���s|���ttj��r|���ttj��r|���|���|���|���|���|���|���|���|���|� ��|�!��|�"��|�#��|�$��|�%��|�&��|�'��dS)NTr�)(rr�GOVERNORr��CAGEFSrrK�RESELLER_LIMITSr-rmr�r�PHP_SELECTORrS�
RUBY_SELECTOR�PYTHON_SELECTOR�NODEJS_SELECTORr�rr0�LSAPIr��WIZARDr�� _fill_wpos_activation_statistics�_fill_wpos_statisticsr*r�rrrDr�r8r�r�r�r�r�r��_fill_apache2nginx_statisticsr�s rbr�z,CloudlinuxSummary._fill_dict_with_statisticss���%�g�&6�7�7� 3��0�0�2�2�2�%�g�n�5�5� 8��(�(�*�*�*��5�5�7�7�7�%�g�&=�>�>� .��+�+�-�-�-�%�g�k�2�2� 3��(�(�*�*�*��0�0�2�2�2�%�g�&:�;�;� 1��.�.�0�0�0�&�w�'<�=�=� .�)�'�*A�B�B� .�*�'�*A�B�B� .�
�+�+�-�-�-�!��6�6�6� ;��8�8�:�:�:�%�g�m�4�4� *��'�'�)�)�)�%�g�n�5�5� +��(�(�*�*�*��-�-�/�/�/��"�"�$�$�$��&�&�(�(�(��+�+�-�-�-��$�$�&�&�&��)�)�+�+�+��&�&�(�(�(��*�*�,�,�,��!�!�#�#�#��(�(�*�*�*�� � �"�"�"��)�)�+�+�+��#�#�%�%�%��+�+�-�-�-��5�5�7�7�7��*�*�,�,�,�,�,rac�J�|j�|jddd��dS)Nr��apache2nginxz Can't parse Apache2Nginx metrics)r}r~�get_apache2nginx_statsr�s rbr�z/CloudlinuxSummary._fill_apache2nginx_statisticsAs5����"�"��'���.�
�
�
�
�
rac����|j�d�ddd��|j�td��\}�|j��fd�dd|rdnd��dS) Nc�J�tj�t��Sr_)r�r�r�r!r`rarbrozDCloudlinuxSummary._fill_wpos_activation_statistics.<locals>.<lambda>Ms��B�G�N�N�#B�C�C�rar�.cmt_is_accelerate_wp_free_activation_completedz2Can't get statistic of AccelerateWP CMT activationz,Can't get AccelerateWP activation statisticsc�.����d��S)N�accelerate_wp_free_activater)�client_activations�rbrozDCloudlinuxSummary._fill_wpos_activation_statistics.<locals>.<lambda>Zs���%�)�)�*G�H�H�ra�&cmt_accelerate_wp_free_activated_in_uiz;Can't get statistic of AccelerateWP CMT activation selected)r}r~r�r )r�r"r�s @rbr�z2CloudlinuxSummary._fill_wpos_activation_statisticsIs����
��"�"�C�C��<�@�
�
�
�&*�_�%B�%B�"�:�&
�&
�"��"�
��"�"�H�H�H�H��4�MT�^�I�I�Z^�
�
�
�
�
rac�D �� �
���|j�|jd��\}�|sdSt�t���rW��d��dk�r?��d��� |j��fd�ddd����d ��� |j��fd
�ddd��|j��fd�d
dd��|j��fd�d
dd����d��r |j��fd�d
dd���dD]-�
�
dkr� |j��
�fd�d
d�
zd���.��dg��D]&�
|j��
�fd�d
d�
zd���'�dD]-�
�
dkr� |j��
�fd�d
d�
zd���.��dg��D]&�|j���fd�d
d �zd���'��d!g��D]��|j���fd"�d
d#�zd����d$�}��d%�}��|��x�r#|j��fd&�d
d#|zd����|��x� r#|j�� fd'�d
d#|zd������dg��D]-�
�
dkr� |j��
�fd(�d
d)�
zd���.��d*i�����D]\�
}||jd+�
z<�|j��fd,�d
d-d��|j��fd.�d
d/d��|j��fd0�d
d1d2��|j��fd3�d
d4d5��|j��fd6�d7d8d9��|j��fd:�d7d;d<��|j��fd=�d7d>d?��|j��fd@�d7dAdB����dC��x}r+|���D]\}}||jdD|��<�dSdSdSdS)ENz!Can't get AccelerateWP statisticsr�r"�features_visible_by_defaultc����dS)Nr�r`��
wpos_statss�rbroz9CloudlinuxSummary._fill_wpos_statistics.<locals>.<lambda>l�
���J�'D�E�rar�� wpos_features_visible_by_defaultz*Can't get statistic of using AccelerateWP.�features_allowed_by_defaultc����dS)Nr�r`r�s�rbroz9CloudlinuxSummary._fill_wpos_statistics.<locals>.<lambda>sr�ra� wpos_features_allowed_by_defaultc� ���ddS)N�
enabled_sitesr�r`r�s�rbroz9CloudlinuxSummary._fill_wpos_statistics.<locals>.<lambda>y����
�?�3�G�<�rar�sites_count_with_enabled_wposc� ���ddS)N�
allowed_usersr�r`r�s�rbroz9CloudlinuxSummary._fill_wpos_statistics.<locals>.<lambda>r�ra�users_count_with_allowed_wpos�
visible_usersc� ���ddS)Nr�r�r`r�s�rbroz9CloudlinuxSummary._fill_wpos_statistics.<locals>.<lambda>�s���J��7��@�ra�users_count_with_visible_wposr�r�c� ���d�S)Nr�r`�rnr�s��rbroz9CloudlinuxSummary._fill_wpos_statistics.<locals>.<lambda>�����J��7��?�ra�sites_count_with_enabled_�
enabled_usersc� ���d�S)Nr�r`r�s��rbroz9CloudlinuxSummary._fill_wpos_statistics.<locals>.<lambda>�r�ra�users_count_with_enabled_r�c� ���d�S)Nr�r`r�s��rbroz9CloudlinuxSummary._fill_wpos_statistics.<locals>.<lambda>�r�ra�users_count_with_allowed_�allowed_suitesc� ���d�S)Nr�r`��suiter�s��rbroz9CloudlinuxSummary._fill_wpos_statistics.<locals>.<lambda>�����J�'7�8��?�ra�users_count_with_allowed_suite_�enabled_suitesc� ���d�S)Nrr`rs��rbroz9CloudlinuxSummary._fill_wpos_statistics.<locals>.<lambda>�rra�users_count_with_enabled_suite_� _billable�
_non_billablec����Sr_r`)�enabled_billables�rbroz9CloudlinuxSummary._fill_wpos_statistics.<locals>.<lambda>�s��� 0�rac����Sr_r`)�enabled_non_billables�rbroz9CloudlinuxSummary._fill_wpos_statistics.<locals>.<lambda>�s��� 4�rac� ���d�S)Nr�r`r�s��rbroz9CloudlinuxSummary._fill_wpos_statistics.<locals>.<lambda>�r�ra�users_count_with_visible_�upgrade_urls�upgrade_url_c����dS)N�4accelerate_wp_suite_enabled_premium_suite_disallowedr`r�s�rbroz9CloudlinuxSummary._fill_wpos_statistics.<locals>.<lambda>�s
���
�#Y�Z�rarc����dS)N�1accelerate_wp_suite_enabled_premium_suite_visibler`r�s�rbroz9CloudlinuxSummary._fill_wpos_statistics.<locals>.<lambda>�s
���
�#V�W�rarc�.����d��S)N�is_accelerate_wp_flag_enabledrr�s�rbroz9CloudlinuxSummary._fill_wpos_statistics.<locals>.<lambda>�����
���'F�G�G�rarz1Can't get statistic of AccelerateWP feature flag.c�.����d��S)N�is_accelerate_wp_icon_enabledrr�s�rbroz9CloudlinuxSummary._fill_wpos_statistics.<locals>.<lambda>�rrarz0Can't get statistic of AccelerateWP icon status.c�.����d��S)N�%is_smart_advice_notifications_enabledrr�s�rbroz9CloudlinuxSummary._fill_wpos_statistics.<locals>.<lambda>�s���
���'N�O�O�rar�rzJCan't get statistic of AccelerateWP is_smart_advice_notifications_enabled.c�.����d��S)N�!is_smart_advice_reminders_enabledrr�s�rbroz9CloudlinuxSummary._fill_wpos_statistics.<locals>.<lambda>�s���
���'J�K�K�rarzFCan't get statistic of AccelerateWP is_smart_advice_reminders_enabled.c�.����d��S)N�+is_smart_advice_plugin_installation_enabledrr�s�rbroz9CloudlinuxSummary._fill_wpos_statistics.<locals>.<lambda>�s���
���'T�U�U�rar zPCan't get statistic of AccelerateWP is_smart_advice_plugin_installation_enabled.c�.����d��S)N�is_object_cache_banners_enabledrr�s�rbroz9CloudlinuxSummary._fill_wpos_statistics.<locals>.<lambda>s���
���'H�I�I�rar"zDCan't get statistic of AccelerateWP is_object_cache_banners_enabled.r��
awp_whmcs_) r}r��get_wpos_statsr�r�r�r~�
format_metricr�)
r�r"�billable_suite_metric�non_billable_suite_metric�upgrade_url�whmcs_stats�keyr7rr
rnrr�s
@@@@@rbr�z'CloudlinuxSummary._fill_wpos_statisticsas��������"�o�;�;���/�
�
����� ��F��j�$�'�'�a @�J�N�N�8�,D�,D� �,Q�,Q��~�~�;�<�<�H���*�*�E�E�E�E��6�@� ����~�~�;�<�<�H���*�*�E�E�E�E��6�@� ���
�O�&�&�<�<�<�<��/�<�
�
�
�
�O�&�&�<�<�<�<��/�<�
�
�
��~�~�o�.�.�
���*�*�@�@�@�@��3�@� ���%�_�5�
�
���W�$�$����*�*�?�?�?�?�?��/�&�8�@� ����%�.�.��"�=�=�
�
����*�*�?�?�?�?�?��/�&�8�@� ����%�_�5�
�
���W�$�$����*�*�?�?�?�?�?��/�&�8�@� ����$���(8�"�=�=�
�
����*�*�?�?�?�?�?��5��=�@� ����$���(8�"�=�=�
�
����*�*�?�?�?�?�?��5��=�@� ���,1�(;�(;�(;�%�/4�,C�,C�,C�)�'1�~�~�6K�'L�'L�L�#���O�1�1�0�0�0�0��9�<Q�Q�D� ���,6�>�>�:S�+T�+T�T�'���O�1�1�4�4�4�4��9�<U�U�D� ����%�.�.��"�=�=�
�
���W�$�$����*�*�?�?�?�?�?��/�&�8�@� ����(2�~�~�n�b�'I�'I�'O�'O�'Q�'Q�
G�
G�#���;F����� 7�8�8��O�&�&�Z�Z�Z�Z��F�<�
�
�
�
�O�&�&�W�W�W�W��C�<�
�
�
�
�O�&�&�G�G�G�G��/�C�
�
�
�
�O�&�&�G�G�G�G��/�B�
�
�
�
�O�&�&�O�O�O�O��7�\�
�
�
�
�O�&�&�K�K�K�K��3�X�
�
�
�
�O�&�&�U�U�U�U��=�b�
�
�
�
�O�&�&�I�I�I�I��1�V�
�
�
�)�n�n�W�5�5�5�{�
@�"-�"3�"3�"5�"5�@�@�J�C��:?�D�O�$6��$6�$6�7�7�Ca @�a @�,Q�,Q�~
@�
@�@�@rac���dg|z} t|d���\}}}n3#t$r&}t�d|��Yd}~dSd}~wwxYw|dkr|St�d||��dS)z�
Run cloudlinux-statistics using subprocess and handle errors.
:type args: list[str]
:rtype: str or None
z/usr/sbin/cloudlinux-statisticsTr�z.Unable to run cloudlinux-statistics, error: %sNrz;cloudlinux-statistics failed with exit code: %i, output: %s)r-r#r�r�r�)rZr�rvr�r�r�s rb�_run_cloudlinux_statisticsz,CloudlinuxSummary._run_cloudlinux_statisticss���1�1�D�8�� �)�#�$�G�G�G�O�B��!�!��$� � � ����O�QR�S�S�S��4�4�4�4�4����� ������7�7��O����V�XZ�\d�e�e�e��ts��
A�A � Ac�Z�|�gd���}|�dS tj|��}|d}|d}nM#ttt
f$r3}t�dt|����Yd}~dSd}~wwxYwt|��t|��fS)zp
Get number of users and resellers with faults for the past 24h
:rtype: tuple[int, int]
)z
--by-faultrqrfz--period=1dN)NNrrtzISomething really bad happened to cloudlinux-statistics, The reason is: %s)
r,r�r�r�r�r�r�r�r�r�)r�r�� json_datarrtr�s rb�#get_users_and_resellers_with_faultsz5CloudlinuxSummary.get_users_and_resellers_with_faultss���
�2�2�3a�3a�3a�b�b�����:� ��
�8�,�,�I�!�+�.�I��g�&�E�E���*�i�0� � � ����j�lo�pq�lr�lr�s�s�s��:�:�:�:�:����� �����5�z�z�3�y�>�>�)�)s�$A�B�(B�Bc�6�|���dS)z�
a wrapper method for the get_users_and_resellers_with_faults method.
return the number of users with faults in the past 24 hours.
r�r/r�s rbrZz(CloudlinuxSummary._get_users_with_faults2���
�7�7�9�9�!�<�<rac�6�|���dS)z�
a wrapper method for the get_users_and_resellers_with_faults method.
return the number of resellers with faults in the past 24 hours.
rQr1r�s rbr#z,CloudlinuxSummary._get_resellers_with_faults9r2rac���|�dS|���}|�d��rdS|�d��rdS|�d��rdS|���rdSd|��S)zGet config cpu limit formatN�%�speed�mhz�ghz�old_cpu_formatz unknown: )�lower�endswith�isdigit)�clsrH�units rbrIz&CloudlinuxSummary._get_cpu_limit_units@s����;��4��y�y�{�{���=�=���� ��7��=�=���� ��5��=�=���� ��5��<�<�>�>� $�#�#� �3� � � rac��|�dSd|zdzS)z/Convert memory limit from mempages to megabytesNr�ir`)r7s rbrJz!CloudlinuxSummary._mempages_to_mbQs���=��4��5�y�D� � rac�h�|�dStj||pd���}|�dSt|dzd��S)z,Convert cpu and ncpu to percents of one coreNr)�lncpugY@rQ)rR�convert_to_kernel_format�round)rHr4r6s rbrGz(CloudlinuxSummary._cpu_limit_to_percentsXsE���;��4��2�3�d�i�a�H�H�H���=��4��U�U�]�A�&�&�&ra.c��|j��ttd�|j���D����td�����}g}t
|td�����D]8\}}tt|����}|�||f���9|� d���||_|jS)zC
Return list of tuples [users_in_package, package]
Nc3�2K�|]}|jj�|V��dSr_)�packager�)r�r�s rbr�z>CloudlinuxSummary.get_users_amount_per_plan.<locals>.<genexpr>is,����g�g�d���IZ�If�T�If�If�If�If�g�grarF)r*T)�reverse)
r��sortedr&rtrsr rr�r�r�)r�r.�users_sorted_by_packager�rF�group� num_userss rb�get_users_amount_per_planz+CloudlinuxSummary.get_users_amount_per_planbs���
��'�&,��g�g�&6�&<�&C�&C�&E�&E�g�g�g�g�g��y�)�)�'�'�'�#�!�O�")�*A�z�R[�G\�G\�"]�"]�"]�
=�
=������U���,�,� ��&�&� �7�';�<�<�<�<�� � �� �.�.�.�#2�D� ��#�#ra�
number_of_topc�b� |�|��|dz
S#t$rYdSwxYwr^)rL�
IndexError)r�rMr.s rbrz5CloudlinuxSummary._get_top_package_by_number_of_usersvsI�� ��1�1�2B�C�C�M�TU�DU�V�V��� � � ��4�4� ���s� �
.�.c�r�t|��\}}|s"|�t|����|S)z%
Parse CLI arguments
)rRr�r3)r�rur'r,s rbrlzCloudlinuxSummary._parse_argss>��5�T�:�:����� 7�� � ���!5�!5�6�6�6��rar"rr�r,� exit_coderHc��|tj��|d�}|�||d<t|d��tj|��dS)z?
Print data in default format for web and exit
)r�r$r,N�statistic_enabledT)rr2r:r;)r�r,rQrHr�s rbr<z(CloudlinuxSummary._print_result_and_exit�sP��$�$�)�+�+�t�L�L���+�+?�G�'�(���$�'�'�'��������rarQr�r.c��|�dtj��i��t|d��tj|��dS)z�
Print error and exit
:param dict message: Dictionary with keys "result" as string and optional "context" as dict
r$TN)r�rr2r:r;)r�r.s rbr�z!CloudlinuxSummary._error_and_exit�sG�� ����T�Y�[�[�1�2�2�2���$�'�'�'��������rac���tj�d��rHtjddgdtjtjd���}t
j|j��SdS)zD
Return mod_lsapi info from switch_mod_lsapi script
r�z--statTF�r�r�r^r8N) r�r�r�rBrCrdr�r�r��rs rbr�z$CloudlinuxSummary.get_raw_lsapi_info�sg��
�7�>�>�5�6�6� (���,�h�7��!��!������A��:�a�h�'�'�'� (� (rac�d�d}t��r|dz
}tj�|��r{t j|dgdtjtjd���}tj|j ���
d��}d�|���D��}|Sd S)
zd
Return wmt-api config
if is_solo_edition True, run wpt-api-solo is command
z-/usr/share/web-monitoring-tool/wmtbin/wmt-apiz-soloz--config-getTFrVrc�4�i|]\}}|t|����Sr`)r�)r��krGs rbrHz9CloudlinuxSummary._get_wmt_api_config.<locals>.<dictcomp>�s$��%[�%[�%[�D�A�q�a��Q���%[�%[�%[raN)rr�r�r�rBrCrdr�r�r�r�r�)r�r�wmt_api_config_summarys rbr�z%CloudlinuxSummary._get_wmt_api_config�s���B����� ��w��G�
�7�>�>�'�"�"� *����.�)��Z�_�U_�Ud�lq����A�&*�Z���%9�%9�%=�%=�h�%G�%G�"�%[�%[�<R�<X�<X�<Z�<Z�%[�%[�%[�"�)�)� *� *rac�@�tj�d��S)Nz/etc/cloudlinux-edition-solo�r�r�r�r`rarbr{z(CloudlinuxSummary._is_solo_marker_exists�s���w�~�~�<�=�=�=rac�@�tj�d��S)Nz/etc/cloudlinux-edition-adminr]r`rarbr|z)CloudlinuxSummary._is_admin_marker_exists�s���w�~�~�=�>�>�>rac�@�tj�d��S)Nz/etc/cloudlinux-containerr]r`rarbr}z-CloudlinuxSummary._is_container_marker_exists�s���w�~�~�9�:�:�:rac��tj�d��r3tjddgddd���}tj|j��SdS)zL
Return statistics from cloudlinux-ssa-manager get-stat API
z /usr/sbin/cloudlinux-ssa-manager�get-statTF�r�r�r8N�r�r�r�rBrCr�r�r�rWs rbr7zCloudlinuxSummary.get_ssa_stats�s_��
�7�>�>�<�=�=� (���3�Z�@�t�\`�hm����A��:�a�h�'�'�'� (� (rac���d}d}d}d}tj�|��rhtj�|��rItj�|��}tj�|��}||z
dkrd}d}t j��tjkrmtj�|��rMd}d}tt||d �
��d��} tt||d �
��d��}
|
r| sd}nKd}nHtj�|��r)d
}tt||d �
��d��}|rd}nd}|dkrd}||d�}
|
S)z;
Return statistics from Leapp upgrade logs
rz /var/log/leapp/leapp-upgrade.logz/var/log/elevate-cpanel.logz/var/log/cldeploy.logi�'rQzHAn upgrade inhibitor detected\|Workflow interrupted due to the FailPhasez'Starting stage After of phase FirstBootT)rNNrz
Great SUCCESS)r�r�)
r�r�r��getmtimer�r�rr��nextr')r��
leapp_logfile�elevate_cpanel_logfile�cldeploy_logfile�leapp_mtime�cldeploy_mtime�upgrade_status�
fail_grep_str�first_boot_grep_str�
fail_grep_res�first_boot_grep_res�success_grep_str�grep_res�stat_results rbr�z!CloudlinuxSummary.get_leapp_stats�s���
��:�
�!>��2��
�7�>�>�-�(�(� &�R�W�^�^�<L�-M�-M� &��'�*�*�=�9�9�K��W�-�-�.>�?�?�N��^�+�.?�?�?�$%�!��������!2�2�2��w�~�~�m�,�,�
'� k�
�&P�#� $�T�-��UY�%Z�%Z�%Z�\`� a� a�
�&*�4�0C�]�ae�+f�+f�+f�hl�&m�&m�#�&�'�}�'�%&�N�N�%&�N���w�~�~�4�5�5�
'�#3� ���%5�7M�\`� a� a� a�cg�h�h���'�%&�N�N�%&�N��Q��� !��'5�L]�^�^���rar�c���d}t||��}|���sdS|�d������}|dkrdS|dkrdSt d |�d
|�d����)z�
Get kmodlve parameter value:
-1 - not supported (parameter file doesn't exist);
0 - disabled;
1 - enabled
z/sys/module/kmodlve/parametersrjr�r��YrQ�NrzUnable to interpret "z" kmodlve parameter value: "�")r
r�� read_textr��RuntimeError)r��
params_dir�
param_file�param_values rbrz*CloudlinuxSummary._get_kmodlve_param_value
s���6�
��*�j�1�1�
�� � �"�"� ��2� �*�*�G�*�<�<�B�B�D�D���#����1��#����1��m�:�m�m�_j�m�m�m�n�n�nrac���d}tj�|��rFtj|dgddd���}tj|j���d��SdS)�E
Return statistics from cl-smart-advice counters API
z/usr/sbin/cl-smart-advice�countersTFrbr,N) r�r�r�rBrCr�r�r�r���utilrs rb�get_smart_advice_statsz(CloudlinuxSummary.get_smart_advice_stats*
sg��
+��
�7�>�>�$��� 4����j�1��T�Y^�_�_�_�A��:�a�h�'�'�+�+�F�3�3�3� 4� 4rac�"�ddd�}td���sy|j�|jd��\}}|�T |d|dd�S#t$r5}t
�dt|��|��|cYd}~Sd}~wwxYw|S) z=
Construct dict with Smart Advice statistics
N)�smart_advice_total�smart_advice_appliedT)�skip_marker_checkz!Can't get Smart Advice statisticsr��appliedzAUnexpected json response from server, field %s is missing in "%s")rr}r�r�r�r�rsr�)r�r�r"�sa_statsr�s rbr�z.CloudlinuxSummary._get_smart_advice_statistics4
s���)-�d�K�K��
$�d�;�;�;� "� $�� =� =��+�3�!�!��G�X��#�"�2:�7�2C�]e�fo�]p�q�q�q���"�"�"��(�(�[�]`�ab�]c�]c�em����"�M�M�M�M�M�M����� "����
�
s�A
�
B�*B�B�Bc�(�i}tj�d���r�tddd���5}t j|��}t
|��|d<t|�����}d�|D��}t
|��|d<t
d�|D����|d <g|d
<g|d<|D]�}|dd
kr9|� d��}|r!|d
�
|d���G|ddkr8|� d��}|r!|d�
|d����tt|d
����|d
<tt|d����|d<t
d�|D����|d<t
d�|D����|d<t
d�|D����|d<t
d�|D����|d<ddd��n#1swxYwYtj�d��rStddd���5}|����
��|d<ddd��n#1swxYwY|S)zP
Return statistics by parsing /var/lib/apache2nginx/server.json
z!/var/lib/apache2nginx/server.jsonr�r�r��total_websitesc�<�g|]}|�d���|��S)�proxy_reasonrr�s rbr�z<CloudlinuxSummary.get_apache2nginx_stats.<locals>.<listcomp>[
s)��H�H�H��!�%�%��2G�2G�H�1�H�H�Hra�total_proxy_passc�*�g|]}|ddk�|��S)r�� directiver`r�s rbr�z<CloudlinuxSummary.get_apache2nginx_stats.<locals>.<listcomp>`
s)��8p�8p�8p�q�q�Q_�O`�do�Oo�Oo��Oo�Oo�Oora�proxy_pass_due_directive�failing_directives�failing_handlersr�r��
proxy_detailsr
c�*�g|]}|ddk�|��S)r��testr`r�s rbr�z<CloudlinuxSummary.get_apache2nginx_stats.<locals>.<listcomp>q
s(��3f�3f�3f�!�!�N�J[�_e�Je�Je�A�Je�Je�Jera�proxy_pass_due_testc�*�g|]}|ddk�|��S)r��forcedr`r�s rbr�z<CloudlinuxSummary.get_apache2nginx_stats.<locals>.<listcomp>s
s(��5j�5j�5j�A�A�n�L]�ai�Li�Li�a�Li�Li�Lira�proxy_pass_due_forcedc�*�g|]}|ddk�|��S)r�r
r`r�s rbr�z<CloudlinuxSummary.get_apache2nginx_stats.<locals>.<listcomp>u
s(��6l�6l�6l�Q�Q�~�M^�bk�Mk�Mk�q�Mk�Mk�Mkra�proxy_pass_due_handlerc�*�g|]}|ddk�|��S)r��includesr`r�s rbr�z<CloudlinuxSummary.get_apache2nginx_stats.<locals>.<listcomp>w
s)��7n�7n�7n�a�a�P^�N_�cm�Nm�Nm��Nm�Nm�Nmra�proxy_pass_due_includesNz/var/lib/apache2nginx/statery)r�r�r�r�r��loadr�r&rsr�r�rr�r�)r�r�r,�websites�proxiedr��failing_directive�failing_handlers rbr�z(CloudlinuxSummary.get_apache2nginx_statsL
sE��
��
�7�>�>�=�>�>�% p��9�3��Q�Q�Q�$
p�UV��y��|�|��+.�d�)�)��&�'�����
�
�.�.��I�H�h�H�H�H��,/��L�L��(�)�58�8p�8p�G�8p�8p�8p�4q�4q��0�1�.0��*�+�,.��(�)� �Q�Q�A���(�K�7�7�,-�E�E�/�,B�,B�)�,�S�!�"6�7�>�>�q��?Q�R�R�R���>�*�i�7�7�*+�%�%��*@�*@��*�Q�!�"4�5�<�<�Q��=O�P�P�P��.2�3�u�=Q�7R�3S�3S�.T�.T��*�+�,0��U�;M�5N�1O�1O�,P�,P��(�)�/2�3f�3f�w�3f�3f�3f�/g�/g��+�,�14�5j�5j��5j�5j�5j�1k�1k��-�.�25�6l�6l�'�6l�6l�6l�2m�2m��.�/�36�7n�7n�7�7n�7n�7n�3o�3o��/�0�I$
p�$
p�$
p�$
p�$
p�$
p�$
p�$
p�$
p�$
p�$
p����$
p�$
p�$
p�$
p�N�7�>�>�7�8�8� 2��3�S�7�K�K�K�
2�q�!"�������!1�!1��g��
2�
2�
2�
2�
2�
2�
2�
2�
2�
2�
2����
2�
2�
2�
2��s$�GH�H�H�*J�J�Jc��d}tj�|��r3tj|dgddd���}tj|j��SdS)r~z/usr/bin/clwpos-adminraTFrbNrcr�s rbr$z CloudlinuxSummary.get_wpos_stats�
sd��
'��
�7�>�>�$��� (����z�"��#�� ���A��:�a�h�'�'�'� (� (ra)rkN)r"NrN)rQ)�rrr�r�r�r-� itertools�compressrrrr�r�r�r�r�r?rr��staticmethodr��propertyr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr
rrrrEr\r_rrrgrCrtrr
r�r>rr�r}r=r�r�r�r�r�r�r�rrrrrr-r5rNr[r�r�r�r�r�r�r�rr�rr
r�rr�rr�r�rrr8rSrWrZr&rarhrkrrnrprrrurwrOr�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�rrrr*r0r9rDrKrJrRr�r�r�r�r�r�r�r�r�r�r,r/rZr#�classmethodrIrJrG�tuplerLrrl�object�typing�NoReturnr<r�r�r�r{r|r}r7r�rr�r�r�r$r`rarbrvrv�s�������<��7��"� �"�$�$�$�,�E�,�W�-D�E�E�,�E�,�W�-B�C�C�,�E�,�W�-D�E�E�
���I�J�K�E��R�L�#�#�#��@�@��\�@�����X����3�����X���8�8��\�8��@�@��\�@�����\��
-�$�-�-�-�-�^� $� $��X� $�
�
�
�����
��
�
�
��\�
��;�;��\�;��@�S�@�S�@�@�@��\�@�: � � �5�5�5�(�$�$��\�$�@�@�@������\��L�L�L�`����\��6�
�
��\�
���t�C��H�~��$�����\��:+#�+#�+#�Z4�4�4�0�
:��
:�V�
:��
:�
:�
:��\�
:�
��V�S�[�8I�
�PV�
�ei�
�nr�
�
�
�
����:� � ��\� �D�������!��!�!�!��\�!�E�E�E�E�81
�1
�1
�1
�f����\��<����\��*���(�?�?��\�?�"
�
�
�
�B P��#�� P� P� P� P�'�x��}�'�'�'�'���h�s�m�����\��;<�;<�;<�;<�z>
�@Q�>
�VZ�>
�>
�>
�>
�@
�>O�
�TX�
�
�
�
�>X�>O�X�TX�X�X�X�X�v=�=�=�=�K@�K@�K@�K@�Z
�
�
�
4
�4
�4
�l
�
�
�*<�<�<��+�c�+�T�+�+�+��\�+�P��d�4�j�$�t�*�d�3�PS�8�n�.T�(U�P�P�P�P�B:��s�3�x��S��7I�1J�:�:�:�:�:.��.�"%�.�<@��c��N�.�
�c�5��s��#�#� $�.�.�.�.�`$!�#�$!�#�$!�$!�$!�$!�L��Y�t����G�G����\�G�,<:�<:�<:�<:�|KC�KC�KC�KC�Z� 7�� 7�QT� 7�Ya�be�Yf� 7� 7� 7��\� 7�� 5�s� 5�S� 5�U]�^a�Ub� 5� 5� 5��\� 5��\��\�#�\�\�\��\�\��
"�t�
"��
"�
"�
"��\�
"��
"�T�
"�c�
"�
"�
"��\�
"��
�D�
�W�
�
�
��\�
�"�d�"�s�"�"�"�"��
�t�
��
�
�
��\�
��
�T�
�c�
�
�
��\�
�&��&�RV�&�&�&�&��l�t�l�C�l�TX�Y\�T]�l�l�l��\�l���s��t�����\��t�t�t�t�l�!�D�!�!�!��\�!�&����2����\��
�
�
��#�#��\�#��/�/��\�/��7�7��\�7���$�����\���
"�D�
"�
"�
"��\�
"���s�����\����3�����\�� ����\��]
�]
�]
�~
�
�
�A�V�A���
�A�A�A�A�+
�+
�+
�Z���(
�(
�(
�T
�
�
�*�$�4�$�$�$��\�$�L
�
�
�@l�l�l� 0!�E�#�s�C�-�<P�0!�0!�0!�0!�d�&��c�3�h��&�&�&��\�&�@)*�)*�)*�VFC�FC�FC�PT�T�T�T�.`�`�`�`�(�(�(�(�8*�*�*�6+-�+-�+-�Z
�
�
�
�
�
�0i@�i@�i@�V����\��$*�*�*�&=���
�=�=�=�=�=�H�S�M�=�=�=�=��!�!��[�!� �!�!��\�!��'�'��\�'�$�:K�$�PT�UZ�[^�`c�[c�Ud�fi�Ui�Pj�$�$�$�$�(�!$��/��4<�U�3��8�_�4M���������#�"&��04� �����4�-����#'��+� �:@�� ����\�������3��x��~�����\���(����(�(�(��\�(��*�*��\�*�(�>�>��\�>��?�?��\�?��;�;��\�;��(�8�D�>�(�(�(��\�(��6�T�6�6�6��\�6�p�o�S�o�S�o�o�o��\�o�&�4�H�T�N�4�4�4��\�4��d�����0�1�H�T�N�1�1�1��\�1�f�(�H�T�N�(�(�(��\�(�(�(rarvc�T�t��}|j���|Sr_)r9r�
link_xml_node)r�s rbr�r��
s$��
�X�X�F�
�O�!�!�#�#�#��Mra)�r_rr�r�rpr�r�r�r�r�r�rBr:rr��collectionsrr� functoolsrrr�multiprocessingr�operatorr �pathlibr
�socketrrr
rrrrrr�cldetectlibr�rRr�r��cl_proc_hidepidr�clcommonr�clcommon.clwpos_librrr�clcommon.constr�clcommon.cpapirr�clcommon.libr�clcommon.lib.cleditionrrr�clcommon.lib.cmt_utilsr �clcommon.lib.constsr!�clcommon.sysctlr"�clcommon.utilsr#r$r%r&r'r(r)r*r+r,r-�clconfigr.r/r0� cldiaglibr1� cli_utilsr2r3�cllimitslib_v2r4r5�
clveconfigr6�clwizard.modulesr7� lve_utilsr8ry�lveapir9�vendors_api.configr:r;�clsummary.utilsr<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrL�clsummary.hardware_statisticsrMrNrO�!clsummary.rpm_packages_statisticsrP� arg_parserR�storagerS�clselect.clselectctlrT�clselect.clselectstatisticsrUrVrWrXrYrZ�clselector.selectorlibr[�
lvemanagerr\rr~�ImportError�clflagsr]r�rqr�rrPr�r�r�r�r�r�r�r�rtrvr�r`rarb�<module>r�s��������������������������� � � � �����
�
�
�
� � � � �
�
�
�
�����
�
�
�
�����
�
�
�
�,�,�,�,�,�,�,�,�(�(�(�(�(�(�(�(�������%�%�%�%�%�%�������������������L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L�L���������
�
�
�
�����:�:�:�:�:�:�����������������
#�"�"�"�"�"�I�I�I�I�I�I�I�I�&�&�&�&�&�&�����������
:�9�9�9�9�9�?�?�?�?�?�?�&�&�&�&�&�&���������������������������O�N�N�N�N�N�N�N�N�N�3�3�3�3�3�3�6�6�6�6�6�6�6�6�6�6�6�6�6�6�6�6�#�#�#�#�#�#�(�(�(�(�(�(�:�:�:�:�:�:�������=�=�=�=�=�=�=�=���������������������������������������&����������
D�C�C�C�C�C�4�4�4�4�4�4�#�#�#�#�#�#�"�8�8�8�8�8�8�����������������=�<�<�<�<�<�@�@�@�@�@�@�@�@�@�@�@�@�@���
"�
"�
"�2��2��1��-��1��1��0�� ��!��!����
"�����'�'�'�'�'�'�'���������������-��
�W�
�3�
4�
4�
���� ��
�#����
����
��U��U��U�U�U�U�l3(�l3(�l3(�l3(�l3(�l3(�l3(�l3(�^g����s$�2(F�F7�6F7�;G�G
�G
Zerion Mini Shell 1.0