HEX
Server: Apache
System: Linux insrv.serversdaddy.com 5.14.0-362.24.2.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Mar 30 14:11:54 EDT 2024 x86_64
User: jsaha (1066)
PHP: 8.3.6
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3.9/site-packages/sos/report/plugins/__pycache__/postgresql.cpython-39.pyc
a

^��c[�@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)Zservices)r	zpostgresql-commonz' (password visible in process listings)�pghomez/var/lib/pgsqlzpsql server home directory)�default�desc�usernameZpostgreszusername for pg_dump)rZval_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�sdtjvr�|�d�r8|�d�tjd<|�d�rld|�d�|�d�|�d�|�d�f}nd|�d�|�d�f}|dur�|�||�}|j||d	d
d�n|j�d�|�d
�dS)NrrZ
PGPASSWORDrz$pg_dump -U %s -h %s -p %s -w -F t %sr
rzpg_dump -C -U %s -w -F t %s Tr)Zsuggest_filenameZbinaryZ	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�A/usr/lib/python3.9/site-packages/sos/report/plugins/postgresql.py�
do_pg_dump0s4


�����zPostgreSQL.do_pg_dumpcCs |��|�d|�d��dS)N�	du -sh %sr
)rrr�rrrr�setupSszPostgreSQL.setup)Nr)�__name__�
__module__�__qualname__Z
short_descZplugin_nameZprofiles�packagesZpassword_warn_textr�str�intZoption_listrr!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vr,|j
|d|d	�q,|D]V}td
|�D]}|�|�q�td|�D]}|�|�q�dD]}|�|�|d
|��q�q�dS)Nr
�z-postgresql-rrz-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_matchedrr�
add_copy_specZ	path_join)rr
�dirs�pkgrZ_dirr�f��	__class__rrr!as(


�zRedHatPostgreSQL.setup)r"r#r$r%r!�
__classcell__rrr3rr(Xsr(cseZdZ�fdd�Z�ZS)�DebianPostgreSQLcs tt|���|�gd��dS)N)z/var/log/postgresql/*.logz/etc/postgresql/*/main/*.confz%/var/lib/postgresql/*/main/PG_VERSIONz*/var/lib/postgresql/*/main/postmaster.opts)r+r6r!r/r r3rrr!�szDebianPostgreSQL.setup)r"r#r$r!r5rrr3rr6�sr6)rZsos.report.pluginsrrrrrZ
sos.utilitiesrrr(r6rrrr�<module>s
B*