Sindbad~EG File Manager

Current Path : /lib/python3.6/site-packages/sos/report/plugins/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/sos/report/plugins/__pycache__/process.cpython-36.pyc

3

�f�@s:ddlZddlZddlmZmZmZGdd�dee�ZdS)�N)�Plugin�IndependentPlugin�	PluginOptc
@sleZdZdZdZdZedddd�edd	d
d�edd	dd�ed
dedd�eddedd�gZdd�Z	dd�Z
dS)�Processzprocess informationZprocess�system�lsofTzcollect info on all open files)�default�desczlsof-threadsFz,collect threads' open file info if supported�smapszcollect /proc/*/smaps files�samples�z"number of iotop samples to collect)rZval_typer	�numprocsiz*number of process to collect /proc data ofcCsdd}d}d}|d7}|jddg�dd�|jd	�D�}|jd
�rR|d|jd
��}x4|D],}|jd|d|d
|d|d|g�qXW|jd�r�|jd�|jdddddddgdd�|jddd�|jd�r�|jddd d!dd"�|jd#�r�|jd$d d!d%�|jd&d'gd(d)�|jd*||fd*||fg�|jd+��rR|jd,|jd+�d-d.�|jd/d0g�dS)1Nzps axoz3pid,ppid,user,group,lwp,nlwp,start_time,comm,cgroupz3flags,state,uid,pid,ppid,pgid,sid,cls,pri,psr,addr,zsz,wchan:20,lstart,tty,time,cmdz/proc/sched_debugz
/proc/statcSsg|]}tjd|�r|�qS)z[0-9])�re�match)�.0�p�r�/usr/lib/python3.6/process.py�
<listcomp>-sz!Process.setup.<locals>.<listcomp>z/procr
z/proc/%s/statusz/proc/%s/cpusetz/proc/%s/oom_*z/proc/%s/stackz/proc/%s/limitsr
z/proc/[0-9]*/smapsz
ps auxwwwmZpsZps_auxZps_auxwwZ	ps_auxwwwZ
ps_auxwwwmZ	ps_auxcww�)�root_symlink�tags�priorityz
pstree -lpZpstree)rrzlsof +M -n -l -c ''��2)r�timeoutrrzlsof-threadsz
lsof +M -n -l)rrz	ps alxwwwzps -elfLT)Z
cmd_as_tagz%s %srziotop -b -o -d 0.5 -t -n %s�d)rz#pidstat -p ALL -rudvwsRU --human -hzpidstat -tl)Z
add_copy_spec�listdirZ
get_optionZadd_cmd_output)�selfZps_axoZ
ps_group_optsZ
ps_sched_optsZprocs�procrrr�setup!sT






z
Process.setupcCs�|jd���}|jjjs$|jd�dS|jd�}i}i}|ddksZ|jd|d���dSxh|dj�D]X}|j�j�}|d}|d}|j	|�s�qh||kr�|jjj
|�||<|||d	�||<qhW|jtj|dd
��WdQRXdS)Nzpids_to_packages.jsonz/Package manager not configured for path querieszps --no-headers aexZstatusrzUnable to get process list: �output�)�path�package)�indent)
Zcollection_fileZpolicyZpackage_managerZquery_path_command�writeZexec_cmd�
splitlines�strip�splitZpath_existsZpkg_by_path�json�dumps)rZpfileZ_psZpidpkg�pathsr�pidr#rrr�collect]s(



zProcess.collectN)r)�__name__�
__module__�__qualname__Z
short_descZplugin_nameZprofilesr�intZoption_listr r.rrrrrs
<r)r*rZsos.report.pluginsrrrrrrrr�<module>	s

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists