Kernel dump configuration files¶
This module contains the following parsers:
KDumpConf - file /etc/kdump.conf
¶
KexecCrashLoaded - file /sys/kernel/kexec_crash_loaded
¶
KexecCrashSize - file /sys/kernel/kexec_crash_size
¶
- class insights.parsers.kdump.KDumpConf(context)[source]¶
Bases:
Parser
,LegacyItemAccess
A dictionary like object for the values of the
/etc/kdump.conf
file.- lines¶
raw lines from the file, in order
- Type:
list
- data¶
a dictionary of options set in the data
- Type:
dict
- comments¶
fully commented lines
- Type:
list
- inline_comments¶
lines containing inline comments
- Type:
list
- target¶
target line parsed as a (x, y) tuple if set, else None
- Type:
tuple
The
data
property has two special behaviours:If an option - e.g.
blacklist
- is repeated, its values are collected together in a list. Options that only appear once have their values stored as is.The
options
option is special - it appears in the formoption module value
. Theoptions
key in the data dictionary is therefore stored as a dictionary, keyed on themodule
name.
The
target
property has following possibilities:If target-line starts with any keyword in [‘raw’, ‘ssh’, ‘net’, ‘nfs’, ‘nfs4’], return tuple (keyword, value).
If target-line is set with ‘<fs_type> <partation>’, return tuple (<fs_type>, <partation>).
If target-line is not set, the target is default which is depending on what’s mounted in the current system, return None instead of tuple here.
Main helper functions:
options
- theoptions
value in the data(see above).
Sample
/etc/kdump.conf
file:path /var/crash core_collector makedumpfile -c --message-level 1 -d 24 default shell
Examples
>>> kd.is_local_disk True >>> kd.is_ssh() False >>> 'path' in kd True
- get_hostname(net_commands={'net', 'nfs', 'ssh'})[source]¶
Find the first host name in the given list of commands. Uses
_network_lines
above to find the list of commands. The first line that matchesurlparse
’s definition of a host name is returned, or None is returned.
- get_ip(net_commands={'net', 'nfs', 'ssh'})[source]¶
Find the first IP address in the given list of commands. Uses
_network_lines
above to find the list of commands. The first line that lists an IP address is returned, otherwise None is returned.
- property hostname¶
Uses get_hostname() above to give the first host name found in the list of crash dump destinations.
- property ip¶
Uses get_ip() above to give the first IP address found in the list of crash dump destinations.
- options(module)[source]¶
Returns the options for this module in the settings.
- Parameters:
module (str) -- The module name
- Returns:
- (str) The module’s options, or ‘’ if either
options
or module
is not found.
- (str) The module’s options, or ‘’ if either
- property using_local_disk¶
Is kdump configured to only use local disk?
Several target types:
If ‘raw’ is given, then the dump is local.
If ‘ssh’, ‘net’, ‘nfs’, or ‘nfs4’ is given, then the dump is NOT local.
If ‘<fs type> <partition>’ is given, then the dump is local.
Otherwise, the dump is local.
Since only one target could be set, the logic used here is checking if remote target is used, return True for not.
- class insights.parsers.kdump.KexecCrashLoaded(context)[source]¶
Bases:
Parser
A simple parser to determine if a crash kernel (i.e. a second kernel capable of capturing the machine state should the main kernel crash) is present.
This simply returns a set of whether the
/sys/kernel/kexec_crash_loaded
file has the value1
.