PmLogSummary - Command pmlogsummary

class insights.parsers.pmlog_summary.PmLogSummary(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser, dict

Parser to parse the output of the pmlogsummary command

Sample output of the command is:

mem.util.used  3133919.812 Kbyte
mem.physmem  3997600.000 Kbyte
kernel.all.cpu.user  0.003 none
kernel.all.cpu.sys  0.004 none
kernel.all.cpu.nice  0.000 none
kernel.all.cpu.steal  0.000 none
kernel.all.cpu.idle  3.986 none
disk.all.total  0.252 count / sec

Output is parsed and stored as a dictionary. Each value is stored as a dict in the form {'val': number or string, 'units': string}. Keys are a hierarchy of the input key value split on the “.” character. For instance input line “mem.util.used 3133919.812 Kbyte” is parsed as:

{
    'mem': {
        'util': {
            'used': {
                'val': 3133919.812,
                'units': 'Kbyte'
            }
        }
    }
}

Example

>>> type(pmlog_summary)
<class 'insights.parsers.pmlog_summary.PmLogSummary'>
>>> 'mem' in pmlog_summary
True
>>> pmlog_summary['disk']['all']['total'] == {'val': 0.252, 'units': 'count / sec'}
True
parse_content(content)[source]

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

insights.parsers.pmlog_summary.parse(data)[source]

Parse a set of key/value pairs into a heirarchical dictionary of typed values

Parameters

data (dict) -- Input dictionary of key/value pairs

Returns

Heirarchical dictionary with keys separated at “.” and type conversion of the numerical values

Return type

dict