id{@ddlZddlZddlmZmZmZGddeeZy)N)PluginIndependentPlugin PluginOptc eZdZdZdZdZedddedd d ed d d ed dededdedgZdZ dZ y)Processzprocess informationprocess)systemlsofTzcollect info on all open files)defaultdesc lsof-threadsFz,collect threads' open file info if supportedsmapszcollect /proc/*/smaps filessamplesz"number of iotop samples to collect)r val_typer numprocsiz*number of process to collect /proc data ofc |d}d}d}|dz }|jddg|jdDcgc]}tjd|s|}}|j d r|d|j d }|D]'}|jd |zd |zd |zd |zd|zg)|j dr|jd|j ddgdd|j dd|j dr|j ddddd|j dr|j ddd |j d!d"gd#$|j |d%||d%|g|j d&r%|j d'|j d&zd()|j d*d+gycc}w),Nzps axoz3pid,ppid,user,group,lwp,nlwp,start_time,comm,cgroupz2flags,state,uid,pid,ppid,pgid,sid,cls,pri,addr,sz,zwchan:20,lstart,tty,time,cmdz/proc/sched_debugz /proc/statz/procz[0-9]rz/proc/%s/statusz/proc/%s/cpusetz/proc/%s/oom_*z/proc/%s/stackz/proc/%s/limitsrz/proc/[0-9]*/smapsz ps auxwwwmps)ps_auxps_auxww ps_auxwww ps_auxwwwm ps_auxcww) root_symlinktagspriorityz pstree -lppstree)rr zlsof +M -n -l -c ''2)rtimeoutrrr z lsof +M -n -l)r!rz ps alxwwwzps -elfLT) cmd_as_tag rziotop -b -o -d 0.5 -t -n %sd)rz#pidstat -p ALL -rudvwsRU --human -hz pidstat -tl) add_copy_speclistdirrematch get_optionadd_cmd_output)selfps_axo ps_group_opts ps_sched_optspprocsprocs *   b  I       } -} -  ??9 %    ="&//)"<!=GJ  L  1   WKs F9F9c|jd5}|jjjs|j d dddy|j d}i}i}|ddk(s!|j d|d dddy|dj D]s}|jj}|d}|d}|j|s=||vr(|jjj|||<|||d ||<u|j tj|d dddy#1swYyxYw) Nzpids_to_packages.jsonz/Package manager not configured for path querieszps --no-headers aexstatusrzUnable to get process list: output)pathpackage)indent) collection_filepolicypackage_managerquery_path_commandwriteexec_cmd splitlinesstripsplit path_exists pkg_by_pathjsondumps)r+pfile_pspidpkgpathsr1pidr8s r2collectzProcess.collect]sI  ! !"9 : 6e;;..AA MN 6 6-- 56CFEx=A% :3x=/JK 6 6H 002 Ezz|))+1gAw''-u$"&++"="="I"I$"OE$K'+d Ds  E KK 6!4 5) 6 6 6s3E5E B/EE N) __name__ __module__ __qualname__ short_desc plugin_nameprofilesrint option_listr3rMr2rrsr&JKH &$-MN.%F H'5/LM)R#; =*dSC E K: x6rWr)rFr'sos.report.pluginsrrrrrVrWr2rYs$ CCc6f'c6rW