�
u��ec@sdddlmZmZmZddlZddlZddlmZdeeefd��YZdS(i����(tPlugintRedHatPlugintDebianPluginN(tgethostnametPcpcBseeZdZdZdZdZdZddgZdZ dZ
dZdZd�Z
d
�Zd�ZRS(sPerformance Co-Pilot data
tpcptsystemtperformances
/etc/pcp.conft pmmgrlogsssize-limit in MB of pmmgr logstidt
pmloggerfiless'number of newest pmlogger files to grabicCsid}x\tj|�D]K\}}}x9|D]1}tjj||�}|tjj|�7}q,WqW|S(Ni(tostwalktpathtjointgetsize(tselfR
t
total_sizetdirpathtdirnamest filenamestftfp((s3/usr/lib/python2.7/site-packages/sos/plugins/pcp.pytget_size's
cCs�y,t|jd�}|j�}|j�Wntk
r@tSXi}xf|D]^}|jd�riqNny)|j�jd�\}}|||<WqNt t
fk
r�qNXqNWy+|d|_|d|_|d|_
Wntk
r�tSXtS(Ntrt#t=tPCP_SYSCONF_DIRtPCP_VAR_DIRtPCP_LOG_DIR(topentpcp_conffilet readlinestclosetIOErrortFalset
startswithtstriptsplitt
ValueErrortKeyErrortpcp_sysconf_dirtpcp_var_dirtpcp_log_dirt ExceptiontTrue(Rtpcpconftlinestenv_varstlinetkeytvalue((s3/usr/lib/python2.7/site-packages/sos/plugins/pcp.pytpcp_parse_conffile/s,
c Cs�|jd�rdn|jd�|_|jd�r<dn|jd�|_|j�sr|jd|j�dStjj |j
d�}|j|j|j|g�|j
tjj |d�tjj |d�tjj |d�tjj |d �g�t�|_|jd
kr�tjj |jd|jd�}|j|d
|jdt�d}tjj |jd|jd�}|jd|�}|ddkr�xT|dj�D]?}|j|d
d�|d}|jr�||jkr�Pq�q�Wq�n|jtjj |jd�tjj |jd�tjj |j
d�tjj |jd�tjj |jd�tjj |jd�g�|jd�}|ddkr�xU|dj�D]@}|jd�r�|j�d}|jd|dd �Pq�q�WndS(!Ntall_logsRR
scould not parse %stconfigtpmchartt pmlogconftpmieconftpmlogrewriteR tpmmgrt*t sizelimitttailititpmloggers ls -t1 %ststatustoutputitpmcdsNOTICES*tpmnss*/*.log*s
*/*/*.log*s*/*/config*Rs
pmlogger:i����s'pmstat -S 00:00 -T 23:59 -t 5m -x -a %stroot_symlinktpmstat(t
get_optiontNoneR=t
countlimitR4t _log_warnRRR
RR*t
add_copy_specR)tadd_forbidden_pathRtpcp_hostnameR+R#texec_cmdt
splitlinestcollect_cmd_outputR$R&tadd_cmd_output(Rtvar_conf_dirR
tfiles_collectedtpmlogger_lsR1trestarc((s3/usr/lib/python2.7/site-packages/sos/plugins/pcp.pytsetupJs`
(ssystemR(spcp(s pmmgrlogsssize-limit in MB of pmmgr logsR id(s
pmloggerfiless'number of newest pmlogger files to grabR iN(t__name__t
__module__t__doc__tplugin_nametprofilestpackagesRtoption_listRGR)R*R+RLRR4RV(((s3/usr/lib/python2.7/site-packages/sos/plugins/pcp.pyRs ( tsos.pluginsRRRRtos.pathtsocketRR(((s3/usr/lib/python2.7/site-packages/sos/plugins/pcp.pyt<module>s |