
    -_g                     :    d dl Z d dlmZmZmZ  G d deee      Zy)    N)PluginRedHatPluginUbuntuPluginc                   0    e Zd ZdZdZdZdZdZdZd Z	d Z
y	)
CephOSDa  
    This plugin is for capturing information from Ceph OSD nodes. While the
    majority of this plugin should be version agnostic, several collections are
    dependent upon the version of Ceph installed. Versions that correlate to
    RHCS 4 or RHCS 5 are explicitly handled for differences such as those
    pertaining to log locations on the host filesystem.

    Note that while this plugin will activate based on the presence of Ceph
    containers, commands are run directly on the host as those containers are
    often not configured to successfully run the `ceph` commands collected by
    this plugin. These commands are majorly `ceph daemon` commands that will
    reference discovered admin sockets under /var/run/ceph.
    zCEPH osdceph_osd)storagevirt	containerceph)zceph-(.*-)?osd.*)z/var/lib/ceph/osd/*z/var/lib/ceph/*/osd*%/var/snap/microceph/common/data/osd/*c                 F   | j                  d      }d}| j                  j                  j                  d      }g d}|sdd}| j	                  ddi       | j                  g d       | j                  g d	       | j                  d
dg       |rP| j                  ddg       n<d}| j                  g d       | j                  ddg       |r| j                  dg       | j                  | j                  |      D cg c]  }|D ]
  }d| d|   c}}       y c c}}w )Nall_logs 	microceph) zbluestore bluefs availabledump_reservationszbluefs statszbluestore allocator dump blockzbluestore bluefs device infozconfig diffzconfig showzcounter dumpzcounter schemadump_blocked_opsdump_blocklistdump_historic_ops_by_durationdump_historic_slow_opsdump_mempoolsdump_op_pq_statedump_ops_in_flightdump_osd_networkdump_pgstate_historydump_recovery_reservationsdump_scrubsdump_watchersget_mapped_poolslist_deviceslist_unfoundzlog dumpobjecter_requestsopsz	perf dumpzperf histogram dumpzperf schemastatusversionz/var/run/cephz(/var/log/ceph/(.*/)?ceph-(.*-)?osd.*.logceph_osd_log)z/etc/ceph/*keyring*z/var/lib/ceph/**/*keyring*z/var/lib/ceph/**/tmp/*mnt*z/etc/ceph/*bindpass*)z/run/ceph/**/ceph-osd*z/var/lib/ceph/**/kv_backendz/var/log/ceph/**/ceph-osd*.logz!/var/log/ceph/**/ceph-volume*.logzceph-disk listzceph-volume lvm listz/var/log/ceph/**/ceph-osd*.log*z"/var/log/ceph/**/ceph-volume*.log*z/var/snap/microceph/current/run)z'/var/snap/microceph/common/**/*keyring*z(/var/snap/microceph/current/**/*keyring*z"/var/snap/microceph/common/state/*r   z./var/snap/microceph/common/logs/*ceph-osd*.logz//var/snap/microceph/common/logs/*ceph-osd*.log*zceph daemon  )	
get_optionpolicypackage_managerpkg_by_nameadd_file_tagsadd_forbidden_pathadd_copy_specadd_cmd_output	get_socks)selfr   	directorymicroceph_pkgcmdsics          =/usr/lib/python3/dist-packages/sos/report/plugins/ceph_osd.pysetupzCephOSD.setup'   s`   ??:.	33??L#
J 'I:N   ## %       &! 
 ""58$  :I## %  7@  
 ""E$ 
 	NN9%5'(/35*+ 1#Qqc"5"5 	
 5s   >D
c                     g }t        j                  |      D ]E  \  }}}|D ]:  }|j                  d      sd|v s|j                  | j	                  ||             < G |S )z
        Find any available admin sockets under /var/run/ceph (or subdirs for
        later versions of Ceph) which can be used for ceph daemon commands
        z.asokosd)oswalkendswithappend	path_join)r1   r2   ceph_socketsrdir_filesfiles          r7   r0   zCephOSD.get_socks   sm    
  ggi0 	DND!U D==)etm ''tT(BCD	D     N)__name__
__module____qualname____doc__
short_descplugin_nameprofiles
containersrC   r8   r0    rE   r7   r   r      s0     JK7H&J6Eb
H
rE   r   )r;   sos.report.pluginsr   r   r   r   rN   rE   r7   <module>rP      s"    
 A AEflL ErE   