3 ܓi@s4ddlZddlmZmZmZGdddeeeZdS)N)Plugin RedHatPlugin UbuntuPluginc@s4eZdZdZdZdZdZdZdZd d Z ddZ dS)CephMGRa? This plugin is for capturing information from Ceph mgr 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 majorily `ceph daemon` commands that will reference discovered admin sockets under /var/run/ceph. 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 mgrZceph_mgrstoragevirt containerceph/var/lib/ceph/mgr/*/var/lib/ceph/*/mgr*%/var/snap/microceph/common/data/mgr/*ceph-(.*-)?mgr.*csn|jd}|jjjd}ddddddd d d d d g }|jd}|ddkr^|dddddddg7}ddddddddd d!d"d#d$d%dd&gd'}|sd(}|jd)d*i|jd+d,d-d.d/d0g|s|jd1gn |jd2g|jd3d4d5gn>d6}|jd7d*i|jd8g|s|jd9gn |jd:g|jd;d<|D|jd=d<|Dd>d?|jfd@d<|j |DdS)ANall_logsZ microcephz balancer evalzbalancer statuszbalancer status detailzhealthcheck history lszlog last cephadmzmgr dumpz mgr metadataz mgr module lsz mgr serviceszmgr statz mgr versionszceph orch statusZstatusrz orch host lszorch device lszorch lszorch ls --exportzorch pszorch status --detailzorch upgrade statusz config diffz config showz counter dumpzcounter schemaZ dump_cacheZ dump_mempoolsZdump_osd_networkZ mds_requestsZ mds_sessionsZobjecter_requestsz perf dumpzperf histogram dumpzperf histogram schemaz perf schemaversionz /var/run/cephz"/var/log/ceph/(.*/)?ceph-mgr.*.logZ ceph_mgr_logz/etc/ceph/*keyring*z/var/lib/ceph/**/*keyring*z/var/lib/ceph/**/osd*z/var/lib/ceph/**/mon*z/var/lib/ceph/**/tmp/*mnt*z/etc/ceph/*bindpass*z/var/log/ceph/**/ceph-mgr*.logz/var/log/ceph/**/ceph-mgr*.log*z/var/lib/ceph/**/mgr*z/var/lib/ceph/**/bootstrap-mgr/z/run/ceph/**/ceph-mgr*z/var/snap/microceph/current/runz./var/snap/microceph/common/logs/ceph-mgr.*.logz'/var/snap/microceph/common/**/*keyring*z-/var/snap/microceph/common/logs/ceph-mgr*.logz./var/snap/microceph/common/logs/ceph-mgr*.log*cSsg|]}d|qS)zceph ).0cmdrr/usr/lib/python3.6/ceph_mgr.py sz!CephMGR.setup..cSsg|]}d|dqS)zceph z --format json-prettyr)rrrrrrsZ json_output)Zsubdircs&g|]}D]}d|d|q qS)z ceph daemon  r)rmr)cmdsrrrs) Z get_optionZpolicyZpackage_managerZ pkg_by_nameZexec_cmdZ add_file_tagsZadd_forbidden_pathZ add_copy_specZadd_cmd_output get_socks)selfrZ microceph_pkgZ ceph_mgr_cmdsZorch_configured directoryr)rrsetup-s        z CephMGR.setupcCsVg}xLtj|D]>\}}}x2|D]*}|jdr |jdr |j|j||q WqW|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 zceph-mgrz.asok)oswalk startswithendswithappendZ path_join)rrZ ceph_socketsZrdir_filesfilerrrrs  zCephMGR.get_socksN)rrrr )r r r )r ) __name__ __module__ __qualname____doc__Z short_descZ plugin_nameZprofilesr#Z containersrrrrrrrsur)rZsos.report.pluginsrrrrrrrr s