mysqladmin command - Command

Parsing and extracting data from output of command /bin/mysqladmin variables. Parsers contained in this module are:

MysqladminStatus - command /bin/mysqladmin status

MysqladminVars - command /bin/mysqladmin variables

class insights.parsers.mysqladmin.MysqladminStatus(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser

Module for parsing the output of the mysqladmin status command.

Typical output looks like:

Uptime: 1103965 Threads: 1820 Questions: 44778091 Slow queries: 0 Opens: 1919 Flush tables: 1 Open tables: 592 Queries per second avg: 40.561

Examples

>>> result.status['Uptime'] == '1103965'
True
>>> result.status['Threads']
'1820'
>>> result.status['Queries per second avg'] == '1919'
False
grouper(iterable, n, fillvalue=None)[source]

Collect data into fixed-length chunks or blocks

parse_content(content)[source]

This method must be implemented by classes based on this class.

class insights.parsers.mysqladmin.MysqladminVars(context, extra_bad_lines=None)[source]

Bases: insights.core.LegacyItemAccess, insights.core.CommandParser

The output of command /bin/mysqladmin variables is in mysql table format, contains ‘Variable_name’ and ‘Value’ two columns. This parser will parse the table and set each variable as an class attribute. The unparsable lines are stored in the bad_lines property list.

Example

>>> output.get('version')
'5.5.56-MariaDB'
>>> 'datadir' in output
True
>>> output.get('what', '233')
'233'
>>> output.getint('aria_block_size')
8192
getint(keyword, default=None)[source]

Get value for specified keyword, use default if keyword not found.

Example

>>> output.getint('wait_timeout')
28800
>>> output.getint('wait_what', 100)
100
Parameters
  • keyword (str) -- Key to get from self.data.

  • default (int) -- Default value to return if key is not present.

Returns

Int value of the stored item, or the default if not found.

Return type

value (int)

parse_content(content)[source]

Parse output content table of command /bin/mysqladmin variables. Set each variable as an class attribute.