NineSec Team Shell
Server IP : 184.107.3.203  /  Your IP : 216.73.216.51
Web Server : Apache
System : Linux dedicated2.avenfashion.com.ph 4.18.0-553.40.1.el8_10.x86_64 #1 SMP Mon Feb 10 12:11:18 EST 2025 x86_64
User : adminteladeoro ( 1015)
PHP Version : 8.2.28
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /usr/lib/python3.6/site-packages/sos/report/plugins/__pycache__/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //usr/lib/python3.6/site-packages/sos/report/plugins/__pycache__/charmed_mysql.cpython-36.opt-1.pyc
3

~�g��@s2ddlZddlmZmZmZGdd�dee�ZdS)�N)�Plugin�	PluginOpt�UbuntuPluginc@sReZdZdZdZdZdZeddedd�ed	d
edd�edd
e	dd�gZ
dd�ZdS)�CharmedMySQLa_
    The Charmed MySQL plugin is used to collect MySQL configuration and logs
    from the Charmed MySQL snap package. It also collects MySQL Router
    and MySQL Shell configuration and logs where available,
    journal logs for the snap, and snap info.

    If the `dumpdbs` option is set to `True`, the plugin will also try and
    collect the names of the databases that the user has access to. The
    `mysql` user is used by default, but that can be set using the `dbuser`
    option. When using the `dumpdbs` option, you must then provide the
    password for the user using the `dbpass` option.
    z
Charmed MySQLZ
charmed_mysql�
charmed-mysql�dbuserZmysqlz%Username for database dump collection)�defaultZval_typeZdesc�dbpass�z%Password for database dump collection�dumpdbsFzGet name of all databasesc
sdd}d}tdd�tjD��}|r(d}d}|�d�|�d�|�d�|�d	�|�d
�d�}|j|d�d
�|d�d�g�|j|d|d|d|d|dg�|s�|jd�|jd�|jd��r`|jd�}|jd�}dtjko�|�r|jj	d�tjd}n|�s|jj
d�dSd|i}d|��}d|�d��ddd d!d"g}	|j�fd#d$�|	D�|d%�dS)&Nz/var/snap/charmed-mysql/commonz/var/snap/charmed-mysql/currentcss|]}d|kVqdS)Z
KUBERNETESN�)�.0�keyrr�#/usr/lib/python3.6/charmed_mysql.py�	<genexpr>5sz%CharmedMySQL.setup.<locals>.<genexpr>r
z
/etc/mysqlz/var/log/mysqlz/etc/mysqlrouterz/var/log/mysqlrouterz/var/log/mysqlsh)�
MYSQL_CONF�
MYSQL_LOGS�MYSQL_ROUTER_CONF�MYSQL_ROUTER_LOGS�MYSQL_SHELL_LOGSrz/*.pemz/*.keyrrrrzsnap.charmed-mysql.*zsnap info charmed-mysqlrrr	Z	MYSQL_PWDzWMYSQL_PWD present: Using MYSQL_PWD environment variable, user did not provide password.zHdumpdbs_error: option is set, but username and password are not providedz-h 127.0.0.1 -uzmysql z -ez'show databases;'z,'select * from mysql.juju_units_operations;'zR'select * from performance_schema.replication_group_members order by MEMBER_HOST;'z$'show global status like "%conne%";'z.'select * from performance_schema.host_cache;'csg|]}��d|���qS)� r)r
Zquery)�sql_cmdrr�
<listcomp>�sz&CharmedMySQL.setup.<locals>.<listcomp>)�env)�any�os�environZadd_forbidden_pathZ
add_copy_specZadd_journalZadd_cmd_outputZ
get_optionZsoslog�infoZwarning)
�selfZsnap_path_commonZsnap_path_currentZ
k8s_deployZ
conf_pathsZdb_userZdb_passZ	mysql_envZoptsZqueriesr)rr�setup/sZ




zCharmedMySQL.setupN)r)�__name__�
__module__�__qualname__�__doc__Z
short_descZplugin_nameZpackagesr�str�boolZoption_listrrrrrrs
r)rZsos.report.pluginsrrrrrrrr�<module>	s

NineSec Team - 2022