a Ö>ïh³ã@s4ddlZddlmZmZmZGdd„deeeƒZdS)éN)ÚPluginÚ RedHatPluginÚ UbuntuPluginc@s4eZdZdZdZdZdZdZdZdd„Z d d „Z d S) Ú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_mgr)ZstorageZvirtÚ containerZceph)z/var/lib/ceph/mgr/*z/var/lib/ceph/*/mgr*z%/var/snap/microceph/common/data/mgr/*)zceph-(.*-)?mgr.*cs*| d¡}|jj d¡}gd¢}| d¡}|ddkrB|gd¢7}gd¢‰d }|s d }| d d i¡| gd ¢¡|s„| dg¡n | dg¡| gd¢¡n•óz!CephMGR.setup..cSsg|]}d|›d‘qS)r z --format json-prettyr r r r rr™rZ json_output)Zsubdircs&g|]}ˆD]}d|›d|›‘q qS)z ceph daemon ú r )rÚmr©Zcmdsr rrsÿ) 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 rrÚsetup-s^    ÿ ÿÿþÿÿÿ ÿ þÿz CephMGR.setupcCsNg}t |¡D]:\}}}|D]*}| d¡r| d¡r| | ||¡¡qq|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)ÚosÚwalkÚ startswithÚendswithÚappendZ path_join)rrZ ceph_socketsZrdirÚ_ÚfilesÚfiler r rr¢s zCephMGR.get_socksN) Ú__name__Ú __module__Ú __qualname__Ú__doc__Z short_descZ plugin_nameZprofilesr Z containersrrr r r rrsur)rZsos.report.pluginsrrrrr r r rÚ s