|
|
|
@ -25,8 +25,8 @@ options:
|
|
|
|
|
filter:
|
|
|
|
|
description:
|
|
|
|
|
- Limit the collected information by comma separated string or YAML list.
|
|
|
|
|
- Allowable values are C(version), C(databases), C(settings), C(users),
|
|
|
|
|
C(slave_status), C(slave_hosts), C(master_status), C(engines).
|
|
|
|
|
- Allowable values are C(version), C(databases), C(settings), C(global_status),
|
|
|
|
|
C(users), C(engines), C(master_status), C(slave_status), C(slave_hosts).
|
|
|
|
|
- By default, collects all subsets.
|
|
|
|
|
- You can use '!' before value (for example, C(!settings)) to exclude it from the information.
|
|
|
|
|
- If you pass including and excluding values to the filter, for example, I(filter=!settings,version),
|
|
|
|
@ -129,6 +129,12 @@ settings:
|
|
|
|
|
type: dict
|
|
|
|
|
sample:
|
|
|
|
|
- { "innodb_open_files": 300, innodb_page_size": 16384 }
|
|
|
|
|
global_status:
|
|
|
|
|
description: Global status information.
|
|
|
|
|
returned: if not excluded by filter
|
|
|
|
|
type: dict
|
|
|
|
|
sample:
|
|
|
|
|
- { "Innodb_buffer_pool_read_requests": 123, "Innodb_buffer_pool_reads": 32 }
|
|
|
|
|
users:
|
|
|
|
|
description: Users information.
|
|
|
|
|
returned: if not excluded by filter
|
|
|
|
@ -203,6 +209,7 @@ class MySQL_Info(object):
|
|
|
|
|
'version': {},
|
|
|
|
|
'databases': {},
|
|
|
|
|
'settings': {},
|
|
|
|
|
'global_status': {},
|
|
|
|
|
'engines': {},
|
|
|
|
|
'users': {},
|
|
|
|
|
'master_status': {},
|
|
|
|
@ -255,6 +262,7 @@ class MySQL_Info(object):
|
|
|
|
|
"""Collect all possible subsets."""
|
|
|
|
|
self.__get_databases()
|
|
|
|
|
self.__get_global_variables()
|
|
|
|
|
self.__get_global_status()
|
|
|
|
|
self.__get_engines()
|
|
|
|
|
self.__get_users()
|
|
|
|
|
self.__get_master_status()
|
|
|
|
@ -307,6 +315,14 @@ class MySQL_Info(object):
|
|
|
|
|
release=int(release),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
def __get_global_status(self):
|
|
|
|
|
"""Get global status."""
|
|
|
|
|
res = self.__exec_sql('SHOW GLOBAL STATUS')
|
|
|
|
|
|
|
|
|
|
if res:
|
|
|
|
|
for var in res:
|
|
|
|
|
self.info['global_status'][var['Variable_name']] = self.__convert(var['Value'])
|
|
|
|
|
|
|
|
|
|
def __get_master_status(self):
|
|
|
|
|
"""Get master status if the instance is a master."""
|
|
|
|
|
res = self.__exec_sql('SHOW MASTER STATUS')
|
|
|
|
|