+
    i  c                   s    ^ RI H t ^ RIt^ RIt^ RIHtHtHtHtH	t	  ! R R]4      t
 ! R R]
]4      t ! R R	]
]]4      tR# )
i    )datetimeN)PluginRedHatPluginDebianPluginUbuntuPlugin	PluginOptc                   s\   a  ] tR t^t o RtRtRtRtRtRt	]
! RRRR7      .tR	 tR
 tRtV tR# )Sara  
The sar plugin is designed to collect system performance data as recorded
by sysstat.

The raw binary data, i.e. the 'saX' files, will be collected and for files
a week old or younger, this plugin will capture human-readable conversions
of those files provided by the 'sar' command locally available, if the
local sysstat installation has not already created a converted copy (e.g.
for the current day-of data being collected at the time of report
generation).

Using the 'all-sar' plugin option will not only cause the plugin to capture
_all_ 'saX' files present on the host, but further perform the 'sar'
conversion on all files, not just those produced within the last week.

Converted 'sar' files will be written to the sos_commands/sar/, and not
to the /var/log/ path that sysstat writes to.

Note that this conversion is done because it is unlikely that the same
version of sysstat that produces the 'saX' files will be the same version
available on a given analyst's workstation, and this conversion is version
sensitive.
zSystem Activity Reportersar/var/log/saall-sarFz"gather all system activity records)ZdefaultZdescc                s   T P                  V P                  V P                  R 4      V P                  R4      '       d   ^ MRRR7        V P	                  V P                  4      p\        P                  ! R4      pT F  pTP                  T4      '       g   K  T P                  T P                  T4      pRTR,          ,           pYQ9  dG   T P                  R4      '       g   T P                  T4      '       d   K~  R	T 2pT P                  Ye4       R
T 2pT P                  Ys R24       K  	  R#   \
         d#    T P                  RT P                   24        R# i ; i)Z*r	   NF)Z	sizelimitZtailitzsar: could not list zsa[\d]+r   :i   NNz
sar -A -f zsadf -x -- -A z.xml)Zadd_copy_specZ	path_joinsa_pathZ
get_optionZlistdirZOSError	_log_warnreZcompileZmatchis_older_than_7daysZadd_cmd_output)selfZdir_listZsa_regexZfnameZsa_data_pathZsar_filenameZsar_cmdZsadf_cmds   &       ;/usr/lib/python3.14/site-packages/sos/report/plugins/sar.pysetupZ	Sar.setup5   s/   4>>$,,<*.//)*D*DQ$"' 	 	)	||DLL1H ::j) E~~e$$#~~dllEB$uRy0/??955//==  *<.9G''>+L>:##Htn=   	NN1$,,@A	s   	D/ /)EEc                s0    \         P                  ! V4      P                  p\        P                  ! 4       \        P
                  ! V4      ,
          pVP                  ^8:  d   R#  R#   \         d#   pT P                  RT RT 24        Rp?R# Rp?ii ; i)zIs the file older than 7 days? FzCould not determine age of 'z'' - skipping converting to sar format: NT)	osZstatZst_mtimedtZtodayZfromtimestampZdaysZ	Exceptionr   )r   ZsarfileZ_ftimeZ_ageZerrs   &&   r   r   ZSar.is_older_than_7daysS   s    	HWWW%..F88: 0 0 88DyyA~  	  	HNN9' CAADG H H 		Hs   A!A( (B3BB N)ZsystemZperformance)Zsysstat)__name__
__module____qualname____firstlineno__Z__doc__Z
short_descZplugin_nameZprofilesZpackagesr
   r   Zoption_listr   r   __static_attributes__Z__classdictcell__)Z__classdict__s   @r   r   r      sJ     0 ,JK(HHG)U;	=K
><     r   c                   s    ] tR t^atRtRtR# )	RedHatSarr   r   Nr   r   r   r   r
   r   r   r   r   r   r   a   s    Gr   r   c                   s    ] tR t^ftRtRtR# )	DebianSarz/var/log/sysstatr   Nr   r   r   r   r   r   f   s     Gr   r   )r    r   r   r   Zsos.report.pluginsr   r   r   r   r   r   r   r   r   r   r   <module>r      sG    $ 	 	9 9N& Nb\ 
!\< !r   