%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/sos/report/plugins/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/sos/report/plugins/__pycache__/ceph_mon.cpython-312.pyc

�

i��d�"��:�ddlZddlmZmZmZGd�deee�Zy)�N)�Plugin�RedHatPlugin�UbuntuPluginc�@�eZdZdZdZdZdZdZdZdZ	d�Z
d	�Zd
�Zd�Z
y)
�CephMONan
    This plugin serves to collect information on monitor nodes within a Ceph
    or microceph cluster. It is designed to collect from several versions of
    Ceph, including versions that serve as the basis for RHCS 4 and RHCS 5.

    Older versions of Ceph will have collections from locations such as
    /var/log/ceph, whereas newer versions (as of this plugin's latest update)
    will have collections from /var/log/ceph/<fsid>/. This plugin attempts to
    account for this where possible across the host's filesystem.

    Users may expect to see several collections twice - once in standard output
    from the `ceph` command, and again in JSON format. The latter of which will
    be placed in the `json_output/` subdirectory within this plugin's directory
    in the report archive. These JSON formatted collections are intended to
    aid in automated analysis.
    zCEPH mon�ceph_mon)�storage�virt�	container�ceph)zceph-(.*-)?mon.*)z/var/lib/ceph/mon/*z/var/lib/ceph/*/mon*�%/var/snap/microceph/common/data/mon/*rc���|j�|_|jjj	d�}|s;|jddd��|j
gd��|jgd��n&|j
gd��|jgd��|jd	d
��|jgd��|jd
�}|ddk(rQ|dj�D];}|jd�s�|j�d}|jd|����=gd�}|jddd��|jddd��|j|j�D�cgc]}d|�d���
c}d��|j|D�cgc]}d|����	c}�|j|D�cgc]}d|�d���
c}d��ycc}wcc}wcc}w)N�	microceph�	ceph_conf�ceph_mon_log)z.*/ceph.confz$/var/log/ceph/(.*/)?ceph-.*mon.*.log)z/etc/ceph/*keyring*z/var/lib/ceph/**/*keyring*z/var/lib/ceph/**/tmp/*mnt*z/etc/ceph/*bindpass*)z/run/ceph/**/ceph-mon*z/var/lib/ceph/**/kv_backendz/var/log/ceph/**/*ceph-mon*.log)z'/var/snap/microceph/common/**/*keyring*z(/var/snap/microceph/current/**/*keyring*z./var/snap/microceph/common/data/mon/*/store.dbz"/var/snap/microceph/common/state/*)r
z./var/snap/microceph/common/logs/*ceph-mon*.logz"/var/snap/microceph/current/conf/*zceph report�ceph_report)�tags)z
ceph mon statzceph quorum_statuszceph-disk listz
ceph versionsz
ceph featuresz
ceph insightszceph crash statzceph config dumpzceph config logz!ceph config generate-minimal-conf�ceph config-key dumpzceph osd metadataz ceph osd erasure-code-profile lszceph osd crush dumpzceph osd crush show-tunablesz!ceph osd crush tree --show-shadowz
ceph mgr dumpzceph mgr metadatazceph mgr module lszceph mgr serviceszceph mgr versionsz!ceph log last 10000 debug clusterzceph log last 10000 debug auditz
ceph crash ls�statusr�output�*zceph crash info )zmon dumprz	device ls�dfz	df detailzfs lszfs dumpzpg dumpzpg statztime-sync-statuszosd statzosd df treezosd dumpzosd dfzosd perfzosd blocked-byzosd pool ls detailzosd pool autoscale-statuszmds statzosd numa-statusz'ceph health detail --format json-pretty�json_output�ceph_health_detail)�subdirrz"ceph osd tree --format json-pretty�
ceph_osd_treezceph tell mon.z mon_status)rzceph z --format json-pretty)�get_ceph_version�ceph_version�policy�package_manager�pkg_by_name�
add_file_tags�add_forbidden_path�
add_copy_spec�add_cmd_output�collect_cmd_output�
splitlines�endswith�split�get_ceph_ids)�self�
microceph_pkg�crashes�crashln�cid�	ceph_cmds�mid�cmds        �=/usr/lib/python3/dist-packages/sos/report/plugins/ceph_mon.py�setupz
CephMON.setup,s�� �1�1�3������3�3�?�?��L�
����� +�8F� �
�

�#�#�%�
�
��� �
�
�#�#�%�
�
��� �
�	
���M�
��>����
�	�:�)�)�/�:���8���!�"�8�,�7�7�9�
B���#�#�C�(�!�-�-�/�!�,�C��'�'�*:�3�%�(@�A�
B�

�	�.	
���E�#0�!5�	�	7�	
���@�#0�!0�	�	2�	
���:>�:K�:K�:M�N�3�~�c�U�+�
.�N� �	�	
�
	
���i�@�s�u�S�E�]�@�A�	
���;D�E�C�u�S�E�.�
/�E� �	�	
��
O��A��
Fs�7
G�G�>
Gc��|jd�}|ddk(r4	|dj�d}t|jd�d�S|jd�y#t$r}|j	d|���Yd}~�4d}~wwxYw)	Nzceph --versionrrr��.z"Could not determine ceph version: z?Failed to find ceph version, command collection will be limited)�exec_cmdr)�int�	Exception�
_log_debug�
_log_error)r+�ver�_ver�errs    r3rzCephMON.get_ceph_version�s����m�m�,�-���x�=�A��
L��8�}�*�*�,�Q�/���4�:�:�c�?�1�-�.�.�	
���M�	
����
L����"D�S�E� J�K�K��
L�s�2A � 	B�)B�Bc���g}|jdk(s|jdk(r�|jd�}|ddk(ri|dj�D]S}|j�}|s�|dj	d�s�+	|jd�}|j
||d	z��U|S|jdk\rf|jd�}|ddk(rM	tjd
|d�}|j|j�d	jd��|S|S#ttf$r|jd
�Y��wxYw#t$r}|jd|���Yd}~|Sd}~wwxYw)N��zps -u ceph -o argsrrrzceph-monz--id�zUnable to find ceph IDs�zceph statusz!(\s*mon: .* quorum) (.*) (\(.*\))�,zid determination failed: )rr8r'r)r(�index�append�
IndexError�
ValueError�	_log_warn�re�search�extend�groupsr:r;)	r+�ceph_ids�out�procs�proc�id_index�stats�retr?s	         r3r*zCephMON.get_ceph_ids�sr��������"�d�&7�&7�2�&=��-�-� 4�5�C��8�}��!� ��]�5�5�7�F�E� �;�;�=�D���Q�� 0� 0�� <�F�'+�z�z�&�'9�H�$�O�O�D��A��,>�?�
F�(���
�
�"�
$��M�M�-�0�E��X��!�#�G��)�)�$H�$)�(�O�5�C��O�O�C�J�J�L��O�$9�$9�#�$>�?���x���!+�J�7�F� �N�N�+D�E�F��!�G��O�O�&?��u�$E�F�F����G�s+�9(D�A
E� D?�>D?�	E*�E%�%E*c���|jdk\r%gd�}|D]}d|�d�}|jd|d��n,gd�}dd	j|��d
�}|jd|d�|jd�y)NrD)�key�username�password�_secret�rbd/mirror/peer/.*z(((.*)(z\\\": ))((\\\"(.*?)\\\")(.*)))rz\2\"******\"\8)�API_PASSWORDz
API_USER.*z
API_.*_KEYrWrZr[z((\".*(�|z)\":) \")(.*)(\".*)z\1*******\5)r�do_cmd_output_sub�join�do_cmd_private_sub)r+�keysrW�cregs    r3�postproczCephMON.postproc�s�������"��D��
��!�#��&D�E���&�&�.��6G��
��D��c�h�h�t�n�-�-@�A�D��"�"�*�D�.�
�	
��� 6�7�N)�__name__�
__module__�__qualname__�__doc__�
short_desc�plugin_name�profiles�
containers�filesrr4rr*rc�rdr3rrsA���"�J��K�7�H�'�J�
6�E��L�u
�n��>!8rdr)rK�sos.report.pluginsrrrrrnrdr3�<module>rps"��
�A�A�b8�f�l�L�b8rd

Zerion Mini Shell 1.0