← Back
Editing: ceph_mon.cpython-38.pyc
U O6uf�% � @ s4 d dl Z d dlmZmZmZ G dd� deee�ZdS )� N)�Plugin�RedHatPlugin�UbuntuPluginc @ sH e Zd ZdZdZdZdZdZdZdZ dd � Z d d� Zdd � Zdd� 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 monZceph_mon)ZstorageZvirtZ containerZceph)zceph-(.*-)?mon.*)z/var/lib/ceph/mon/*z/var/lib/ceph/*/mon*�%/var/snap/microceph/common/data/mon/*r c C s� | � d�}| �� | _| jj�d�}|sv| �ddd�� | �dddd g� |sZ| �d g� n| �dg� | �dd g� n>| �ddddg� |s�| �dg� n| �dg� | �ddg� | j ddd� | � dddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0g� | � d1�}|d2 d3k�rP|d4 �� D ].}|�d5��r |� � d3 }| � d6|� �� �q d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHd2dIg}| j dJdKdLdM� | j dNdKdOdM� | j dPdQ� | �� D �dKdR� | � dSdQ� |D �� | j dTdQ� |D �dKdR� d S )UN�all_logsZ microcephZ ceph_confZceph_mon_log)z.*/ceph.confz$/var/log/ceph/(.*/)?ceph-.*mon.*.logz/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_backendz'/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*r z"/var/snap/microceph/current/conf/*zceph reportZceph_report)�tagszceph config dumpz!ceph config generate-minimal-confzceph config log�ceph config-key dumpzceph 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 osd crush dumpzceph osd crush show-tunablesz!ceph osd crush tree --show-shadowz ceph osd erasure-code-profile lszceph osd metadatazceph quorum_statusz ceph versionszceph-disk listz ceph crash ls�statusr �output�*zceph crash info z device lsz df detailZdfzfs dumpzfs lszmds statzmon dumpzosd blocked-byzosd df treezosd dfzosd dumpzosd numa-statuszosd perfzosd pool autoscale-statuszosd pool ls detailzosd statzpg dumpzpg statztime-sync-statusz'ceph health detail --format json-prettyZjson_outputZceph_health_detail)�subdirr z"ceph osd tree --format json-prettyZ ceph_osd_treec S s g | ]}d |� d��qS )zceph tell mon.z mon_status� )�.0Zmidr r �=/usr/lib/python3/dist-packages/sos/report/plugins/ceph_mon.py� <listcomp>� s z!CephMON.setup.<locals>.<listcomp>)r c S s g | ]}d |� ��qS )�ceph r �r �cmdr r r r � s c S s g | ]}d |� d��qS )r z --format json-prettyr r r r r r � s )Z get_option�get_ceph_version�ceph_versionZpolicyZpackage_managerZpkg_by_nameZ add_file_tagsZadd_forbidden_pathZ add_copy_specZadd_cmd_outputZcollect_cmd_output� splitlines�endswith�split�get_ceph_ids)�selfr Z microceph_pkgZcrashesZcrashlnZcidZ ceph_cmdsr r r �setup, s� �� �������� �����z CephMON.setupc C s| | � d�}|d dkrnz$|d �� d }t|�d�d �W S tk rl } z| �d|� �� W 5 d}~X Y nX | �d � dS ) z% Get the versions of running daemons zceph --versionr r r � �.z"Could not determine ceph version: Nz?Failed to find ceph version, command collection will be limited)�exec_cmdr �int� Exception� _log_debugZ _log_error)r ZverZ_ver�errr r r r � s "�zCephMON.get_ceph_versionc C s g }| j dkr�| �d�}|d dkr�|d �� D ]b}|�� }|r0|d �d�r0z |�d�}|�||d � W q0 ttfk r� | � d � Y q0X q0n�| j d k�r| �d�}|d dk�rz,t �d|d �}|�|� � d �d �� W n4 tk �r } z| �d|� �� W 5 d}~X Y nX |S )z! Get the IDs of the Ceph daemons )� � zps -u ceph -o argsr r r zceph-monz--id� zUnable to find ceph IDs� zceph statusz!(\s*mon: .* quorum) (.*) (\(.*\))�,zid determination failed: N)r r r r r �index�append� IndexError� ValueErrorZ _log_warn�re�search�extend�groupsr! r"