U
    id                     @   s.   d dl Z d dlmZmZ G dd deeZdS )    N)PluginIndependentPluginc                   @   s0   e Zd ZdZdZdZdZdZdd Zdd	 Z	d
S )CollectdzCollectd config collectorcollectd)servicesZ	webserver)r   ))/var/log/containers/collectd/collectd.logz/var/log/collectd/collectd.logc              
   C   s   |  dddddg td}zJt| dd0}|D ]$}||r6| d| d	   q6W 5 Q R X W n0 tk
r } z| 	d
|  W 5 d }~X Y nX d S )N/etc/collectd.conf/etc/collectd.d/*.confr   z@/var/lib/config-data/puppet-generated/collectd/etc/collectd.confzD/var/lib/config-data/puppet-generated/collectd/etc/collectd.d/*.confz^LoadPlugin.*rzActive Plugin found: %sz%could not open /etc/collectd.conf: %s)
Zadd_copy_specrecompileopenZ	path_joinmatchZ	add_alertsplitIOErrorZ	_log_warn)selfpflinee r   =/usr/lib/python3/dist-packages/sos/report/plugins/collectd.pysetup   s"    	


zCollectd.setupc                 C   s:   ddddg}dd | }| d|d | d	|d d S )
NZPasswordZUserz[<]*URLZAddressz(^[#]*\s*(%s)\s* \s*)(.*)|r	   z\1"*********"r   )joinZdo_path_regex_subZdo_file_sub)r   Zprotect_keysZregexpr   r   r   postproc/   s       zCollectd.postprocN)
__name__
__module____qualname__Z
short_descZplugin_nameZprofilesZpackagesfilesr   r   r   r   r   r   r      s   r   )r   Zsos.report.pluginsr   r   r   r   r   r   r   <module>
   s   