HEX
Server: Apache
System: Linux insrv.serversdaddy.com 5.14.0-362.24.2.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Mar 30 14:11:54 EDT 2024 x86_64
User: jsaha (1066)
PHP: 8.3.6
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3.9/site-packages/sos/report/plugins/__pycache__/ceph_mon.cpython-39.pyc
a

^��c��@s4ddlZddlmZmZmZGdd�deee�ZdS)�N)�Plugin�RedHatPlugin�UbuntuPluginc@sHeZdZdZdZdZdZdZdZdZ	dd	�Z
d
d�Zdd
�Zdd�Z
dS)�CephMONag
    This plugin serves to collect information on monitor nodes within a Ceph
    cluster. It is designed to collect from several versions of Ceph, including
    those 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 monZceph_mon)ZstorageZvirt�	container)zceph-(.*-)?mon.*)z/var/lib/ceph/mon/z/var/lib/ceph/*/mon*rcCs|��|_|�ddd��|�gd��|�gd��|jddd�|�gd	��|�d
�}|ddkr�|d
��D]*}|�d�rt|�	�d}|�d|���qtgd�}|jdddd�|jdddd�|jdd�|�
�D�dd�|�dd�|D��|jdd�|D�dd�dS)NZ	ceph_confZ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*.logzceph reportZceph_report)�tags)z
ceph mon statzceph quorum_statuszceph-disk listz
ceph versionsz
ceph featuresz
ceph insightszceph crash statzceph 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 dumpr	z	device lsZdfz	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-prettyZjson_outputZceph_health_detail)�subdirrz"ceph osd tree --format json-prettyZ
ceph_osd_treecSsg|]}d|�d��qS)zceph tell mon.z mon_status�)�.0Zmidr
r
�?/usr/lib/python3.9/site-packages/sos/report/plugins/ceph_mon.py�
<listcomp>��z!CephMON.setup.<locals>.<listcomp>)rcSsg|]}d|���qS)�ceph r
�r�cmdr
r
rr�rcSsg|]}d|�d��qS)rz --format json-prettyr
rr
r
rr�r)�get_ceph_version�ceph_versionZ
add_file_tagsZadd_forbidden_pathZ
add_copy_specZadd_cmd_outputZcollect_cmd_output�
splitlines�endswith�split�get_ceph_ids)�selfZcrashesZcrashlnZcidZ	ceph_cmdsr
r
r�setup+sB
�	

����z
CephMON.setupc
Cs~|�d�}|ddkrpz$|d��d}t|�d�d�WStyn}z|�d|���WYd}~n
d}~00|�d�dS)	Nzceph --versionr	rr
��.z"Could not determine ceph version: z?Failed to find ceph version, command collection will be limited)�exec_cmdr�int�	Exception�
_log_debugZ
_log_error)rZverZ_ver�errr
r
rr�s
&�zCephMON.get_ceph_versionc	
Cs*g}|jdks|jdkr�|�d�}|ddkr�|d��D]`}|��}|r:|d�d�r:z |�d�}|�||d	�Wq:ttfy�|�	d
�Yq:0q:n�|jdk�r&|�d�}|ddk�r&z,t
�d
|d�}|�|�
�d	�d��Wn6t�y$}z|�d|���WYd}~n
d}~00|S)N��zps -u ceph -o argsr	rr
zceph-monz--id�zUnable to find ceph IDs�zceph statusz!(\s*mon: .* quorum) (.*) (\(.*\))�,zid determination failed: )rrrrr�index�append�
IndexError�
ValueErrorZ	_log_warn�re�search�extend�groupsr!r")	rZceph_ids�outZprocs�procZid_indexZstats�retr#r
r
rr�s.


�&zCephMON.get_ceph_idscCsn|jdkr8gd�}|D]}d|�d�}|�d|d�qn(gd�}dd	�|��d
�}|�d|d�|�d�dS)Nr')�key�username�password�_secret�rbd/mirror/peer/.*z(((.*)(z\\\": ))((\\\"(.*?)\\\")(.*)))rz\2\"******\"\8)ZAPI_PASSWORDz
API_USER.*z
API_.*_KEYr4r7r8z((\".*(�|z)\":) \")(.*)(\".*)z\1*******\5)rZdo_cmd_output_sub�joinZdo_cmd_private_sub)r�keysr4Zcregr
r
r�postproc�s

�	�zCephMON.postprocN)�__name__�
__module__�__qualname__�__doc__Z
short_descZplugin_nameZprofilesZ
containers�filesrrrrr<r
r
r
rrsf
r)r-Zsos.report.pluginsrrrrr
r
r
r�<module>	s