HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/sos/report/plugins/__pycache__/postgresql.cpython-38.pyc
U

i��d[�@sjddlZddlmZmZmZmZmZddlmZGdd�de�Z	Gdd�de	e�Z
Gdd	�d	e	ee�ZdS)
�N)�Plugin�UbuntuPlugin�DebianPlugin�	SCLPlugin�	PluginOpt)�findc@s�eZdZdZdZdZdZdZedddd	�ed
de	dd
�edde	ded
�edde	dd
�edde	dd
�edde
dd
�gZddd�Zdd�Z
dS)�
PostgreSQLzPostgreSQL RDBMS�
postgresql)�services)r	zpostgresql-commonz' (password visible in process listings)�pghomez/var/lib/pgsqlzpsql server home directory)�default�desc�usernameZpostgreszusername for pg_dump)rZval_typer
�password�zpassword for pg_dump�dbnamez"database name to dump with pg_dump�dbhostz.database hostname/IP address (no unix sockets)�dbporti8zdatabase server listening portN�
pgdump.tarcCs�|�d�r�|�d�sdtjkr�|�d�r8|�d�tjd<|�d�rld|�d�|�d�|�d�|�d�f}nd|�d�|�d�f}|dk	r�|�||�}|j||d	d
d�n|j�d�|�d
�dS)NrrZ
PGPASSWORDrz$pg_dump -U %s -h %s -p %s -w -F t %srrzpg_dump -C -U %s -w -F t %s Tr)Zsuggest_filename�binaryZ	sizelimitz-password must be supplied to dump a database.z3WARN: password must be supplied to dump a database.)�
get_option�os�environZconvert_cmd_scl�add_cmd_outputZsoslogZwarningZ	add_alert)�self�scl�filename�cmd�r�?/usr/lib/python3/dist-packages/sos/report/plugins/postgresql.py�
do_pg_dump0s6


�����zPostgreSQL.do_pg_dumpcCs |��|�d|�d��dS)N�	du -sh %sr)r rr�rrrr�setupSszPostgreSQL.setup)Nr)�__name__�
__module__�__qualname__Z
short_descZplugin_nameZprofiles�packagesZpassword_warn_textr�str�intZoption_listr r#rrrrrs4�������
#rcs eZdZdZ�fdd�Z�ZS)�RedHatPostgreSQL)r	z!rh-postgresql95-postgresql-serverz!rh-postgresql10-postgresql-serverz!rh-postgresql12-postgresql-serverc	s�tt|���|�d�}|g}|jdd�D]n}|�d�d}|�||�}|�|�|�|�rl|�	d|�|�
|�dd��r,||jkr,|j
|d|d	�q,|D]V}td
|�D]}|�|�q�td|�D]}|�|�q�dD]}|�|�|d
|��q�q�dS)Nr�z-postgresql-rr!z-serverrzpgdump-scl-%s.tar)rrz*.logz*.conf)Z
PG_VERSIONzpostmaster.opts�data)�superr*r#rr'�splitZconvert_copyspec_scl�appendZ
path_isdirrZis_service_running�replaceZscls_matchedr r�
add_copy_specZ	path_join)rr�dirs�pkgrZ_dirr�f��	__class__rrr#as(


�zRedHatPostgreSQL.setup)r$r%r&r'r#�
__classcell__rrr5rr*Xsr*cseZdZ�fdd�Z�ZS)�DebianPostgreSQLcs$tt|���|�ddddg�dS)Nz/var/log/postgresql/*.logz/etc/postgresql/*/main/*.confz%/var/lib/postgresql/*/main/PG_VERSIONz*/var/lib/postgresql/*/main/postmaster.opts)r-r8r#r1r"r5rrr#�s�zDebianPostgreSQL.setup)r$r%r&r#r7rrr5rr8�sr8)rZsos.report.pluginsrrrrrZ
sos.utilitiesrrr*r8rrrr�<module>s
B*