# API Documentation¶

## insights.core¶

class insights.core.AttributeDict(*args, **kwargs)[source]

Bases: dict

Class to convert the access to each item in a dict as attribute.

Warning

Deprecated class, please set attributes explicitly.

Examples

>>> data = {
... "fact1":"fact 1"
... "fact2":"fact 2"
... "fact3":"fact 3"
... }
>>> d_obj = AttributeDict(data)
{'fact1': 'fact 1', 'fact2': 'fact 2', 'fact3': 'fact 3'}
>>> d_obj['fact1']
'fact 1'
>>> d_obj.get('fact1')
'fact 1'
>>> d_obj.fact1
'fact 1'
>>> 'fact2' in d_obj
True
>>> d_obj.get('fact3', default='no fact')
'fact 3'
>>> d_obj.get('fact4', default='no fact')
'no fact'

class insights.core.CommandParser(context, extra_bad_lines=None)[source]

This class checks output from the command defined in the spec.

Raises

ContentException -- When context.content contains a single line and that line contains one of the string in the bad_single_lines or extra_bad_lines list. Or, when context.content contains multiple lines and there is one line contains one of the string in the bad_lines or extra_bad_lines list.

static validate_lines(results, bad_single_lines, bad_lines)[source]

This function returns False when:

1. If the results is a single line and that line contains
one of the string in the bad_single_lines list.
2. If the results contains multiple lines and there is one line
contains one of the string in the bad_lines list.


If no bad line is found the function returns True.

Parameters
• results (list) -- The results string of the output from the command defined by the command spec.

• bad_single_lines (list) -- The list of bad lines should be checked only when the result contains a single line.

• bad_lines (list) -- The list of bad lines should be checked only when the result contains multiple lines.

Returns

Return type

(Boolean)

class insights.core.ConfigCombiner(confs, main_file, include_finder)[source]

Base Insights component class for Combiners of configuration files with include directives for supplementary configuration files. httpd and nginx are examples.

find_matches(confs, pattern)[source]
class insights.core.ConfigComponent[source]

Bases: object

property directives
find(*queries, **kwargs)[source]

Finds matching results anywhere in the configuration

find_all(*queries, **kwargs)

Finds matching results anywhere in the configuration

property sections
select(*queries, **kwargs)[source]

Given a list of queries, executes those queries against the set of Nodes. A Node has three primary attributes: name (str), attrs ([str|int]), and children ([Node]).

Nodes also have a value attribute that is either the first attribute (in the case of simple directives that only have one), or the string representation of all attributes joined by a single space.

Each positional argument to select represents a query against the name and/or attributes of the corresponding level of the configuration tree. The first argument queries root nodes, the second argument queries children of the root nodes, etc.

An individual query is either a single value or a tuple. A single value queries the name of a Node. A tuple queries the name and the attrs.

So: select(name_predicate) or select((name_predicate, attrs_predicate))

In general, select(pred1, pred2, pred3, …)

If a predicate is a simple value (string or int), an exact match is required for names, and an exact match of any attribute is required for attributes.

Examples: select(“Directory”) queries for all root nodes named Directory.

select(“Directory”, “Options”) queries for all root nodes named Directory that contain at least one child node named Options. Notice the argument positions: Directory is in position 1, and Options is in position 2.

select((“Directory”, “/”)) queries for all root nodes named Directory that contain an attribute exactly matching “/”. Notice this is one argument to select: a 2-tuple with predicates for name and attrs.

If you are only interested in attributes, just pass None for the name predicate in the tuple: select((None, “/”)) will return all root nodes with at least one attribute of “/”

In addition to exact matches, the elements of a query can be functions that accept the value corresponding to their position in the query. A handful of useful functions and boolean operators between them are provided.

select(startswith(“Dir”)) queries for all root nodes with names starting with “Dir”.

select(~startswith(“Dir”)) queries for all root nodes with names not starting with “Dir”.

select(startswith(“Dir”) | startswith(“Ali”)) queries for all root nodes with names starting with “Dir” or “Ali”. The return of | is a single callable passed in the first argument position of select.

select(~startswith(“Dir”) & ~startswith(“Ali”)) queries for all root nodes with names not starting with “Dir” or “Ali”.

If a function is in an attribute position, it is considered True if it returns True for any attribute.

For example, select((None, 80)) often will return the list of one Node [Listen 80]

select((“Directory”, startswith(“/var”))) will return all root nodes named Directory that also have an attribute starting with “/var”

If you know that your selection will only return one element, or you only want the first or last result of the query , pass one=first or one=last.

select((“Directory”, startswith(“/”)), one=last) will return the single root node for the last Directory entry starting with “/”

If instead of the root nodes that match you want the child nodes that caused the match, pass roots=False.

node = select((“Directory”, “/var/www/html”), “Options”, one=last, roots=False) might return the Options node if the Directory for “/var/www/html” was defined and contained an Options Directive. You could then access the attributes with node.attrs. If the query didn’t match anything, it would have returned None.

If you want to slide the query down the branches of the config, pass deep=True to select. That allows you to do conf.select(“Directory”, deep=True, roots=False) and get back all Directory nodes regardless of nesting depth.

conf.select() returns everything.

Available predicates are: & (infix boolean and) | (infix boolean or) ~ (prefix boolean not)

For ints or strings: eq (==) e.g. conf.select(“Directory, (“StartServers”, eq(4))) ge (>=) e.g. conf.select(“Directory, (“StartServers”, ge(4))) gt (>) le (<=) lt (<)

For strings: contains endswith startswith

class insights.core.ConfigParser(context)[source]

Base Insights component class for Parsers of configuration files.

Raises

SkipException -- When input content is empty.

lineat(pos)[source]
parse_content(content)[source]

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

parse_doc(content)[source]
class insights.core.FileListing(context)[source]

Reads a series of concatenated directory listings and turns them into a dictionary of entities by name. Stores all the information for each directory entry for every entry that can be parsed, containing:

• type (one of [bcdlps-])

• permission string including ACL character

• owner and group (as given in the listing)

• size, or major and minor number for block and character devices

• date (in the format given in the listing)

• name

In addition, the raw line is always stored, even if the line doesn’t look like a directory entry.

Also provides a number of other conveniences, such as:

• lists of regular and special files and subdirectory names for each directory, in the order found in the listing

• total blocks allocated to all the entities in this directory

Note

For listings that only contain one directory, ls does not output the directory name. The directory is reverse engineered from the path given to the parser by Insights - this assumes the translation of spaces to underscores and ‘/’ to ‘.’ in paths. For example, ls -l /var/www/html will be translated to ls_-l_.var.www.html. The reverse translation will make mistakes, for example in translating .etc.yum.repos.d to /etc/yum/repos/d. Use caution in checking the paths when requesting single directories.

Parses the SELinux information if present in the listing. SELinux directory listings contain:

• the type of file

• the permissions block

• the owner and group as given in the directory listing

• the SELinux user, role, type and MLS

Sample input data looks like this:

/example_dir:
total 20
dr-xr-xr-x. 3 0 0 4096 Mar 4 16:19 .
-rw-r--r--. 1 0 0 123891 Aug 25 2015 config-3.10.0-229.14.1.el7.x86_64
lrwxrwxrwx. 1 0 0 11 Aug 4 2014 menu.lst -> ./grub.conf
brw-rw----. 1 0 6 253, 10 Aug 4 16:56 dm-10
crw-------. 1 0 0 10, 236 Jul 25 10:00 control

Examples

>>> file_listing
<insights.core.FileListing at 0x7f5319407450>
>>> '/example_dir' in file_listing
True
True
>>> dir = file_listing.listing_of('/example_dir')
>>> dir['.']['type']
'd'
>>> dir['config-3.10.0-229.14.q.el7.x86_64']['size']
123891
>>> dir['dm-10']['major']
253
'./grub.conf'

dir_contains(directory, name)[source]

Does this directory contain this entry name?

dir_entry(directory, name)[source]

The parsed data for the given entry name in the given directory.

dirs_of(directory)[source]

The list of subdirectories in the given directory.

files_of(directory)[source]

The list of non-special files (i.e. not block or character files) in the given directory.

listing_of(directory)[source]

The listing of this directory, in a dictionary by entry name. All entries contain the original line as is in the ‘raw_entry’ key. Entries that can be parsed then have fields as described in the class description above.

parse_content(content)[source]

Called automatically to process the directory listing(s) contained in the content.

path_entry(path)[source]

The parsed data given a path, which is separated into its directory and entry name.

specials_of(directory)[source]

The list of block and character special files in the given directory.

total_of(directory)[source]

The total blocks of storage consumed by entries in this directory.

class insights.core.IniConfigFile(context)[source]

A class specifically for reading configuration files in ‘ini’ format.

The input file format supported by this class is:

[section 1]
key = value
; comment
# comment
[section 2]
key with spaces = value string
[section 3]
# Must implement parse_content in child class
# and pass allow_no_value=True to parent class
# to enable keys with no values
key_with_no_value


References

See Python RawConfigParser documentation for more information https://docs.python.org/2/library/configparser.html#rawconfigparser-objects

Examples

>>> class MyConfig(IniConfigFile):
...     pass
>>> content = '''
... [defaults]
... [program opts]
... memsize = 1024
... delay = 1.5
... [logging]
... log = true
... logging level = verbose
... '''.split()
>>> my_config = MyConfig(context_wrap(content, path='/etc/myconfig.conf'))
>>> 'program opts' in my_config
True
>>> my_config.sections()
['program opts', 'logging']
>>> my_config.defaults()
>>> my_config.items('program opts')
{'memsize': 1024, 'delay': 1.5}
>>> my_config.get('logging', 'logging level')
'verbose'
>>> my_config.getint('program opts', 'memsize')
1024
>>> my_config.getfloat('program opts', 'delay')
1.5
>>> my_config.getboolean('logging', 'log')
True
>>> my_config.has_option('logging', 'log')
True

defaults()[source]

list: Return a dict of key/value pairs in the [default] section.

get(section, key)[source]

value: Get value for section and key.

getboolean(section, key)[source]

boolean: Get boolean value for section and key.

getfloat(section, key)[source]

float: Get float value for section and key.

getint(section, key)[source]

int: Get int value for section and key.

has_option(section, key)[source]

boolean: Returns True of section is present and has option key.

items(section)[source]

dict: Return a dictionary of key/value pairs for section.

parse_content(content, allow_no_value=False)[source]

Parses content of the config file.

In child class overload and call super to set flag allow_no_values and allow keys with no value in config file:

def parse_content(self, content):
super(YourClass, self).parse_content(content,
allow_no_values=True)

parse_doc(content)[source]
sections()[source]

list: Return a list of section names.

class insights.core.JSONParser(context)[source]

A parser class that reads JSON files. Base your own parser on this.

parse_content(content)[source]

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

class insights.core.LegacyItemAccess[source]

Bases: object

Mixin class to provide legacy access to self.data attribute.

Provides expected passthru functionality for classes that still use self.data as the primary data structure for all parsed information. Use this as a mixin on parsers that expect these methods to be present as they were previously.

Examples

>>> class MyParser(LegacyItemAccess, Parser):
...     def parse_content(self, content):
...         self.data = {}
...         for line in content:
...             if 'fact' in line:
...                 k, v = line.split('=')
...                 self.data[k.strip()] = v.strip()
>>> content = '''
... # Comment line
... fact1=fact 1
... fact2=fact 2
... fact3=fact 3
... '''.strip()
>>> my_parser = MyParser(context_wrap(content, path='/etc/path_to_content/content.conf'))
>>> my_parser.data
{'fact1': 'fact 1', 'fact2': 'fact 2', 'fact3': 'fact 3'}
>>> my_parser.file_path
'/etc/path_to_content/content.conf'
>>> my_parser.file_name
'content.conf'
>>> my_parser['fact1']
'fact 1'
>>> 'fact2' in my_parser
True
>>> my_parser.get('fact3', default='no fact')
'fact 3'

get(item, default=None)[source]

Returns value of key item in self.data or default if key is not present.

Parameters
• item -- Key to get from self.data.

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

Returns

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

Return type

(str)

class insights.core.LogFileOutput(context)[source]

Class for parsing log file content.

Log file content is stored in raw format in the lines attribute.

Assume the log file content is:

Log file line one
Log file line two
Log file line three, and more


Examples

>>> class MyLogger(LogFileOutput):
...     pass
>>> MyLogger.keep_scan('get_one', 'one')
>>> MyLogger.keep_scan('get_three_and_more', ['three', 'more'])
>>> MyLogger.keep_scan('get_one_or_two', ['one', 'two'], check=any)
>>> MyLogger.last_scan('last_line_contains_file', 'file')
>>> MyLogger.keep_scan('last_2_lines_contain_file', 'file', num=2, reverse=True)
>>> MyLogger.keep_scan('last_3_lines_contain_line_and_t', ['line', 't'], num=3, reverse=True)
>>> MyLogger.token_scan('find_more', 'more')
>>> MyLogger.token_scan('find_four_and_more', ['four', 'more'])
>>> MyLogger.token_scan('find_four_or_more', ['four', 'more'], check=any)
>>> my_logger = MyLogger(context_wrap(contents, path='/var/log/mylog'))
>>> my_logger.file_path
'/var/log/mylog'
>>> my_logger.file_name
'mylog'
>>> my_logger.get('two')
[{'raw_message': 'Log file line two'}]
>>> 'line three,' in my_logger
True
>>> my_logger.get(['three', 'more'])
[{'raw_message': 'Log file line three, and more'}]
>>> my_logger.lines[0]
'Log file line one'
>>> my_logger.get_one
[{'raw_message': 'Log file line one'}]
>>> my_logger.get_three_and_more == my_logger.get(['three', 'more'])
True
>>> my_logger.last_line_contains_file
{'raw_message': 'Log file line three, and more'}
>>> len(my_logger.last_2_lines_contain_file)
2
>>> len(my_logger.last_3_lines_contain_line_and_t)  # Only 2 lines contain 'line' and 't'
2
>>> my_logger.find_more
True
>>> my_logger.find_four_and_more
False
>>> my_logger.find_four_or_more
True

lines

List of the lines from the log file content.

Type

list

get(s, check=<built-in function all>, num=None, reverse=False)[source]

Returns all lines that contain s anywhere and wrap them in a list of dictionaries. s can be either a single string or a string list. For list, all keywords in the list must be found in each line.

Parameters
• s (str or list) -- one or more strings to search for

• check (func) -- built-in function all or any applied to each line

• num (int) -- the number of lines to get, None for unlimited

• reverse (bool) -- scan start from the head when False by default, otherwise start from the tail

Returns

list of dictionaries corresponding to the parsed lines contain the s.

Return type

(list)

Raises

TypeError -- When s is not a string or a list of strings, or num is not an integer.

get_after(timestamp, s=None)[source]

Find all the (available) logs that are after the given time stamp.

If s is not supplied, then all lines are used. Otherwise, only the lines contain the s are used. s can be either a single string or a string list. For list, all keywords in the list must be found in each line.

This method then finds all lines which have a time stamp after the given timestamp. Lines that do not contain a time stamp are considered to be part of the previous line and are therefore included if the last log line was included or excluded otherwise.

Time stamps are recognised by converting the time format into a regular expression which matches the time format in the string. This is then searched for in each line in turn. Only lines with a time stamp matching this expression will trigger the decision to include or exclude lines. Therefore, if the log for some reason does not contain a time stamp that matches this format, no lines will be returned.

The time format is given in strptime() format, in the object’s time_format property. Users of the object should not change this property; instead, the parser should subclass LogFileOutput and change the time_format property.

Some logs, regrettably, change time stamps formats across different lines, or change time stamp formats in different versions of the program. In order to accommodate this, the timestamp format can be a list of strptime() format strings. These are combined as alternatives in the regular expression, and are given to strptime in order. These can also be listed as the values of a dict, e.g.:

{'pre_10.1.5': '%y%m%d %H:%M:%S', 'post_10.1.5': '%Y-%m-%d %H:%M:%S'}


Note

Some logs - notably /var/log/messages - do not contain a year in the timestamp. This detected by the absence of a ‘%y’ or ‘%Y’ in the time format. If that year field is absent, the year is assumed to be the year in the given timestamp being sought. Some attempt is made to handle logs with a rollover from December to January, by finding when the log’s timestamp (with current year assumed) is over eleven months (specifically, 330 days) ahead of or behind the timestamp date and shifting that log date by 365 days so that it is more likely to be in the sought range. This paragraph is sponsored by syslog.

Parameters
• timestamp (datetime.datetime) -- lines before this time are ignored.

• s (str or list) -- one or more strings to search for. If not supplied, all available lines are searched.

Yields

dict -- The parsed lines with timestamps after this date in the same format they were supplied. It at least contains the raw_message as a key.

Raises

ParseException -- If the format conversion string contains a format that we don’t recognise. In particular, no attempt is made to recognise or parse the time zone or other obscure values like day of year or week of year.

classmethod keep_scan(result_key, token, check=<built-in function all>, num=None, reverse=False)[source]

Define a property that is set to the list of dictionaries of the lines that contain the given token. Uses the get method of the log file.

Parameters
• result_key (str) -- the scanner key to register

• token (str or list) -- one or more strings to search for

• check (func) -- built-in function all or any applied to each line

• num (int) -- the number of lines to get, None for unlimited

• reverse (bool) -- scan start from the head when False by default, otherwise start from the tail

Returns

list of dictionaries corresponding to the parsed lines contain the token.

Return type

(list)

classmethod last_scan(result_key, token, check=<built-in function all>)[source]

Define a property that is set to the dictionary of the last line that contains the given token. Uses the get method of the log file.

Parameters
• result_key (str) -- the scanner key to register

• token (str or list) -- one or more strings to search for

• check (func) -- built-in function all or any applied to each line

Returns

dictionary corresponding to the last parsed line contains the token.

Return type

(dict)

parse_content(content)[source]

Use all the defined scanners to search the log file, setting the properties defined in the scanner.

classmethod scan(result_key, func)[source]

Define computed fields based on a string to “grep for”. This is preferred to utilizing raw log lines in plugins because computed fields will be serialized, whereas raw log lines will not.

Raises

ValueError -- When result_key is already a registered scanner key.

scanner_keys = {}
scanners = []
time_format = '%Y-%m-%d %H:%M:%S'

The timestamp format assumed for the log files. A subclass can override this for files that have a different timestamp format. This can be:

• A string in strptime() format.

• A list of strptime() strings.

• A dictionary with each item’s value being a strptime() string. This allows the item keys to provide some form of documentation.

classmethod token_scan(result_key, token, check=<built-in function all>)[source]

Define a property that is set to true if the given token is found in the log file. Uses the __contains__ method of the log file.

Parameters
• result_key (str) -- the scanner key to register

• token (str or list) -- one or more strings to search for

• check (func) -- built-in function all or any applied to each line

Returns

the property will contain True if a line contained (any or all) of the tokens given.

Return type

(bool)

class insights.core.Parser(context)[source]

Bases: object

Base class designed to be subclassed by parsers.

The framework will construct your object with a Context that will provide at least the content as an interable of lines and the path that the content was retrieved from.

Facts should be exposed as instance members where applicable. For example:

self.fact = "123"


Examples

>>> class MyParser(Parser):
...     def parse_content(self, content):
...         self.facts = []
...         for line in content:
...             if 'fact' in line:
...                 self.facts.append(line)
>>> content = '''
... # Comment line
... fact=fact 1
... fact=fact 2
... fact=fact 3
... '''.strip()
>>> my_parser = MyParser(context_wrap(content, path='/etc/path_to_content/content.conf'))
>>> my_parser.facts
['fact=fact 1', 'fact=fact 2', 'fact=fact 3']
>>> my_parser.file_path
'/etc/path_to_content/content.conf'
>>> my_parser.file_name
'content.conf'

file_name = None

Filename portion of the input file.

Type

str

file_path = None

Full context path of the input file.

Type

str

parse_content(content)[source]

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

class insights.core.ScanMeta[source]

Bases: type

class insights.core.Scannable(context)[source]

A class to enable early and easy collection of data in a file.

The Scannable class makes it easy to collect two common types of information from a data file:

• A flag to indicate that the data contains one or more lines with a given string.

• a list of lines containing a given string.

To create a parser from the Scannable parser class, the main job is to override the parse() method, returning your choice of data structure to represent the information in the file. This takes the form of a generator that yields structures for users of your parser. You can yield more than object per line, or you can condense multiple lines into one object. Each object is then scanned with all the defined scanners for this class.

How does that work? Well, the individual rules using your parser will use the any() and collect() methods on the class object itself to set up new attributes of the class that will be given values based on the results of a function that checks each object from your parser for the properties it’s looking for. That’s pretty vague, so let’s give some examples - imagine a parser defined as:

class AnacondaLog(Scannable):

pass

(Which uses the default parse() function that simply yields each line in turn.) A rule using this parser then does:

def warnings(line):

return line if ‘WARNING’ in line

def has_fcoe_edd(line):

return ‘/usr/libexec/fcoe/fcoe_edd.sh’ in line

AnacondaLog.any(‘has_fcoe’, has_fcoe_edd) AnacondaLog.collect(‘warnings’, warnings)

These then act in the following way:

• When an object is instantiated from the AnacondaLog class, it will have the ‘has_fcoe’ attribute. This will be set to True if ‘/usr/libexec/fcoe/fcoe_edd.sh’ was found in any line in the file, or False otherwise.

• When an object is instantiated from the AnacondaLog class, it will have the ‘warnings’ attribute. This will be a list containing all the lines found.

Users of your class can supply any function to either any() or collect(). Functions given to collect() can return anything they want to be collected - if they return something that evaluates to False then nothing is collected (so avoid returning empty lists, empty dicts, empty strings or False).

classmethod any(result_key, func)[source]

Sets the result_key to the output of func if func ever returns truthy

classmethod collect(result_key, func)[source]

Sets the result_key to an iterable of objects for which func(obj) returns True

parse(content)[source]

Default ‘parsing’ method. Subclasses should override this method with their own custom parsing as necessary.

parse_content(content)[source]

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

scanner_keys = {}
scanners = []
class insights.core.StreamParser(context)[source]

Parsers that don’t have to store lines or look back in the data stream should implement StreamParser instead of Parser as it is more memory efficient. The only difference between StreamParser and Parser is that StreamParser.parse_content will receive a generator instead of a list.

class insights.core.SysconfigOptions(context)[source]

A parser to handle the standard ‘keyword=value’ format of files in the /etc/sysconfig directory. These are provided in the standard ‘data’ dictionary.

Examples

>>> 'OPTIONS' in ntpconf
True
>>> 'NOT_SET' in ntpconf
False
>>> 'COMMENTED_OUT' in ntpconf
False
>>> ntpconf['OPTIONS']
'-x -g'


For common variables such as OPTIONS, it is recommended to set a specific property in the subclass that fetches this option with a fallback to a default value.

Example subclass:

class DirsrvSysconfig(SysconfigOptions):

@property
def options(self):
return self.data.get('OPTIONS', '')

keys()[source]

Return the list of keys (in no order) in the underlying dictionary.

parse_content(content)[source]

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

class insights.core.Syslog(context)[source]

Class for parsing syslog file content.

The important function is get(s)(), which finds all lines with the string s and parses them into dictionaries with the following keys:

• timestamp - the time the log line was written

• procname - the process or facility that wrote the line

• hostname - the host that generated the log line

• message - the rest of the message (after the process name)

• raw_message - the raw message before being split.

It is best to use filters and/or scanners with the messages log, to speed up parsing. These work on the raw message, before being parsed.

Sample log lines:

May  9 15:13:34 lxc-rhel68-sat56 jabberd/sm[11057]: session started: jid=rhn-dispatcher-sat@lxc-rhel6-sat56.redhat.com/superclient
May  9 15:13:36 lxc-rhel68-sat56 wrapper[11375]: --> Wrapper Started as Daemon
May  9 15:13:36 lxc-rhel68-sat56 wrapper[11375]: Launching a JVM...
May 10 15:24:28 lxc-rhel68-sat56 yum[11597]: Installed: lynx-2.8.6-27.el6.x86_64
May 10 15:36:19 lxc-rhel68-sat56 yum[11954]: Updated: sos-3.2-40.el6.noarch


Examples

>>> Syslog.token_scan('daemon_start', 'Wrapper Started as Daemon')
>>> Syslog.token_scan('yum_updated', ['yum', 'Updated'])
>>> Syslog.keep_scan('yum_lines', 'yum')
>>> Syslog.keep_scan('yum_installed_lines', ['yum', 'Installed'])
>>> syslog.get('wrapper')[0]
{'timestamp': 'May  9 15:13:36', 'hostname': 'lxc-rhel68-sat56',
'procname': wrapper[11375]', 'message': '--> Wrapper Started as Daemon',
'raw_message': 'May  9 15:13:36 lxc-rhel68-sat56 wrapper[11375]: --> Wrapper Started as Daemon'
}
>>> syslog.daemon_start
True
>>> syslog.yum_updated
True
>>> len(syslog.yum_lines)
2
>>> len(syslog.yum_updated_lines)
1


Note

Because syslog timestamps by default have no year, the year of the logs will be inferred from the year in your timestamp. This will also work around December/January crossovers.

get_logs_by_procname(proc)[source]
Parameters

proc (str) -- The process or facility that you’re looking for

Yields

(dict) -- The parsed syslog messages produced by that process or facility

scanner_keys = {}
scanners = []
time_format = '%b %d %H:%M:%S'
class insights.core.XMLParser(context)[source]

A parser class that reads XML files. Base your own parser on this.

Examples

>>> content = '''
... <?xml version="1.0"?>
... <data xmlns:fictional="http://characters.example.com"
...       xmlns="http://people.example.com">
...     <country name="Liechtenstein">
...         <rank updated="yes">2</rank>
...         <year>2008</year>
...         <gdppc>141100</gdppc>
...         <neighbor name="Austria" direction="E"/>
...         <neighbor name="Switzerland" direction="W"/>
...     </country>
...     <country name="Singapore">
...         <rank updated="yes">5</rank>
...         <year>2011</year>
...         <gdppc>59900</gdppc>
...         <neighbor name="Malaysia" direction="N"/>
...     </country>
...     <country name="Panama">
...         <rank>68</rank>
...         <year>2011</year>
...         <gdppc>13600</gdppc>
...         <neighbor name="Costa Rica" direction="W"/>
...     </country>
... </data>
... '''.strip()
>>> xml_parser = XMLParser(context_wrap(content))
>>> xml_parser.xmlns
'http://people.example.com'
>>> xml_parser.get_elements(".")[0].tag # Top-level elements
'data'
>>> len(xml_parser.get_elements("./country/neighbor", None)) # All 'neighbor' grand-children of 'country' children of the top-level elements
3
>>> len(xml_parser.get_elements(".//year/..[@name='Singapore']")[0]) # Nodes with name='Singapore' that have a 'year' child
1
>>> xml_parser.get_elements(".//*[@name='Singapore']/year")[0].text # 'year' nodes that are children of nodes with name='Singapore'
'2011'
>>> xml_parser.get_elements(".//neighbor[2]", "http://people.example.com")[0].get('name') # All 'neighbor' nodes that are the second child of their parent
'Switzerland'

raw

raw XML content

Type

str

dom

Root element of parsed XML file

Type

Element

xmlns

The default XML namespace, an empty string when no namespace is declared.

Type

str

data

All required specific properties can be included in data.

Type

dict

get_elements(element, xmlns=None)[source]

Return a list of elements those match the searching condition. If the XML input has namespaces, elements and attributes with prefixes in the form prefix:sometag get expanded to {namespace}element where the prefix is replaced by the full URI. Also, if there is a default namespace, that full URI gets prepended to all of the non-prefixed tags. Element names can contain letters, digits, hyphens, underscores, and periods. But element names must start with a letter or underscore. Here the while-clause is to set searching condition from /element1/element2 to /{namespace}element1/{namespace}/element2

Parameters
• element -- Searching condition to search certain elements in an XML file. For more details about how to set searching condition, refer to section 19.7.2.1. Example and 19.7.2.2. Supported XPath syntax in https://docs.python.org/2/library/xml.etree.elementtree.html

• xmlns -- XML namespace, default value to None. None means that xmlns equals to the self.xmlns (default namespace) instead of “” all the time. Only string type parameter (including “”) will be regarded as a valid xml namespace.

Returns

List of elements those match the searching condition

Return type

(list)

parse_content(content)[source]

All child classes inherit this function to parse XML file automatically. It will call the function parse_dom() by default to parser all necessary data to data and the xmlns (the default namespace) is ready for this function.

parse_dom()[source]

If self.data is required, all child classes need to overwrite this function to set it

class insights.core.YAMLParser(context)[source]

A parser class that reads YAML files. Base your own parser on this.

parse_content(content)[source]

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

insights.core.default_parser_deserializer(_type, data)[source]
insights.core.default_parser_serializer(obj)[source]
insights.core.find_main(confs, name)[source]
insights.core.flatten(docs, pred)[source]

Replace include nodes with their config trees. Allows the same files to be included more than once so long as they don’t induce a recursion.

## insights.core.context¶

class insights.core.context.ClusterArchiveContext(root='/', timeout=None, all_files=None)[source]
class insights.core.context.Context(**kwargs)[source]

Bases: object

product()[source]
stream()[source]
class insights.core.context.Docker(role=None)[source]
name = 'docker'
parent_type = 'host'
class insights.core.context.DockerImageContext(root='/', timeout=None, all_files=None)[source]
class insights.core.context.ExecutionContext(root='/', timeout=None, all_files=None)[source]

Bases: object

check_output(cmd, timeout=None, keep_rc=False, env=None, signum=None)[source]

Subclasses can override to provide special environment setup, command prefixes, etc.

connect(*args, **kwargs)[source]
classmethod handles(files)[source]
locate_path(path)[source]
marker = None
shell_out(cmd, split=True, timeout=None, keep_rc=False, env=None, signum=None)[source]
stream(*args, **kwargs)[source]
class insights.core.context.ExecutionContextMeta(name, bases, dct)[source]

Bases: type

classmethod identify(files)[source]
registry = [<class 'insights.core.context.HostContext'>, <class 'insights.core.context.HostArchiveContext'>, <class 'insights.core.context.SerializedArchiveContext'>, <class 'insights.core.context.SosArchiveContext'>, <class 'insights.core.context.ClusterArchiveContext'>, <class 'insights.core.context.DockerImageContext'>, <class 'insights.core.context.JBossContext'>, <class 'insights.core.context.JDRContext'>, <class 'insights.core.context.InsightsOperatorContext'>, <class 'insights.core.context.MustGatherContext'>, <class 'insights.core.context.OpenStackContext'>, <class 'insights.core.context.OpenShiftContext'>]
class insights.core.context.HostArchiveContext(root='/', timeout=None, all_files=None)[source]
marker = 'insights_commands'
class insights.core.context.HostContext(root='/', timeout=30, all_files=None)[source]
class insights.core.context.InsightsOperatorContext(root='/', timeout=None, all_files=None)[source]

Recognizes insights-operator archives

marker = 'config/featuregate'
class insights.core.context.JBossContext(root='/', timeout=30, all_files=None)[source]
class insights.core.context.JDRContext(root='/', timeout=None, all_files=None)[source]
locate_path(path)[source]
marker = 'JBOSS_HOME'
class insights.core.context.MultiNodeProduct(role=None)[source]

Bases: object

is_parent()[source]
class insights.core.context.MustGatherContext(root='/', timeout=None, all_files=None)[source]

Recognizes must-gather archives

marker = 'namespaces'
class insights.core.context.OSP(role=None)[source]
name = 'osp'
parent_type = 'Director'
class insights.core.context.OpenShiftContext(hostname)[source]
class insights.core.context.OpenStackContext(hostname)[source]
class insights.core.context.RHEL(version=['-1', '-1'], release=None)[source]

Bases: object

classmethod from_metadata(metadata, processor_obj)[source]
name = 'rhel'
class insights.core.context.RHEV(role=None)[source]
name = 'rhev'
parent_type = 'Manager'
class insights.core.context.SerializedArchiveContext(root='/', timeout=None, all_files=None)[source]
marker = 'insights_archive.txt'
class insights.core.context.SosArchiveContext(root='/', timeout=None, all_files=None)[source]
marker = 'sos_commands'
insights.core.context.create_product(metadata, hostname)[source]
insights.core.context.fs_root(thing)[source]
insights.core.context.get_system(metadata, hostname)[source]
insights.core.context.product(klass)[source]

## insights.core.dr¶

This module implements an inversion of control framework. It allows dependencies among functions and classes to be declared with decorators and the resulting dependency graphs to be executed.

A decorator used to declare dependencies is called a ComponentType, a decorated function or class is called a component, and a collection of interdependent components is called a graph.

In the example below, needs is a ComponentType, one, two, and add are components, and the relationship formed by their dependencies is a graph.

from insights import dr

class needs(dr.ComponentType):
pass

@needs()
def one():
return 1

@needs()
def two():
return 2

@needs(one, two)
return a + b



Once all components have been imported, the graphs they form can be run. To execute a graph, dr sorts its components into an order that guarantees dependencies are tried before dependents. Components that raise exceptions are considered invalid, and their dependents will not be executed. If a component is skipped because of a missing dependency, its dependents also will not be executed.

During evaluation, results are accumulated into an object called a Broker, which is just a fancy dictionary. Brokers can be inspected after a run for results, exceptions, tracebacks, and execution times. You also can register callbacks with a broker that get invoked after the attempted execution of every component, so you can inspect it during an evaluation instead of at the end.

class insights.core.dr.Broker(seed_broker=None)[source]

Bases: object

The Broker is a fancy dictionary that keeps up with component instances as a graph is evaluated. It’s the state of the evaluation. Once a graph has executed, the broker will contain everything about the evaluation: component instances, timings, exceptions, and tracebacks.

You can either inspect the broker at the end of an evaluation, or you can register callbacks with it, and they’ll get invoked after each component is called.

instances

the component instances with components as keys.

Type

dict

missing_requirements

components that didn’t have their dependencies met. Values are a two-tuple. The first element is the list of required dependencies that were missing. The second element is the list of “at least one” dependencies that were missing. For more information on dependency types, see the ComponentType docs.

Type

dict

exceptions

Components that raise any type of exception except SkipComponent during evaluation. The key is the component, and the value is a list of exceptions. It’s a list because some components produce multiple instances.

Type

defaultdict(list)

tracebacks

keys are exceptions and values are their text tracebacks.

Type

dict

exec_times

component -> float dictionary where values are the number of seconds the component took to execute. Calculated using time.time(). For components that produce multiple instances, the execution time here is the sum of their individual execution times.

Type

dict

add_exception(component, ex, tb=None)[source]
add_observer(o, component_type=<class 'insights.core.dr.ComponentType'>)[source]

Add a callback that will get invoked after each component is called.

Parameters

o (func) -- the callback function

Keyword Arguments

component_type (ComponentType) -- the ComponentType to observe. The callback will fire any time an instance of the class or its subclasses is invoked.

The callback should look like this:

def callback(comp, broker):
value = broker.get(comp)
# do something with value
pass

fire_observers(component)[source]
get(component, default=None)[source]
get_by_type(_type)[source]

Return all of the instances of ComponentType _type.

items()[source]
keys()[source]
observer(component_type=<class 'insights.core.dr.ComponentType'>)[source]

You can use @broker.observer() as a decorator to your callback instead of Broker.add_observer().

print_component(component_type)[source]
values()[source]
exception insights.core.dr.MissingRequirements(requirements)[source]

Bases: Exception

Raised during evaluation if a component’s dependencies aren’t met.

exception insights.core.dr.SkipComponent[source]

Bases: Exception

This class should be raised by components that want to be taken out of dependency resolution.

insights.core.dr.add_dependency(component, dep)[source]
insights.core.dr.add_dependent(component, dep)[source]
insights.core.dr.add_ignore(c, i)[source]
insights.core.dr.add_observer(o, component_type=<class 'insights.core.dr.ComponentType'>)[source]

Add a callback that will get invoked after each component is called.

Parameters

o (func) -- the callback function

Keyword Arguments

component_type (ComponentType) -- the ComponentType to observe. The callback will fire any time an instance of the class or its subclasses is invoked.

The callback should look like this:

def callback(comp, broker):
value = broker.get(comp)
# do something with value
pass

insights.core.dr.first_of(dependencies, broker)[source]
insights.core.dr.generate_incremental(components=None, broker=None)[source]
insights.core.dr.get_base_module_name(obj)[source]
insights.core.dr.get_component(name)[source]

Returns the class or function specified, importing it if necessary.

insights.core.dr.get_component_by_name(name)[source]

Look up a component by its fully qualified name. Return None if the component hasn’t been loaded.

insights.core.dr.get_component_type(component)[source]
insights.core.dr.get_components_of_type(_type)[source]
insights.core.dr.get_delegate(component)[source]
insights.core.dr.get_dependencies(component)[source]
insights.core.dr.get_dependency_graph(component)[source]

Generate a component’s graph of dependencies, which can be passed to run() or run_incremental().

insights.core.dr.get_dependents(component)[source]
insights.core.dr.get_group(component)[source]

Return the dictionary of links associated with the component. Defaults to dict().

insights.core.dr.get_metadata(component)[source]

Return any metadata dictionary associated with the component. Defaults to an empty dictionary.

insights.core.dr.get_missing_requirements(func, requires, d)[source]

Deprecated since version 1.x.

insights.core.dr.get_module_name(obj)[source]
insights.core.dr.get_name(component)[source]

Attempt to get the string name of component, including module and class if applicable.

insights.core.dr.get_simple_name(component)[source]
insights.core.dr.get_subgraphs(graph=None)[source]

Given a graph of possibly disconnected components, generate all graphs of connected components. graph is a dictionary of dependencies. Keys are components, and values are sets of components on which they depend.

insights.core.dr.get_tags(component)[source]

Return the set of tags associated with the component. Defaults to set().

insights.core.dr.hashable(v)[source]
insights.core.dr.is_enabled(component)[source]

Check to see if a component is enabled.

Parameters

component (callable) -- The component to check. The component must already be loaded.

Returns

True if the component is enabled. False otherwise.

insights.core.dr.is_hidden(component)[source]
insights.core.dr.load_components(*paths, **kwargs)[source]

Loads all components on the paths. Each path should be a package or module. All components beneath a path are loaded.

Parameters

paths (str) -- A package or module to load

Keyword Arguments
• include (str) -- A regular expression of packages and modules to include. Defaults to ‘.*’

• exclude (str) -- A regular expression of packges and modules to exclude. Defaults to ‘test’

• continue_on_error (bool) -- If True, continue importing even if something raises an ImportError. If False, raise the first ImportError.

Returns

The total number of modules loaded.

Return type

int

Raises

ImportError --

insights.core.dr.mark_hidden(component)[source]
insights.core.dr.observer(component_type=<class 'insights.core.dr.ComponentType'>)[source]

You can use @broker.observer() as a decorator to your callback instead of add_observer().

insights.core.dr.run(components=None, broker=None)[source]

Executes components in an order that satisfies their dependency relationships.

Keyword Arguments
• components -- Can be one of a dependency graph, a single component, a component group, or a component type. If it’s anything other than a dependency graph, the appropriate graph is built for you and before evaluation.

• broker (Broker) -- Optionally pass a broker to use for evaluation. One is created by default, but it’s often useful to seed a broker with an initial dependency.

Returns

The broker after evaluation.

Return type

Broker

insights.core.dr.run_all(components=None, broker=None, pool=None)[source]
insights.core.dr.run_incremental(components=None, broker=None)[source]

Executes components in an order that satisfies their dependency relationships. Disjoint subgraphs are executed one at a time and a broker containing the results for each is yielded. If a broker is passed here, its instances are used to seed the broker used to hold state for each sub graph.

Keyword Arguments
• components -- Can be one of a dependency graph, a single component, a component group, or a component type. If it’s anything other than a dependency graph, the appropriate graph is built for you and before evaluation.

• broker (Broker) -- Optionally pass a broker to use for evaluation. One is created by default, but it’s often useful to seed a broker with an initial dependency.

Yields

Broker -- the broker used to evaluate each subgraph.

insights.core.dr.run_order(graph)[source]

Returns components in an order that satisfies their dependency relationships.

insights.core.dr.set_enabled(component, enabled=True)[source]

Enable a component for evaluation. If set to False, the component is skipped, and all components that require it will not execute.

If component is a fully qualified name string of a callable object instead of the callable object itself, the component’s module is loaded as a side effect of calling this function.

Parameters
• component (str or callable) -- fully qualified name of the component or the component object itself.

• enabled (bool) -- whether the component is enabled for evaluation.

Returns

None

insights.core.dr.split_requirements(requires)[source]
insights.core.dr.stringify_requirements(requires)[source]
insights.core.dr.walk_dependencies(root, visitor)[source]

Call visitor on root and all dependencies reachable from it in breadth first order.

Parameters
• root (component) -- component function or class

• visitor (function) -- signature is func(component, parent). The call on root is visitor(root, None).

insights.core.dr.walk_tree(root, method=<function get_dependencies>)[source]
class insights.core.dr.ComponentType(*deps, **kwargs)[source]

ComponentType is the base class for all component type decorators.

For Example:

class my_component_type(ComponentType):
pass

@my_component_type(SshDConfig, InstalledRpms, [ChkConfig, UnitFiles], optional=[IPTables, IpAddr])
def my_func(sshd_config, installed_rpms, chk_config, unit_files, ip_tables, ip_addr):


Notice that the arguments to my_func correspond to the dependencies in the @my_component_type and are in the same order.

When used, a my_component_type instance is created whose __init__ gets passed dependencies and whose __call__ gets passed the component to run if dependencies are met.

Parameters to the decorator have these forms:

Criteria

Example Decorator Arguments

Description

Required

SshDConfig, InstalledRpms

A regular argument

At Least One

[ChkConfig, UnitFiles]

An argument as a list

Optional

optional=[IPTables, IpAddr]

A list following optional=

If a parameter is required, the value provided for it is guaranteed not to be None. In the example above, sshd_config and installed_rpms will not be None.

At least one of the arguments to parameters of an “at least one” list will not be None. In the example, either or both of chk_config and unit_files will not be None.

Any or all arguments for optional parameters may be None.

The following keyword arguments may be passed to the decorator:

requires

a list of components that all components decorated with this type will implicitly require. Additional components passed to the decorator will be appended to this list.

Type

list

optional

a list of components that all components decorated with this type will implicitly depend on optionally. Additional components passed as optional to the decorator will be appended to this list.

Type

list

metadata

an arbitrary dictionary of information to associate with the component you’re decorating. It can be retrieved with get_metadata.

Type

dict

tags

a list of strings that categorize the component. Useful for formatting output or sifting through results for components you care about.

Type

list

group

GROUPS.single or GROUPS.cluster. Used to organize components into “groups” that run together with insights.core.dr.run().

cluster

if True will put the component into the GROUPS.cluster group. Defaults to False. Overrides group if True.

Type

bool

get_missing_dependencies(broker)[source]

Gets required and at-least-one dependencies not provided by the broker.

invoke(results)[source]

Handles invocation of the component. The default implementation invokes it with positional arguments based on order of dependency declaration.

process(broker)[source]

Ensures dependencies have been met before delegating to self.invoke.

## insights.core.filters¶

The filters module allows developers to apply filters to datasources, by adding them directly or through dependent components like parsers and combiners. A filter is a simple string, and it matches if it is contained anywhere within a line.

If a datasource has filters defined, it will return only lines matching at least one of them. If a datasource has no filters, it will return all lines.

Filters can be added to components like parsers and combiners, to apply consistent filtering to multiple underlying datasources that are configured as filterable.

Filters aren’t applicable to “raw” datasources, which are created with kind=RawFileProvider and have RegistryPoint instances with raw=True.

The addition of a single filter can cause a datasource to change from returning all lines to returning just those that match. Therefore, any filtered datasource should have at least one filter in the commit introducing it so downstream components don’t inadvertently change its behavior.

The benefit of this fragility is the ability to drastically reduce in-memory footprint and archive sizes. An additional benefit is the ability to evaluate only lines known to be free of sensitive information.

Filters added to a RegistryPoint will be applied to all datasources that implement it. Filters added to a datasource implementation apply only to that implementation.

For example, a filter added to Specs.ps_auxww will apply to DefaultSpecs.ps_auxww, InsightsArchiveSpecs.ps_auxww, SosSpecs.ps_auxww, etc. But a filter added to DefaultSpecs.ps_auxww will only apply to DefaultSpecs.ps_auxww. See the modules in insights.specs for those classes.

Filtering can be disabled globally by setting the environment variable INSIGHTS_FILTERS_ENABLED=False. This means that no datasources will be filtered even if filters are defined for them.

insights.core.filters.add_filter(component, patterns)[source]

Add a filter or list of filters to a component. When the component is a datasource, the filter will be directly added to that datasouce. In cases when the component is a parser or combiner, the filter will be added to underlying filterable datasources by traversing dependency graph. A filter is a simple string, and it matches if it is contained anywhere within a line.

Parameters
• component (component) -- The component to filter, can be datasource, parser or combiner.

• patterns (str, [str]) -- A string, list of strings, or set of strings to add to the datasource’s filters.

insights.core.filters.apply_filters(target, lines)[source]

Applys filters to the lines of a datasource. This function is used only in integration tests. Filters are applied in an equivalent but more performant way at run time.

insights.core.filters.dump(stream=None)[source]

Dumps a string representation of FILTERS to a stream, normally an open file. If none is passed, FILTERS is dumped to a default location within the project.

insights.core.filters.dumps()[source]

Returns a string representation of the FILTERS dictionary.

insights.core.filters.get_filters(component)[source]

Get the set of filters for the given datasource.

Filters added to a RegistryPoint will be applied to all datasources that implement it. Filters added to a datasource implementation apply only to that implementation.

For example, a filter added to Specs.ps_auxww will apply to DefaultSpecs.ps_auxww, InsightsArchiveSpecs.ps_auxww, SosSpecs.ps_auxww, etc. But a filter added to DefaultSpecs.ps_auxww will only apply to DefaultSpecs.ps_auxww. See the modules in insights.specs for those classes.

Parameters

component (a datasource) -- The target datasource

Returns

The set of filters defined for the datasource

Return type

set

insights.core.filters.load(stream=None)[source]

Loads filters from a stream, normally an open file. If one is not passed, filters are loaded from a default location within the project.

insights.core.filters.loads(string)[source]

Loads the filters dictionary given a string.

## insights.core.plugins¶

The plugins module defines the components used by the rest of insights and specializes their interfaces and execution model where required.

This module includes the following CompoentType subclasses:

It also contains the following Response subclasses that rules may return:

exception insights.core.plugins.ContentException[source]

Raised whenever a datasource fails to get data.

class insights.core.plugins.PluginType(*deps, **kwargs)[source]

PluginType is the base class of plugin types like datasource, rule, etc. It provides a default invoke method that catches exceptions we don’t want bubbling to the top of the evaluation loop. These exceptions are commonly raised by datasource components but could be in the context of any component since most datasource runtime errors are lazy.

It’s possible for a datasource to “succeed” and return an object but for an exception to be raised when the parser tries to access the content of that object. For example, when a command datasource is evaluated, it only checks that the command exists and is executable. Invocation of the command itself is delayed until the parser asks for its value. This helps with performance and memory consumption.

invoke(broker)[source]

Handles invocation of the component. The default implementation invokes it with positional arguments based on order of dependency declaration.

class insights.core.plugins.Response(key, **kwargs)[source]

Bases: dict

Response is the base class of response types that can be returned from rules.

Subclasses must call __init__ of this class via super() and must provide the response_type class attribute.

The key_name class attribute is optional, but if one is specified, the first argument to __init__ must not be None. If key_name is None, then the first argument to __init__ should be None. It’s best to override __init__ in subclasses so users aren’t required to pass None explicitly.

adjust_for_length(key, r, kwargs)[source]

Converts the response to a string and compares its length to a max length specified in settings. If the response is too long, an error is logged, and an abbreviated response is returned instead.

get_key()[source]

Helper function that uses the response’s key_name to look up the response identifier. For a rule, this is like response.get(“error_key”).

key_name = None

key_name is something like ‘error_key’, ‘fingerprint_key’, etc. It is the key downstream systems use to look up the exact response returned by a rule.

response_type = None

response_type is something like ‘rule’, ‘metadata’, ‘fingerprint’, etc. It is how downstream systems identify the type of information returned by a rule.

validate_key(key)[source]

Called if the key_name class attribute is not None.

validate_kwargs(kwargs)[source]

Validates expected subclass attributes and constructor keyword arguments.

exception insights.core.plugins.ValidationException(msg, r=None)[source]

Bases: Exception

class insights.core.plugins.combiner(*deps, **kwargs)[source]

A decorator for a component that composes or “combines” other components.

A typical use case is hiding slight variations in related parser interfaces. Another use case is to combine several related parsers behind a single, cohesive, higher level interface.

class insights.core.plugins.component(*deps, **kwargs)[source]
class insights.core.plugins.condition(*deps, **kwargs)[source]

ComponentType used to encapsulate boolean logic you’d like to have analyzed by a rule analysis system. Conditions should return truthy values. None is also a valid return type for conditions, so rules that depend on conditions that might return None should check their validity.

class insights.core.plugins.datasource(*deps, **kwargs)[source]

Decorates a component that one or more insights.core.Parser subclasses will consume.

filterable = False
invoke(broker)[source]

Handles invocation of the component. The default implementation invokes it with positional arguments based on order of dependency declaration.

multi_output = False
raw = False
class insights.core.plugins.fact(*deps, **kwargs)[source]

ComponentType for a component that surfaces a dictionary or list of dictionaries that will be used later by cluster rules. The data from a fact is converted to a pandas Dataframe

class insights.core.plugins.incident(*deps, **kwargs)[source]

ComponentType for a component used by rules that allows automated statistical analysis.

insights.core.plugins.is_combiner(component)[source]
insights.core.plugins.is_component(obj)[source]
insights.core.plugins.is_datasource(component)[source]
insights.core.plugins.is_parser(component)[source]
insights.core.plugins.is_rule(component)[source]
insights.core.plugins.is_type(component, _type)[source]
class insights.core.plugins.make_fail(key, **kwargs)[source]

Returned by a rule to signal that its conditions have been met.

Example:

# completely made up package
buggy = InstalledRpms.from_package("bash-3.4.23-1.el7")

@rule(InstalledRpms)
def report(installed_rpms):
if bash == buggy:
return make_fail("BASH_BUG_123", bash=bash)
return make_pass("BASH", bash=bash)

class insights.core.plugins.make_fingerprint(key, **kwargs)[source]
key_name = 'fingerprint_key'
response_type = 'fingerprint'
class insights.core.plugins.make_info(key, **kwargs)[source]

Returned by a rule to surface information about a system.

Example:

@rule(InstalledRpms)
def report(rpms):
return make_info("BASH_VERSION", bash=bash.nvra)

key_name = 'info_key'
response_type = 'info'
class insights.core.plugins.make_metadata(**kwargs)[source]

Allows a rule to convey addtional metadata about a system to downstream systems. It doesn’t convey success or failure but purely information that may be aggregated with other make_metadata responses. As such, it has no response key.

response_type = 'metadata'
class insights.core.plugins.make_metadata_key(key, value)[source]
adjust_for_length(key, r, kwargs)[source]

Converts the response to a string and compares its length to a max length specified in settings. If the response is too long, an error is logged, and an abbreviated response is returned instead.

key_name = 'key'
response_type = 'metadata_key'
class insights.core.plugins.make_pass(key, **kwargs)[source]

Returned by a rule to signal that its conditions explicitly have not been met. In other words, the rule has all of the information it needs to determine that the system it’s analyzing is not in the state the rule was meant to catch.

An example rule might check whether a system is vulnerable to a well defined exploit or has a bug in a specific version of a package. If it can say for sure “the system does not have this exploit” or “the system does not have the buggy version of the package installed”, then it should return an instance of make_pass.

Example:

# completely made up package
buggy = InstalledRpms.from_package("bash-3.4.23-1.el7")

@rule(InstalledRpms)
def report(installed_rpms):
if bash == buggy:
return make_fail("BASH_BUG_123", bash=bash)
return make_pass("BASH", bash=bash)

key_name = 'pass_key'
response_type = 'pass'
class insights.core.plugins.make_response(key, **kwargs)[source]

Returned by a rule to signal that its conditions have been met.

Example:

# completely made up package
buggy = InstalledRpms.from_package("bash-3.4.23-1.el7")

@rule(InstalledRpms)
def report(installed_rpms):
if bash == buggy:
return make_response("BASH_BUG_123", bash=bash)
return make_pass("BASH", bash=bash)


Deprecated since version Use: make_fail instead.

key_name = 'error_key'
response_type = 'rule'
class insights.core.plugins.metadata(*args, **kwargs)[source]

Used for old cluster uber-archives.

Deprecated since version 1.x.

Warning

Do not use this component type.

requires = ['metadata.json']
class insights.core.plugins.parser(*args, **kwargs)[source]

Decorates a component responsible for parsing the output of a datasource. @parser should accept multiple arguments, the first will ALWAYS be the datasource the parser component should handle. Any subsequent argument will be a component used to determine if the parser should fire. @parser should only decorate subclasses of insights.core.Parser.

Warning

If a Parser component handles a datasource that returns a list, a Parser instance will be created for each element of the list. Combiners or rules that depend on the Parser will be passed the list of instances and not a single parser instance. By default, if any parser in the list succeeds, those parsers are passed on to dependents, even if others fail. If all parsers should succeed or fail together, pass continue_on_error=False.

invoke(broker)[source]

Handles invocation of the component. The default implementation invokes it with positional arguments based on order of dependency declaration.

class insights.core.plugins.remoteresource(*deps, **kwargs)[source]

ComponentType for a component for remote web resources.

class insights.core.plugins.rule(*args, **kwargs)[source]

Decorator for components that encapsulate some logic that depends on the data model of a system. Rules can depend on datasource instances, parser instances, combiner instances, or anything else.

For example:

@rule(SshDConfig, InstalledRpms, [ChkConfig, UnitFiles], optional=[IPTables, IpAddr])
def report(sshd_config, installed_rpms, chk_config, unit_files, ip_tables, ip_addr):
# ...
# ... some complicated logic
# ...
return make_pass("BASH", bash=bash)


Notice that the arguments to report correspond to the dependencies in the @rule decorator and are in the same order.

Parameters to the decorator have these forms:

Criteria

Example Decorator Arguments

Description

Required

SshDConfig, InstalledRpms

Regular arguments

At Least One

[ChkConfig, UnitFiles]

An argument as a list

Optional

optional=[IPTables, IpAddr]

A list following optional=

If a parameter is required, the value provided for it is guaranteed not to be None. In the example above, sshd_config and installed_rpms will not be None.

At least one of the arguments to parameters of an “at least one” list will not be None. In the example, either or both of chk_config and unit_files will not be None.

Any or all arguments for optional parameters may be None.

The following keyword arguments may be passed to the decorator:

Keyword Arguments
• requires (list) -- a list of components that all components decorated with this type will require. Instead of using requires=[...], just pass dependencies as variable arguments to @rule as in the example above.

• optional (list) -- a list of components that all components decorated with this type will implicitly depend on optionally. Additional components passed as optional to the decorator will be appended to this list.

• metadata (dict) -- an arbitrary dictionary of information to associate with the component you’re decorating. It can be retrieved with get_metadata.

• tags (list) -- a list of strings that categorize the component. Useful for formatting output or sifting through results for components you care about.

• group -- GROUPS.single or GROUPS.cluster. Used to organize components into “groups” that run together with insights.core.dr.run().

• cluster (bool) -- if True will put the component into the GROUPS.cluster group. Defaults to False. Overrides group if True.

• content (string or dict) -- a jinja2 template or dictionary of jinja2 templates. The Response subclasses rules can return are dictionaries. make_pass, make_fail, and make_response all accept first a key and then a list of arbitrary keyword arguments. If content is a dictionary, the key is used to look up the template that the rest of the keyword argments will be interpolated into. If content is a string, then it is used for all return values of the rule. If content isn’t defined but a CONTENT variable is declared in the module, it will be used for every rule in the module and also can be a string or list of dictionaries

• links (dict) -- a dictionary with strings as keys and lists of urls as values. The keys categorize the urls, e.g. “kcs” for kcs urls and “bugzilla” for bugzilla urls.

content = None
process(broker)[source]

Ensures dependencies have been met before delegating to self.invoke.

## insights.core.remote_resource¶

class insights.core.remote_resource.CachedRemoteResource[source]

RemoteResource subclass that sets up caching for subsequent Web resource requests.

Examples

>>> from insights.core.remote_resource import CachedRemoteResource
>>> crr = CachedRemoteResource()
>>> print (rtn.content)

backend = 'DictCache'

Type of storage for cache DictCache1, FileCache or RedisCache

Type

str

expire_after = 180

Amount of time in seconds that the cache will expire

Type

float

file_cache_path = '.web_cache'

Path to where file cache will be stored if FileCache backend is specified

Type

str

redis_host = 'localhost'

Hostname of redis instance if RedisCache backend is specified

Type

str

redis_port = 6379

Port used to contact the redis instance if RedisCache backend is specified

Type

int

class insights.core.remote_resource.DefaultHeuristic(expire_after)[source]

Bases: cachecontrol.heuristics.BaseHeuristic

BaseHeuristic subclass that sets the default caching headers if not supplied by the remote service.

default_cache_vars = 'Remote service caching headers not set correctly, using default caching'

Message content warning that the response from the remote server did not return proper HTTP cache headers so we will use default cache settings

Type

str

server_cache_headers = 'Caching being done based on caching headers returned by remote service'

Message content warning that we are using cache settings returned by the remote server.

Type

str

update_headers(response)[source]

Parameters

response (HttpResponse) -- The response from the remote service

Returns

Return type

response

warning(response)[source]

The response is provided too allow warnings like 113 http://tools.ietf.org/html/rfc7234#section-5.5.4 where we need to explicitly say response is over 24 hours old.

class insights.core.remote_resource.RemoteResource(session=None)[source]

Bases: object

RemoteResource class for accessing external Web resources.

Examples

>>> from insights.core.remote_resource import RemoteResource
>>> rr = RemoteResource()
>>> print (rtn.content)

get(url, params={}, headers={}, auth=(), certificate_path=None)[source]

Returns the response payload from the request to the given URL.

Parameters
• url (str) -- The URL for the WEB API that the request is being made too.

• params (dict) -- Dictionary containing the query string parameters.

• headers (dict) -- HTTP Headers that may be needed for the request.

• auth (tuple) -- User ID and password for Basic Auth

• certificate_path (str) -- Path to the ssl certificate.

Returns

(HttpResponse): Response object from requests.get api request

Return type

response

timeout = 10

Time in seconds for the requests.get api call to wait before returning a timeout exception

Type

float

## insights.core.spec_factory¶

class insights.core.spec_factory.CommandOutputProvider(cmd, ctx, args=None, split=True, keep_rc=False, ds=None, timeout=None, inherit_env=None, signum=None)[source]

Class used in datasources to return output from commands.

create_args()[source]
create_env()[source]
load()[source]
validate()[source]
write(dst)[source]
class insights.core.spec_factory.ContentProvider[source]

Bases: object

property content
load()[source]
property path
stream()[source]

Returns a generator of lines instead of a list of lines.

class insights.core.spec_factory.DatasourceProvider(content, relative_path, root='/', ds=None, ctx=None)[source]
load()[source]
write(dst)[source]
class insights.core.spec_factory.FileProvider(relative_path, root='/', ds=None, ctx=None)[source]
validate()[source]
class insights.core.spec_factory.RawFileProvider(relative_path, root='/', ds=None, ctx=None)[source]

Class used in datasources that returns the contents of a file a single string. The file is not filtered.

load()[source]
write(dst)[source]
class insights.core.spec_factory.RegistryPoint(metadata=None, multi_output=False, raw=False, filterable=False)[source]

Bases: object

insights.core.spec_factory.SAFE_ENV = {'LANG': 'C.UTF-8', 'LC_ALL': 'C', 'PATH': '/bin:/usr/bin:/sbin:/usr/sbin:/usr/share/Modules/bin'}

A minimal set of environment variables for use in subprocess calls

class insights.core.spec_factory.SerializedOutputProvider(relative_path, root='/', ds=None, ctx=None)[source]
create_args()[source]
class insights.core.spec_factory.SerializedRawOutputProvider(relative_path, root='/', ds=None, ctx=None)[source]
class insights.core.spec_factory.SpecDescriptor(func)[source]

Bases: object

class insights.core.spec_factory.SpecSet[source]

Bases: object

The base class for all spec declarations. Extend this class and define your datasources directly or with a SpecFactory.

context_handlers = {}
registry = {}
class insights.core.spec_factory.SpecSetMeta(name, bases, dct)[source]

Bases: type

The metaclass that converts RegistryPoint markers to registry point datasources and hooks implementations for them into the registry.

class insights.core.spec_factory.TextFileProvider(relative_path, root='/', ds=None, ctx=None)[source]

Class used in datasources that returns the contents of a file a list of lines. Each line is filtered if filters are defined for the datasource.

create_args()[source]
load()[source]
write(dst)[source]
class insights.core.spec_factory.command_with_args(cmd, provider, context=<class 'insights.core.context.HostContext'>, deps=None, split=True, keep_rc=False, timeout=None, inherit_env=None, signum=None, **kwargs)[source]

Bases: object

Execute a command that has dynamic arguments

Parameters
• cmd (str) -- the command to execute. Breaking apart a command string that might require arguments.

• provider (str or tuple) -- argument string or a tuple of argument strings.

• context (ExecutionContext) -- the context under which the datasource should run.

• split (bool) -- whether the output of the command should be split into a list of lines

• keep_rc (bool) -- whether to return the error code returned by the process executing the command. If False, any return code other than zero with raise a CalledProcessError. If True, the return code and output are always returned.

• timeout (int) -- Number of seconds to wait for the command to complete. If the timeout is reached before the command returns, a CalledProcessError is raised. If None, timeout is infinite.

• inherit_env (list) -- The list of environment variables to inherit from the calling process when the command is invoked.

Returns

A datasource that returns the output of a command that takes

specified arguments passed by the provider.

Return type

function

insights.core.spec_factory.deserialize_command_output(_type, data, root)[source]
insights.core.spec_factory.deserialize_datasource_provider(_type, data, root)[source]
insights.core.spec_factory.deserialize_raw_file_provider(_type, data, root)[source]
insights.core.spec_factory.deserialize_text_provider(_type, data, root)[source]
insights.core.spec_factory.enc(s)[source]
insights.core.spec_factory.escape(s)[source]
class insights.core.spec_factory.find(spec, pattern)[source]

Bases: object

Helper class for extracting specific lines from a datasource for direct consumption by a rule.

service_starts = find(Specs.audit_log, "SERVICE_START")

@rule(service_starts)
def report(starts):
return make_info("SERVICE_STARTS", num_starts=len(starts))

Parameters
• spec (datasource) -- some datasource, ideally filterable.

• pattern (string / list) -- a string or list of strings to match (no patterns supported)

Returns

A dict where each key is a command, path, or spec name, and each value is a non-empty list of matching lines. Only paths with matching lines are included.

Raises

dr.SkipComponent if no paths have matching lines. --

class insights.core.spec_factory.first_file(paths, context=None, deps=[], kind=<class 'insights.core.spec_factory.TextFileProvider'>, **kwargs)[source]

Bases: object

Creates a datasource that returns the first existing and readable file in files.

Parameters
• files (str) -- list of paths to find and read

• context (ExecutionContext) -- the context under which the datasource should run.

• kind (FileProvider) -- One of TextFileProvider or RawFileProvider.

Returns

A datasource that returns the first file in files that exists

Return type

function

class insights.core.spec_factory.first_of(deps)[source]

Bases: object

Given a list of dependencies, returns the first of the list that exists in the broker. At least one must be present, or this component won’t fire.

class insights.core.spec_factory.foreach_collect(provider, path, ignore=None, context=<class 'insights.core.context.HostContext'>, deps=[], kind=<class 'insights.core.spec_factory.TextFileProvider'>, **kwargs)[source]

Bases: object

Subtitutes each element in provider into path and collects the files at the resulting paths.

Parameters
• provider (list) -- a list of elements or tuples.

• path (str) -- a path template with substitution parameters.

• context (ExecutionContext) -- the context under which the datasource should run.

• kind (FileProvider) -- one of TextFileProvider or RawFileProvider

Returns

A datasource that returns a list of file contents created by

substituting each element of provider into the path template.

Return type

function

class insights.core.spec_factory.foreach_execute(provider, cmd, context=<class 'insights.core.context.HostContext'>, deps=[], split=True, keep_rc=False, timeout=None, inherit_env=[], signum=None, **kwargs)[source]

Bases: object

Execute a command for each element in provider. Provider is the output of a different datasource that returns a list of single elements or a list of tuples. The command should have %s substitution parameters equal to the number of elements in each tuple of the provider.

Parameters
• provider (list) -- a list of elements or tuples.

• cmd (str) -- a command with substitution parameters. Breaking apart a command string that might contain multiple commands separated by a pipe, getting them ready for subproc operations. IE. A command with filters applied

• context (ExecutionContext) -- the context under which the datasource should run.

• split (bool) -- whether the output of the command should be split into a list of lines

• keep_rc (bool) -- whether to return the error code returned by the process executing the command. If False, any return code other than zero with raise a CalledProcessError. If True, the return code and output are always returned.

• timeout (int) -- Number of seconds to wait for the command to complete. If the timeout is reached before the command returns, a CalledProcessError is raised. If None, timeout is infinite.

• inherit_env (list) -- The list of environment variables to inherit from the calling process when the command is invoked.

Returns

A datasource that returns a list of outputs for each command

created by substituting each element of provider into the cmd template.

Return type

function

class insights.core.spec_factory.glob_file(patterns, ignore=None, context=None, deps=[], kind=<class 'insights.core.spec_factory.TextFileProvider'>, max_files=1000, **kwargs)[source]

Bases: object

Creates a datasource that reads all files matching the glob pattern(s).

Parameters
• patterns (str or [str]) -- glob pattern(s) of paths to read.

• ignore (regex) -- a regular expression that is used to filter the paths matched by pattern(s).

• context (ExecutionContext) -- the context under which the datasource should run.

• kind (FileProvider) -- One of TextFileProvider or RawFileProvider.

• max_files (int) -- Maximum number of glob files to process.

Returns

A datasource that reads all files matching the glob patterns.

Return type

function

class insights.core.spec_factory.head(dep, **kwargs)[source]

Bases: object

Return the first element of any datasource that produces a list.

class insights.core.spec_factory.listdir(path, context=None, ignore=None, deps=[])[source]

Bases: object

Execute a simple directory listing of all the files and directories in path.

Parameters
• path (str) -- directory or glob pattern to list.

• context (ExecutionContext) -- the context under which the datasource should run.

• ignore (str) -- regular expression defining paths to ignore.

Returns

A datasource that returns the list of files and directories

in the directory specified by path

Return type

function

insights.core.spec_factory.mangle_command(command, name_max=255)[source]

Mangle a command line string into something suitable for use as the basename of a filename. At minimum this function must remove slashes, but it also does other things to clean the basename: removing directory names from the command name, replacing many non- characters with undersores, in addition to replacing slashes with dots.

By default, curly braces, ‘{‘ and ‘}’, are replaced with underscore, set ‘has_variables’ to leave curly braces alone.

This function was copied from the function that insights-client uses to create the name it to capture the output of the command.

Here, server side, it is used to figure out what file in the archive contains the output a command. Server side, the command may contain references to variables (names matching curly braces) that will be expanded before the name is actually used as a file name.

To completly mimic the insights-client behavior, curly braces need to be replaced underscores. If the command has variable references, the curly braces must be left alone. Set has_variables, to leave curly braces alone.

This implementation of ‘has_variables’ assumes that variable names only contain that are not replaced by mangle_command.

insights.core.spec_factory.serialize_command_output(obj, root)[source]
insights.core.spec_factory.serialize_datasource_provider(obj, root)[source]
insights.core.spec_factory.serialize_raw_file_provider(obj, root)[source]
insights.core.spec_factory.serialize_text_file_provider(obj, root)[source]
class insights.core.spec_factory.simple_command(cmd, context=<class 'insights.core.context.HostContext'>, deps=[], split=True, keep_rc=False, timeout=None, inherit_env=[], signum=None, **kwargs)[source]

Bases: object

Execute a simple command that has no dynamic arguments

Parameters
• cmd (str) -- the command(s) to execute. Breaking apart a command string that might contain multiple commands separated by a pipe, getting them ready for subproc operations. IE. A command with filters applied

• context (ExecutionContext) -- the context under which the datasource should run.

• split (bool) -- whether the output of the command should be split into a list of lines

• keep_rc (bool) -- whether to return the error code returned by the process executing the command. If False, any return code other than zero with raise a CalledProcessError. If True, the return code and output are always returned.

• timeout (int) -- Number of seconds to wait for the command to complete. If the timeout is reached before the command returns, a CalledProcessError is raised. If None, timeout is infinite.

• inherit_env (list) -- The list of environment variables to inherit from the calling process when the command is invoked.

Returns

A datasource that returns the output of a command that takes

no arguments

Return type

function

class insights.core.spec_factory.simple_file(path, context=None, deps=[], kind=<class 'insights.core.spec_factory.TextFileProvider'>, **kwargs)[source]

Bases: object

Creates a datasource that reads the file at path when evaluated.

Parameters
• path (str) -- path to the file to read

• context (ExecutionContext) -- the context under which the datasource should run.

• kind (FileProvider) -- One of TextFileProvider or RawFileProvider.

Returns

A datasource that reads all files matching the glob patterns.

Return type

function

## insights.core.taglang¶

Simple language for defining predicates against a list or set of strings.

Operator Precedence:
• ! high - opposite truth value of its predicate

• / high - starts a regex that continues until whitespace unless quoted

• & medium - “and” of two predicates

• | low - “or” of two predicates

• , low - “or” of two predicates. Synonym for |.

It supports grouping with parentheses and quoted strings/regexes surrounded with either single or double quotes.

Examples

>>> pred = parse("a | b & !c")  # means (a or (b and (not c)))
>>> pred(["a"])
True
>>> pred(["b"])
True
>>> pred(["b", "c"])
False
>>> pred = parse("/net | apache")
>>> pred(["networking"])
True
>>> pred(["mynetwork"])
True
>>> pred(["apache"])
True
>>> pred(["security"])
False
>>> pred = parse("(a | b) & c")
>>> pred(["a", "c"])
True
>>> pred(["b", "c"])
True
>>> pred(["a"])
False
>>> pred(["b"])
False
>>> pred(["c"])
False


Regular expressions start with a forward slash / and continue until whitespace unless they are quoted with either single or double quotes. This means that they can consume what would normally be considered an operator or a closing parenthesis if you aren’t careful.

For example, this is a parse error because the regex consumes the comma:
>>> pred = parse("/net, apache")
Exception

>>> pred = parse("/net , apache")

or this:
>>> pred = parse("/net | apache")

or this:
>>> pred = parse("'/net', apache")

class insights.core.taglang.And(left, right)[source]

The values must satisfy both the left and the right condition.

test(value)[source]
class insights.core.taglang.Eq(value)[source]

The value must be in the set of values.

test(values)[source]
class insights.core.taglang.Not(pred)[source]

The values must not satisfy the wrapped condition.

test(value)[source]
class insights.core.taglang.Or(left, right)[source]

The values must satisfy either the left or the right condition.

test(value)[source]
class insights.core.taglang.Predicate[source]

Bases: object

Provides __call__ for invoking the Predicate like a function without having to explictly call its test method.

class insights.core.taglang.Regex(value)[source]

The regex must match at least one of the values.

test(values)[source]
insights.core.taglang.negate(args)[source]
insights.core.taglang.oper(args)[source]

## insights.parsers¶

exception insights.parsers.ParseException[source]

Bases: Exception

Exception that should be thrown from parsers that encounter exceptions they recognize while parsing. When this exception is thrown, the exception message and data are logged and no parser output data is saved.

exception insights.parsers.SkipException[source]

Exception that should be thrown from parsers that are explicitly written to look for errors in input data. If the expected error is not found then the parser should throw this exception to signal to the infrastructure that the parser’s output should not be retained.

insights.parsers.calc_offset(lines, target, invert_search=False)[source]

Function to search for a line in a list starting with a target string. If target is None or an empty string then 0 is returned. This allows checking target here instead of having to check for an empty target in the calling function. Each line is stripped of leading spaces prior to comparison with each target however target is not stripped. See parse_fixed_table in this module for sample usage.

Parameters
• lines (list) -- List of strings.

• target (list) -- List of strings to search for at the beginning of any line in lines.

• invert_search (boolean) -- If True this flag causes the search to continue until the first line is found not matching anything in target. An empty line is implicitly included in target. Default is False. This would typically be used if trimming trailing lines off of a file by passing reversed(lines) as the lines argument.

Returns

index into the lines indicating the location of target. If target is None or an empty string 0 is returned as the offset. If invert_search is True the index returned will point to the line after the last target was found.

Return type

int

Raises

ValueError -- Exception is raised if target string is specified and it was not found in the input lines.

Examples

>>> lines = [
... '#   ',
... 'Warning line',
... 'Error line',
... '    data 1 line',
... '    data 2 line']
>>> target = ['data']
>>> calc_offset(lines, target)
3
>>> target = ['#', 'Warning', 'Error']
>>> calc_offset(lines, target, invert_search=True)
3

insights.parsers.get_active_lines(lines, comment_char='#')[source]

Returns lines, or parts of lines, from content that are not commented out or completely empty. The resulting lines are all individually stripped.

This is useful for parsing many config files such as ifcfg.

Parameters
• lines (list) -- List of strings to parse.

• comment_char (str) -- String indicating that all chars following are part of a comment and will be removed from the output.

Returns

List of valid lines remaining in the input.

Return type

list

Examples

>>> lines = [
... 'First line',
... '   ',
... '# Comment line',
... 'Inline comment # comment',
... '          Whitespace          ',
... 'Last line']
>>> get_active_lines(lines)
['First line', 'Inline comment', 'Whitespace', 'Last line']


Takes a list of dictionaries and finds all the dictionaries where the keys and values match those found in the keyword arguments.

Keys in the row data have ‘ ‘ and ‘-‘ replaced with ‘_’, so they can match the keyword argument parsing. For example, the keyword argument ‘fix_up_path’ will match a key named ‘fix-up path’.

In addition, several suffixes can be added to the key name to do partial matching of values:

• ‘__contains’ will test whether the data value contains the given value.

• ‘__startswith’ tests if the data value starts with the given value

• ‘__lower_value’ compares the lower-case version of the data and given values.

Parameters
• rows (list) -- A list of dictionaries representing the data to be searched.

• **kwargs (dict) -- keyword-value pairs corresponding to the fields that need to be found and their required values in the data rows.

Returns

The list of rows that match the search keywords. If no keyword arguments are given, no rows are returned.

Return type

(list)

Examples

>>> rows = [
...     {'domain': 'oracle', 'type': 'soft', 'item': 'nofile', 'value': 1024},
...     {'domain': 'oracle', 'type': 'hard', 'item': 'nofile', 'value': 65536},
...     {'domain': 'oracle', 'type': 'soft', 'item': 'stack', 'value': 10240},
...     {'domain': 'oracle', 'type': 'hard', 'item': 'stack', 'value': 3276},
...     {'domain': 'root', 'type': 'soft', 'item': 'nproc', 'value': -1}]
...
>>> keyword_search(rows, domain='root')
[{'domain': 'root', 'type': 'soft', 'item': 'nproc', 'value': -1}]
>>> keyword_search(rows, item__contains='c')
[{'domain': 'oracle', 'type': 'soft', 'item': 'stack', 'value': 10240},
{'domain': 'oracle', 'type': 'hard', 'item': 'stack', 'value': 3276},
{'domain': 'root', 'type': 'soft', 'item': 'nproc', 'value': -1}]
>>> keyword_search(rows, domain__startswith='r')
[{'domain': 'root', 'type': 'soft', 'item': 'nproc', 'value': -1}]

insights.parsers.optlist_to_dict(optlist, opt_sep=',', kv_sep='=', strip_quotes=False)[source]

Parse an option list into a dictionary.

Takes a list of options separated by opt_sep and places them into a dictionary with the default value of True. If kv_sep option is specified then key/value options key=value are parsed. Useful for parsing options such as mount options in the format rw,ro,rsize=32168,xyz.

Parameters
• optlist (str) -- String of options to parse.

• opt_sep (str) -- Separater used to split options.

• kv_sep (str) -- If not None then optlist includes key=value pairs to be split, and this str is used to split them.

• strip_quotes (bool) -- If set, will remove matching ‘”’ and ‘”’ characters from start and end of line. No quotes are removed from inside the string and mismatched quotes are not removed.

Returns

Returns a dictionary of names present in the list. If kv_sep is not None then the values will be the str on the right-hand side of kv_sep. If kv_sep is None then each key will have a default value of True.

Return type

dict

Examples

>>> optlist = 'rw,ro,rsize=32168,xyz'
>>> optlist_to_dict(optlist)
{'rw': True, 'ro': True, 'rsize': '32168', 'xyz': True}

insights.parsers.parse_delimited_table(table_lines, delim=None, max_splits=- 1, strip=True, header_delim='same as delimiter', heading_ignore=None, header_substitute=None, trailing_ignore=None, raw_line_key=None)[source]

Parses table-like text. Uses the first (non-ignored) row as the list of column names, which cannot contain the delimiter. Fields cannot contain the delimiter but can be blank if a printable delimiter is used.

Parameters
• table_lines (list) -- List of strings with the first line containing column headings separated by spaces, and the remaining lines containing table data.

• delim (str) -- String used in the content to separate fields. If left as None (the default), white space is used as the field separator.

• max_splits (int) -- Maximum number of fields to create by splitting the line. After this number of fields has been found, the rest of the line is left un-split and may contain the delimiter. Lines may contain less than this number of fields.

• strip (bool) -- If set to True, fields and headings will be stripped of leading and trailing space. If set to False, fields and headings will be left as is. The delimiter is always removed, so strip need not be set if delim is set to None (but will not change output in that case).

• header_delim (str) -- When set, uses a different delimiter to the content for splitting the header into keywords. Set to None, this will split on white space. When left at the special value of ‘same as delimiter’, the content delimiter will be used to split the header line as well.

• heading_ignore (list) -- Optional list of strings to search for at beginning of line. All lines before this line will be ignored. If specified then it must be present in the file or ValueError will be raised.

• header_substitute (list) -- Optional list of tuples containing (old_string_value, new_string_value) to be used to modify header values. If whitespace is present in a column it must be replaced with non-whitespace characters in order for the table to be parsed correctly.

• trailing_ignore (list) -- Optional list of strings to look for at the end rows of the content. Lines starting with these strings will be ignored, thereby truncating the rows of data.

• raw_line_key (str) -- Key under which to save the raw line. If None, line is not saved.

Returns

Returns a list of dictionaries for each row of column data, keyed on the column headings in the same case as input.

Return type

list

insights.parsers.parse_fixed_table(table_lines, heading_ignore=[], header_substitute=[], trailing_ignore=[], empty_exception=False)[source]

Function to parse table data containing column headings in the first row and data in fixed positions in each remaining row of table data. Table columns must not contain spaces within the column name. Column headings are assumed to be left justified and the column data width is the width of the heading label plus all whitespace to the right of the label. This function will remove all blank rows in data but it will handle blank columns if some of the columns aren’t empty.

Parameters
• table_lines (list) -- List of strings with the first line containing column headings separated by spaces, and the remaining lines containing table data in left justified format.

• heading_ignore (list) -- Optional list of strings to search for at beginning of line. All lines before this line will be ignored. If specified then it must be present in the file or ValueError will be raised.

• header_substitute (list) -- Optional list of tuples containing (old_string_value, new_string_value) to be used to modify header values. If whitespace is present in a column it must be replaced with non-whitespace characters in order for the table to be parsed correctly.

• trailing_ignore (list) -- Optional list of strings to look for at the end rows of the content. Lines starting with these strings will be ignored, thereby truncating the rows of data.

• empty_exception (bool) -- If True, raise a ParseException when the value if empty. False by default.

Returns

Returns a list of dict for each row of column data. Dict keys

are the column headings in the same case as input.

Return type

list

Raises

• ParseException -- Raised if there are empty values when empty_exception is True

Sample input:

Column1    Column2    Column3
data1      data 2     data   3
data4      data5      data6


Examples

>>> table_data = parse_fixed_table(table_lines)
>>> table_data
[{'Column1': 'data1', 'Column2': 'data 2', 'Column3': 'data   3'},
{'Column1': 'data4', 'Column2': 'data5', 'Column3': 'data6'}]

insights.parsers.split_kv_pairs(lines, comment_char='#', filter_string=None, split_on='=', use_partition=False, ordered=False)[source]

Split lines of a list into key/value pairs

Use this function to filter and split all lines of a list of strings into a dictionary. Named arguments may be used to control how the line is split, how lines are filtered and the type of output returned. See parameters for more information. When splitting key/value, the first occurence of the split character is used, other occurrences of the split char in the line will be ignored. :get_active_lines() is called to strip comments and blank lines from the data.

Parameters
• lines (list of str) -- List of the strings to be split.

• comment_char (str) -- Char that when present in the line indicates all following chars are part of a comment. If this is present, all comments and all blank lines are removed from list before further processing. The default comment char is the # character.

• filter_string (str) -- If the filter string is present, then only lines containing the filter will be processed, other lines will be ignored.

• split_on (str) -- Character to use when splitting a line. Only the first occurence of the char is used when splitting, so only one split is performed at the first occurrence of split_on. The default string is =.

• use_partition (bool) -- If this parameter is True then the python partition function will be used to split the line. If False then the pyton split function will be used. The difference is that when False, if the split character is not present in the line then the line is ignored and when True the line will be parsed regardless. Set use_partition to True if you have valid lines that do not contain the split_on character. Set use_partition to False if you want to ignore lines that do not contain the split_on character. The default value is False.

• ordered (bool) -- If this parameter is True then the resulting dictionary will be in the same order as in the original file, a python OrderedDict type is used. If this parameter is False then the resulting dictionary is in no particular order, a base python dict type is used. The default is False.

Returns

Return value is a dictionary of the key/value pairs. If parameter keyword is True then an OrderedDict is returned, otherwise a dict is returned.

Return type

dict

Examples

>>> from .. import split_kv_pairs
>>> for line in lines:
...     print line
# Comment line
# Blank lines will also be removed
keyword1 = value1   # Inline comments
keyword2 = value2a=True, value2b=100M
keyword3     # Key with no separator
>>> split_kv_pairs(lines)
{'keyword2': 'value2a=True, value2b=100M', 'keyword1': 'value1'}
>>> split_kv_pairs(lines, comment_char='#')
{'keyword2': 'value2a=True, value2b=100M', 'keyword1': 'value1'}
>>> split_kv_pairs(lines, filter_string='keyword2')
{'keyword2': 'value2a=True, value2b=100M'}
>>> split_kv_pairs(lines, use_partition=True)
{'keyword3': '', 'keyword2': 'value2a=True, value2b=100M', 'keyword1': 'value1'}
>>> split_kv_pairs(lines, use_partition=True, ordered=True)
OrderedDict([('keyword1', 'value1'), ('keyword2', 'value2a=True, value2b=100M'), ('keyword3', '')])

insights.parsers.unsplit_lines(lines, cont_char='\\', keep_cont_char=False)[source]

Recombine lines having a continuation character at end.

Generator that recombines lines in the list that have the char cont_char at the end of a line. If cont_char is found in a line then then next line will be appended to the current line, this will continue for multiple continuation lines until the next line is found with no continuation character at the end. All lines found will be combined and returned.

If the keep_cont_char option is set to True, the continuation character will be left on the end of the line. Otherwise, by default, it is removed.

Parameters
• lines (list) -- List of strings to be evaluated.

• cont_char (char) -- Char to search for at end of line. Default is \.

• keep_cont_char (bool) -- Whether to keep the continuation on the end of the line. Defaults to False, which causes the continuation character to be removed.

Yields

line (str) -- Yields unsplit lines

Examples

>>> lines = ['Line one \', '     line one part 2', 'Line two']
>>> list(unsplit_lines(lines))
['Line one      line one part 2', 'Line two']
>>> list(unsplit_lines(lines, cont_char='2'))
['Line one \', '     line one part Line two']
>>> list(unsplit_lines(lines, keep_cont_char=True)
['Line one \     line one part 2', 'Line two']


## insights.parsr¶

parsr is a library for building parsers based on parsing expression grammars or PEGs.

You build a parser by making subparsers to match simple building blocks like numbers, strings, symbols, etc. and then composing them to reflect the higher level structure of your language.

Some means of combination are like those of regular expressions: sequences, alternatives, repetition, optional matching, etc. However, matching is always greedy. parsr also allows recursive definitions and the ability to transform the match of any subparser with a function. The parser can recognize and interpret its input at the same time.

Here’s an example that evaluates arithmetic expressions.

from insights.parsr import EOF, Forward, InSet, Many, Number, WS

def op(args):
ans, rest = args
for op, arg in rest:
if op == "+":
ans += arg
elif op == "-":
ans -= arg
elif op == "*":
ans *= arg
else:
ans /= arg
return ans

LP = Char("(")
RP = Char(")")

expr = Forward()  # Forward declarations allow recursive structure
factor = WS >> (Number | (LP >> expr << RP)) << WS
term = (factor + Many(InSet("*/") + factor)).map(op)

# Notice the funny assignment of Forward definitions.
expr <= (term + Many(InSet("+-") + term)).map(op)

evaluate = expr << EOF

exception insights.parsr.Backtrack(msg)[source]

Bases: Exception

Mapped or Lifted functions should Backtrack if they want to fail without causing parsing to fail.

class insights.parsr.Char(char)[source]

Char matches a single character.

a = Char("a")     # parses a single "a"
val = a("a")      # produces an "a" from the data.
val = a("b")      # raises an exception

process(pos, data, ctx)[source]
class insights.parsr.Choice(children)[source]

A Choice requires at least one of its children to succeed, and it returns the value of the one that matched. Alternatives in a choice are tried left to right, so they have a definite priority. This a feature of PEGs over context free grammars.

Additional uses of | on the parser will cause it to accumulate parsers onto itself instead of creating new Choices. This has the desirable effect of increasing efficiency, but it can also have unintended consequences if a choice is used in multiple parts of a grammar as the initial element of another choice. Use a Wrapper to prevent that from happening.

abc = a | b | c   # alternation or choice.
val = abc("a")    # parses a single "a"
val = abc("b")    # parses a single "b"
val = abc("c")    # parses a single "c"
val = abc("d")    # raises an exception

process(pos, data, ctx)[source]
class insights.parsr.Context(lines, src=None)[source]

Bases: object

An instance of Context is threaded through the process call to every parser. It stores an indention stack to track hanging indents, a tag stack for grammars like xml or apache configuration, the active parser stack for error reporting, and accumulated errors for the farthest position reached.

col(pos)[source]
line(pos)[source]
set(pos, msg)[source]

Every parser that encounters an error calls set with the current position and a message. If the error is at the farthest position reached by any other parser, the active parser stack and message are accumulated onto a list of errors for that position. If the position is beyond any previous errors, the error list is cleared before the active stack and new error are recorded. This is the “farthest failure heurstic.”

class insights.parsr.EnclosedComment(s, e)[source]

EnclosedComment matches a start literal, an end literal, and all characters between. It returns the content between the start and end.

Comment = EnclosedComment("/*", "*/")

process(pos, data, ctx)[source]
class insights.parsr.EndTagName(parser, ignore_case=False)[source]

Wraps a parser that represents an end tag for grammars like xml, html, etc. The result is captured and compared to the last tag on the tag stack in the Context object. The tags must match for the parse to be successful.

process(pos, data, ctx)[source]
class insights.parsr.FollowedBy(child, follow)[source]

FollowedBy takes a parser and a predicate parser. The initial parser matches only if the predicate matches the input after it. On success, input for the predicate is left unread, and the result of the first parser is returned.

ab = Char("a") & Char("b") # matches an "a" followed by a "b", but
# the "b" isn't consumed from the input.
val = ab("ab")             # returns "a" and leaves "b" to be
# consumed.
val = ab("ac")             # raises an exception and doesn't
# consume "a".

process(pos, data, ctx)[source]
class insights.parsr.Forward[source]

Forward allows recursive grammars where a nonterminal’s definition includes itself directly or indirectly. You initially create a Forward nonterminal with regular assignment.

expr = Forward()


You later give it its real definition with the <= operator.

expr <= (term + Many(LowOps + term)).map(op)

process(pos, data, ctx)[source]
class insights.parsr.HangingString(chars, echars=None, min_length=1)[source]

HangingString matches lines with indented continuations like in ini files.

Key = WS >> PosMarker(String(key_chars)) << WS
Sep = InSet(sep_chars, "Sep")
Value = WS >> (Boolean | HangingString(value_chars))
KVPair = WithIndent(Key + Opt(Sep >> Value))

process(pos, data, ctx)[source]
class insights.parsr.InSet(s, name=None)[source]

InSet matches any single character from a set.

vowel = InSet("aeiou")  # or InSet(set("aeiou"))
val = vowel("a")  # okay
val = vowel("e")  # okay
val = vowel("i")  # okay
val = vowel("o")  # okay
val = vowel("u")  # okay
val = vowel("y")  # raises an exception

process(pos, data, ctx)[source]
class insights.parsr.KeepLeft(left, right)[source]

KeepLeft takes two parsers. It requires them both to succeed but only returns results for the first one. It consumes input for both.

a = Char("a")
q = Char('"')

aq = a << q      # like a + q except only the result of a is
# returned
val = aq('a"')   # returns "a". Keeps the thing on the left of the
# <<

process(pos, data, ctx)[source]
class insights.parsr.KeepRight(left, right)[source]

KeepRight takes two parsers. It requires them both to succeed but only returns results for the second one. It consumes input for both.

q = Char('"')
a = Char("a")

qa = q >> a      # like q + a except only the result of a is
# returned
val = qa('"a')   # returns "a". Keeps the thing on the right of the
# >>

process(pos, data, ctx)[source]
class insights.parsr.Lift(func)[source]

Lift wraps a function of multiple arguments. Use it with the multiplication operator on as many parsers as function arguments, and the results of those parsers will be passed to the function. The result of a Lift parser is the result of the wrapped function.

Example:

.. code-block:: python

def comb(a, b, c):
return "".join([a, b, c])

# You'd normally invoke comb like comb("x", "y", "z"), but you can
# "lift" it for use with parsers like this:

x = Char("x")
y = Char("y")
z = Char("z")
p = Lift(comb) * x * y * z

# The * operator separates parsers whose results will go into the
# arguments of the lifted function. I've used Char above, but x, y,
# and z can be arbitrarily complex.

val = p("xyz")  # would return "xyz"
val = p("xyx")  # raises an exception. nothing would be consumed

process(pos, data, ctx)[source]
class insights.parsr.Literal(chars, value=<object object>, ignore_case=False)[source]

Match a literal string. The value keyword lets you return a python value instead of the matched input. The ignore_case keyword makes the match case insensitive.

lit = Literal("true")
val = lit("true")  # returns "true"
val = lit("True")  # raises an exception
val = lit("one")   # raises an exception

lit = Literal("true", ignore_case=True)
val = lit("true")  # returns "true"
val = lit("TRUE")  # returns "TRUE"
val = lit("one")   # raises an exception

t = Literal("true", value=True)
f = Literal("false", value=False)
val = t("true")  # returns the boolean True
val = t("True")  # raises an exception

val = f("false") # returns the boolean False
val = f("False") # raises and exception

t = Literal("true", value=True, ignore_case=True)
f = Literal("false", value=False, ignore_case=True)
val = t("true")  # returns the boolean True
val = t("True")  # returns the boolean True

val = f("false") # returns the boolean False
val = f("False") # returns the boolean False

process(pos, data, ctx)[source]
class insights.parsr.Many(parser, lower=0)[source]

Many wraps another parser and requires it to match a certain number of times.

When Many matches zero occurences (lower=0), it always succeeds. Keep this in mind when using it in a list of alternatives or with FollowedBy or NotFollowedBy.

The results are returned as a list.

x = Char("x")
xs = Many(x)      # parses many (or no) x's in a row
val = xs("")      # returns []
val = xs("a")     # returns []
val = xs("x")     # returns ["x"]
val = xs("xxxxx") # returns ["x", "x", "x", "x", "x"]
val = xs("xxxxb") # returns ["x", "x", "x", "x"]

ab = Many(a + b)  # parses "abab..."
val = ab("")      # produces []
val = ab("ab")    # produces [["a", b"]]
val = ab("ba")    # produces []
val = ab("ababab")# produces [["a", b"], ["a", "b"], ["a", "b"]]

ab = Many(a | b)  # parses any combination of "a" and "b" like
# "aababbaba..."
val = ab("aababb")# produces ["a", "a", "b", "a", "b", "b"]
bs = Many(Char("b"), lower=1) # requires at least one "b"

process(pos, data, ctx)[source]
class insights.parsr.Map(child, func)[source]

Map wraps a parser and a function. It returns the result of using the function to transform the wrapped parser’s result.

Example:

.. code-block:: python

Digit = InSet("0123456789")
Digits = Many(Digit, lower=1)
Number = Digits.map(lambda x: int("".join(x)))

process(pos, data, ctx)[source]
class insights.parsr.Mark(lineno, col, value)[source]

Bases: object

An object created by PosMarker to capture a value at a position in the input. Marks can give more context to a value transformed by mapped functions.

class insights.parsr.Node[source]

Bases: object

Node is the base class of all parsers. It’s a generic tree structure with each instance containing a list of its children. Its main purpose is to simplify pretty printing.

add_child(child)[source]
set_children(children)[source]
class insights.parsr.NotFollowedBy(child, follow)[source]

NotFollowedBy takes a parser and a predicate parser. The initial parser matches only if the predicate parser fails to match the input after it. On success, input for the predicate is left unread, and the result of the first parser is returned.

anb = Char("a") / Char("b") # matches an "a" not followed by a "b".
val = anb("ac")             # returns "a" and leaves "c" to be
# consumed
val = anb("ab")             # raises an exception and doesn't
# consume "a".

process(pos, data, ctx)[source]
class insights.parsr.OneLineComment(s)[source]

OneLineComment matches everything from a literal to the end of a line, excluding the end of line characters themselves. It returns the content between the start literal and the end of the line.

Comment = OneLineComment("#") | OneLineComment("//")

process(pos, data, ctx)[source]
class insights.parsr.Opt(p, default=None)[source]

Opt wraps a single parser and returns its value if it succeeds. It returns a default value otherwise. The input pointer is advanced only if the wrapped parser succeeds.

a = Char("a")
o = Opt(a)      # matches an "a" if its available. Still succeeds
val = o("a")    # returns "a"

o = Opt(a, default="x") # matches an "a" if its available. Returns
# "x" otherwise.
val = o("a")    # returns "a"

process(pos, data, ctx)[source]
class insights.parsr.Parser[source]

Parser is the common base class of all Parsers.

debug(d=True)[source]

Set to True to enable diagnostic messages before and after the parser is invoked.

map(func)[source]

Return a Map parser that transforms the results of the current parser with the function func.

process(pos, data, ctx)[source]
sep_by(sep)[source]

Return a parser that matches zero or more instances of the current parser separated by instances of the parser sep.

until(pred)[source]

Return an Until parser that matches zero or more instances of the current parser until the pred parser succeeds.

class insights.parsr.PosMarker(parser)[source]

Save the line number and column of a subparser by wrapping it in a PosMarker. The value of the parser that handled the input as well as the initial input position will be returned as a Mark.

process(pos, data, ctx)[source]
class insights.parsr.Sequence(children)[source]

A Sequence requires all of its children to succeed. It returns a list of the values they matched.

Additional uses of + on the parser will cause it to accumulate parsers onto itself instead of creating new Sequences. This has the desirable effect of causing sequence results to be represented as flat lists instead of trees, but it can also have unintended consequences if a sequence is used in multiple parts of a grammar as the initial element of another sequence. Use a Wrapper to prevent that from happening.

a = Char("a")     # parses a single "a"
b = Char("b")     # parses a single "b"
c = Char("c")     # parses a single "c"

ab = a + b        # parses a single "a" followed by a single "b"
# (a + b) creates a "Sequence" object. Using ab
# as an element in a later sequence would modify
# its original definition.

abc = a + b + c   # parses "abc"
# (a + b) creates a "Sequence" object to which c
# is appended

val = ab("ab")    # produces a list ["a", "b"]
val = ab("a")     # raises an exception
val = ab("b")     # raises an exception
val = ab("ac")    # raises an exception
val = ab("cb")    # raises an exception

val = abc("abc")  # produces ["a", "b", "c"]

process(pos, data, ctx)[source]
class insights.parsr.StartTagName(parser)[source]

Wraps a parser that represents a starting tag for grammars like xml, html, etc. The tag result is captured and put onto a tag stack in the Context object.

process(pos, data, ctx)[source]
class insights.parsr.String(chars, echars=None, min_length=1)[source]

Match one or more characters in a set. Matching is greedy.

vowels = String("aeiou")
val = vowels("a")            # returns "a"
val = vowels("u")            # returns "u"
val = vowels("aaeiouuoui")   # returns "aaeiouuoui"
val = vowels("uoiea")        # returns "uoiea"
val = vowels("oouieaaea")    # returns "oouieaaea"
val = vowels("ga")           # raises an exception

process(pos, data, ctx)[source]
class insights.parsr.Until(parser, predicate)[source]

Until wraps a parser and a terminal parser. It accumulates matches of the first parser until the terminal parser succeeds. Input for the terminal parser is left unread, and the results of the first parser are returned as a list.

Since Until can match zero occurences, it always succeeds. Keep this in mind when using it in a list of alternatives or with FollowedBy or NotFollowedBy.

cs = AnyChar.until(Char("y")) # parses many (or no) characters
# until a "y" is encountered.

val = cs("")                  # returns []
val = cs("a")                 # returns ["a"]
val = cs("x")                 # returns ["x"]
val = cs("ccccc")             # returns ["c", "c", "c", "c", "c"]
val = cs("abcdycc")           # returns ["a", "b", "c", "d"]

process(pos, data, ctx)[source]
class insights.parsr.WithIndent(parser)[source]

Consumes whitespace until a non-whitespace character is encountered, pushes the column position onto an indentation stack in the Context, and then calls the parser it’s wrapping. The wrapped parser and any of its children can make use of the saved indentation. Returns the value of the wrapped parser.

WithIndent allows HangingString to work by giving a way to mark how indented following lines must be to count as continuations.

Key = WS >> PosMarker(String(key_chars)) << WS
Sep = InSet(sep_chars, "Sep")
Value = WS >> (Boolean | HangingString(value_chars))
KVPair = WithIndent(Key + Opt(Sep >> Value))

process(pos, data, ctx)[source]
class insights.parsr.Wrapper(parser)[source]

Parser that wraps another parser. This can be used to prevent sequences and choices from accidentally accumulating other parsers when used in multiple parts of a grammar.

process(pos, data, ctx)[source]
insights.parsr.render(tree)[source]

Pretty prints a PEG.

insights.parsr.skip_none(x)[source]
insights.parsr.text_format(tree)[source]

Converts a PEG into a pretty printed string.

## insights.parsr.query¶

insights.parsr.query defines a common data model and query language for parsers created with insights.parsr to target.

The model allows duplicate keys, and it allows values with unnamed attributes and recursive substructure. This is a common model for many kinds of configuration.

Simple key/value pairs can be represented as a key with a value that has a single attribute. Most dictionary shapes used to represent configuration are made of keys with simple values (key/single attr), lists of simple values (key/multiple attrs), or nested dictionaries (key/substructure).

Something like XML allows duplicate keys, and it allows values to have named attributes and substructure. This module doesn’t cover that case.

Entry, Directive, Section, and Result have overloaded __getitem__ functions that respond to queries. This allows their instances to be accessed like simple dictionaries, but the key passed to [] is converted to a query of immediate child instances instead of a simple lookup.

class insights.parsr.query.ChildQuery(expr)[source]

Bases: insights.parsr.query._EntryQuery

Returns True if any child entry passes the query.

test(e)[source]
class insights.parsr.query.Directive(name=None, attrs=None, children=None, lineno=None, src=None, set_parents=True)[source]

A Directive is an Entry that represents a single option or named value. They are normally found in Section instances.

attrs
children
lineno
parent
property section
property section_name
src
class insights.parsr.query.Entry(name=None, attrs=None, children=None, lineno=None, src=None, set_parents=True)[source]

Bases: object

Entry is the base class for the data model, which is a tree of Entry instances. Each instance has a name, attributes, a parent, and children.

attrs
children
choose(chooser)[source]

Run a selector function on each node. It should return a tuple, each element of which is some query using the node. This lets you select parts of each tree in a result.

If you want to rename a field, make the element a dictionary whose key is the name you want and whose value is the query.

If you want to get all the children of a particular node instead of specifying them individually, use the * operator in python 3.5+ or return the query with “.grandchildren” appended otherwise.

Example: >>> from insights.parsr.query import make_child_query as q >>> from insights.parsr.query import from_dict

>>> conf = from_dict(load_config())
>>> p = (q("restartCount", gt(2)) & q("ready", False))

>>> # get the name, the restartCount renamed to restart, the podIP
>>> # from the node's parent, and all of the children from
>>> # n.lastState.terminated.

>>> # for python 3.5+
>>> sel = lambda n: (n["name"], {"restart": n.restartCount}, n.parent.podIP, *n.lastState.terminated)

>>> # for python 2
>>> sel = lambda n: (n["name"], {"restart": n.restartCount}, n.parent.podIP, n.lastState.terminated.grandchildren)

>>> conf.find(ANY).where(p).choose(sel)

crumbs(down=False)

Get the unique paths from the current entry up to the root or down to all of the leaves.

property directives

Returns all immediate children that are instances of Directive.

find(*queries, **kwargs)[source]

Finds matching results anywhere in the configuration. The arguments are the same as those accepted by compile_queries(), and it accepts a keyword called roots that will return the ultimate root nodes of any results.

get_crumbs(down=False)[source]

Get the unique paths from the current entry up to the root or down to all of the leaves.

get_keys()[source]

Returns the unique names of all the children as a list.

property grandchildren

Returns a flattened list of all grandchildren.

keys()

Returns the unique names of all the children as a list.

property line

Returns the original first line of text that generated the Entry. None if the model wasn’t generated by an insights parser.

lineno
parent
property root

Returns the furthest ancestor Entry. If the node is already the furthest ancestor, None is returned.

property section
property section_name
property sections

Returns all immediate children that are instances of Section.

select(*queries, **kwargs)[source]

select uses compile_queries() to compile queries into a query function and then passes the function, the current Entry instances children, and kwargs on to select().

property source
src
property string_value

Returns the string representation of all attributes separated by a single whilespace.

upto(query)[source]

Go up from the current node to the first node that matches query.

property value

Returns None if no attributes exist, the first attribute if only one exists, or the string_value if more than one exists.

where(name, value=None)[source]

Selects current nodes based on name and value queries of child nodes. If any immediate children match the queries, the parent is included in the results. The :py:func:make_child_query function can be used to construct queries that act on the children as a whole instead of one at a time.

Example: >>> from insights.parsr.query import make_child_query as q >>> from insights.parsr.query import from_dict >>> r = from_dict(load_config()) >>> r = conf.status.conditions.where(q(“status”, “False”) | q(“type”, “Progressing”)) >>> r.message >>> r = conf.status.conditions.where(q(“status”, “False”) | q(“type”, “Progressing”)) >>> r.message >>> r.lastTransitionTime.values [‘2019-08-04T23:17:08Z’, ‘2019-08-04T23:32:14Z’]

class insights.parsr.query.Result(children=None)[source]

Result is an Entry whose children are the results of a query.

attrs
children
crumbs(down=False)

Get the unique names from the current locations to the roots.

get_crumbs(down=False)[source]

Get the unique names from the current locations to the roots.

get_keys()[source]

Returns the unique names of all the grandchildren as a list.

keys()

Returns the unique names of all the grandchildren as a list.

property line

Returns the line of the child if only one child exists. This helps queries behave more like dictionaries when you know only one result should exist.

lineno
most_common(top=None)[source]

Returns the distribution of values returned by queries that return a single value for each node.

nth(n)[source]

If the results are from a list beneath a node, get the nth element of the results for each unique parent.

Example: conf.status.conditions.nth(0) will get the 0th condition of each status.

parent
property parents

Returns all of the deduplicated parents as a list. If a child has no parent, the child itself is treated as the parent.

property roots

Returns the furthest ancestor Entry instances of all children. If a child has no furthest ancestor, the child itself is treated as a root.

select(*queries, **kwargs)[source]

select uses compile_queries() to compile queries into a query function and then passes the function, the current Entry instances children, and kwargs on to select().

property sources
src
property string_value

Returns the string value of the child if only one child exists. This helps queries behave more like dictionaries when you know only one result should exist.

to_df()[source]
property unique_values

Returns the unique values of all the children as a list.

upto(query)[source]

Go up from the current results to the first nodes that match query.

property value

Returns the value of the child if only one child exists. This helps queries behave more like dictionaries when you know only one result should exist.

property values

Returns the values of all the children as a list.

where(name, value=None)[source]

Selects current nodes based on name and value queries of child nodes. If any immediate children match the queries, the parent is included in the results. The :py:func:make_child_query function can be used to construct queries that act on the children as a whole instead of one at a time.

Example: >>> from insights.parsr.query import make_child_query as q >>> from insights.parsr.query import from_dict >>> r = from_dict(load_config()) >>> r = conf.status.conditions.where(q(“status”, “False”) | q(“type”, “Progressing”)) >>> r.message >>> r = conf.status.conditions.where(q(“status”, “False”) | q(“type”, “Progressing”)) >>> r.message >>> r.lastTransitionTime.values [‘2019-08-04T23:17:08Z’, ‘2019-08-04T23:32:14Z’]

class insights.parsr.query.Section(name=None, attrs=None, children=None, lineno=None, src=None, set_parents=True)[source]

A Section is an Entry composed of other Sections and Directive instances.

attrs
children
lineno
parent
property section

Returns the name of the section.

property section_name

Returns the value of the section.

src
insights.parsr.query.all_(expr)[source]

Use to express that expr must succeed on all attributes for the query to be successful. Only works against Entry attributes.

insights.parsr.query.any_(expr)[source]

Use to express that expr can succeed on any attribute for the query to be successful. Only works against Entry attributes.

insights.parsr.query.child_query(name, value=None)[source]

Converts a query into a ChildQuery that works on all child entries at once to determine if the current entry is accepted.

insights.parsr.query.compile_queries(*queries)[source]

compile_queries returns a function that will execute a list of query expressions against an Entry. The first query is run against the current entry’s children, the second query is run against the children of the children remaining from the first query, and so on.

If a query is a single object, it matches against the name of an Entry. If it’s a tuple, the first element matches against the name, and subsequent elements are tried against each individual attribute. The attribute results are or’d together and that result is anded with the name query. Any query that raises an exception is treated as False.

insights.parsr.query.from_dict(orig, src=None)[source]

from_dict is a helper function that does its best to convert a python dict into a tree of Entry instances that can be queried.

insights.parsr.query.isidentifier() → bool

Return True if S is a valid identifier according to the language definition.

Use keyword.iskeyword() to test for reserved identifiers such as “def” and “class”.

insights.parsr.query.make_child_query(name, value=None)

Converts a query into a ChildQuery that works on all child entries at once to determine if the current entry is accepted.

insights.parsr.query.pretty_format(root, indent=4)[source]

pretty_format generates a text representation of a model as a list of lines.

insights.parsr.query.select(query, nodes, deep=False, roots=False)[source]

select runs query, a function returned by compile_queries(), against a list of Entry instances. If you pass deep=True, select recursively walks each entry in the list and accumulates the results of running the query against it. If you pass roots=True, select returns the deduplicated set of final ancestors of all successful queries. Otherwise, it returns the matching entries.

## insights.parsr.query.boolean¶

The boolean module allows delayed evaluation of boolean expressions. You wrap predicates in objects that have overloaded operators so they can be connected symbolically to express and, or, and not. This is useful if you want to build up a complicated predicate and pass it to something else for evaluation, in particular insights.parsr.query.Entry instances.

def is_even(n):
return (n % 2) == 0

def is_positive(n):
return n > 0

even_and_positive = pred(is_even) & pred(is_positive)

even_and_positive(6) == True
even_and_positive(-2) == False
even_and_positive(3) == False


You can also convert two parameter functions to which you want to partially apply an argument. The arguments partially applied will be those after the first argument. The first argument is the value the function should evaluate when it’s fully applied.

import operator
lt = pred2(operator.lt)  # operator.lt is lt(a, b) == (a < b)
gt = pred2(operator.gt)  # operator.gt is gt(a, b) == (a > b)

gt_five = gt(5)  # creates a function of one argument that when called
# returns operator.gt(x, 5)

lt_ten = lt(10)  # creates a function of one argument that when called
# returns operator.lt(x, 5)

gt_five_and_lt_10 = gt(5) & lt(10)

class insights.parsr.query.boolean.All(*exprs)[source]
test(value)[source]
insights.parsr.query.boolean.And
class insights.parsr.query.boolean.Any(*exprs)[source]
test(value)[source]
class insights.parsr.query.boolean.Boolean[source]

Bases: object

test(value)[source]
to_pyfunc()[source]
class insights.parsr.query.boolean.CaselessPredicate(func, *args)[source]
test(lhs)[source]
class insights.parsr.query.boolean.Not(query)[source]
test(value)[source]
insights.parsr.query.boolean.Or
class insights.parsr.query.boolean.Predicate(func, *args)[source]
test(value)[source]
insights.parsr.query.boolean.pred(func, ignore_case=False)[source]
insights.parsr.query.boolean.pred2(func, ignore_case=False)[source]

## insights.specs¶

class insights.specs.Openshift[source]
cluster_operators = insights.specs.Openshift.cluster_operators
crds = insights.specs.Openshift.crds
crs = insights.specs.Openshift.crs
machine_configs = insights.specs.Openshift.machine_configs
machine_id = insights.specs.Openshift.machine_id
machines = insights.specs.Openshift.machines
namespaces = insights.specs.Openshift.namespaces
nodes = insights.specs.Openshift.nodes
pods = insights.specs.Openshift.pods
pvcs = insights.specs.Openshift.pvcs
storage_classes = insights.specs.Openshift.storage_classes
class insights.specs.Specs[source]
abrt_ccpp_conf = insights.specs.Specs.abrt_ccpp_conf
abrt_status_bare = insights.specs.Specs.abrt_status_bare
alternatives_display_python = insights.specs.Specs.alternatives_display_python
amq_broker = insights.specs.Specs.amq_broker
ansible_host = insights.specs.Specs.ansible_host
audit_log = insights.specs.Specs.audit_log
auditctl_status = insights.specs.Specs.auditctl_status
auditd_conf = insights.specs.Specs.auditd_conf
autofs_conf = insights.specs.Specs.autofs_conf
avc_cache_threshold = insights.specs.Specs.avc_cache_threshold
avc_hash_stats = insights.specs.Specs.avc_hash_stats
aws_instance_id_doc = insights.specs.Specs.aws_instance_id_doc
aws_instance_id_pkcs7 = insights.specs.Specs.aws_instance_id_pkcs7
aws_instance_type = insights.specs.Specs.aws_instance_type
awx_manage_check_license = insights.specs.Specs.awx_manage_check_license
azure_instance_plan = insights.specs.Specs.azure_instance_plan
azure_instance_type = insights.specs.Specs.azure_instance_type
bios_uuid = insights.specs.Specs.bios_uuid
blkid = insights.specs.Specs.blkid
bond = insights.specs.Specs.bond
bond_dynamic_lb = insights.specs.Specs.bond_dynamic_lb
boot_loader_entries = insights.specs.Specs.boot_loader_entries
branch_info = insights.specs.Specs.branch_info
brctl_show = insights.specs.Specs.brctl_show
candlepin_error_log = insights.specs.Specs.candlepin_error_log
candlepin_log = insights.specs.Specs.candlepin_log
catalina_out = insights.specs.Specs.catalina_out
catalina_server_log = insights.specs.Specs.catalina_server_log
cciss = insights.specs.Specs.cciss
cdc_wdm = insights.specs.Specs.cdc_wdm
ceilometer_central_log = insights.specs.Specs.ceilometer_central_log
ceilometer_collector_log = insights.specs.Specs.ceilometer_collector_log
ceilometer_compute_log = insights.specs.Specs.ceilometer_compute_log
ceilometer_conf = insights.specs.Specs.ceilometer_conf
ceph_conf = insights.specs.Specs.ceph_conf
ceph_config_show = insights.specs.Specs.ceph_config_show
ceph_df_detail = insights.specs.Specs.ceph_df_detail
ceph_health_detail = insights.specs.Specs.ceph_health_detail
ceph_insights = insights.specs.Specs.ceph_insights
ceph_log = insights.specs.Specs.ceph_log
ceph_osd_df = insights.specs.Specs.ceph_osd_df
ceph_osd_dump = insights.specs.Specs.ceph_osd_dump
ceph_osd_ec_profile_get = insights.specs.Specs.ceph_osd_ec_profile_get
ceph_osd_ec_profile_ls = insights.specs.Specs.ceph_osd_ec_profile_ls
ceph_osd_log = insights.specs.Specs.ceph_osd_log
ceph_osd_tree = insights.specs.Specs.ceph_osd_tree
ceph_osd_tree_text = insights.specs.Specs.ceph_osd_tree_text
ceph_report = insights.specs.Specs.ceph_report
ceph_s = insights.specs.Specs.ceph_s
ceph_v = insights.specs.Specs.ceph_v
certificates_enddate = insights.specs.Specs.certificates_enddate
cgroups = insights.specs.Specs.cgroups
checkin_conf = insights.specs.Specs.checkin_conf
chkconfig = insights.specs.Specs.chkconfig
chrony_conf = insights.specs.Specs.chrony_conf
chronyc_sources = insights.specs.Specs.chronyc_sources
cib_xml = insights.specs.Specs.cib_xml
cinder_api_log = insights.specs.Specs.cinder_api_log
cinder_conf = insights.specs.Specs.cinder_conf
cinder_volume_log = insights.specs.Specs.cinder_volume_log
cloud_cfg = insights.specs.Specs.cloud_cfg
cloud_init_custom_network = insights.specs.Specs.cloud_init_custom_network
cloud_init_log = insights.specs.Specs.cloud_init_log
cluster_conf = insights.specs.Specs.cluster_conf
cmdline = insights.specs.Specs.cmdline
cni_podman_bridge_conf = insights.specs.Specs.cni_podman_bridge_conf
cobbler_modules_conf = insights.specs.Specs.cobbler_modules_conf
cobbler_settings = insights.specs.Specs.cobbler_settings
corosync = insights.specs.Specs.corosync
corosync_cmapctl = insights.specs.Specs.corosync_cmapctl
corosync_conf = insights.specs.Specs.corosync_conf
cpe = insights.specs.Specs.cpe
cpu_cores = insights.specs.Specs.cpu_cores
cpu_siblings = insights.specs.Specs.cpu_siblings
cpu_smt_active = insights.specs.Specs.cpu_smt_active
cpu_smt_control = insights.specs.Specs.cpu_smt_control
cpu_vulns = insights.specs.Specs.cpu_vulns
cpu_vulns_meltdown = insights.specs.Specs.cpu_vulns_meltdown
cpu_vulns_spec_store_bypass = insights.specs.Specs.cpu_vulns_spec_store_bypass
cpu_vulns_spectre_v1 = insights.specs.Specs.cpu_vulns_spectre_v1
cpu_vulns_spectre_v2 = insights.specs.Specs.cpu_vulns_spectre_v2
cpuinfo = insights.specs.Specs.cpuinfo
cpuinfo_max_freq = insights.specs.Specs.cpuinfo_max_freq
cpupower_frequency_info = insights.specs.Specs.cpupower_frequency_info
cpuset_cpus = insights.specs.Specs.cpuset_cpus
cron_daily_rhsmd = insights.specs.Specs.cron_daily_rhsmd
crt = insights.specs.Specs.crt
crypto_policies_bind = insights.specs.Specs.crypto_policies_bind
crypto_policies_config = insights.specs.Specs.crypto_policies_config
crypto_policies_opensshserver = insights.specs.Specs.crypto_policies_opensshserver
crypto_policies_state_current = insights.specs.Specs.crypto_policies_state_current
current_clocksource = insights.specs.Specs.current_clocksource
date = insights.specs.Specs.date
date_iso = insights.specs.Specs.date_iso
date_utc = insights.specs.Specs.date_utc
dcbtool_gc_dcb = insights.specs.Specs.dcbtool_gc_dcb
designate_conf = insights.specs.Specs.designate_conf
df__al = insights.specs.Specs.df__al
df__alP = insights.specs.Specs.df__alP
df__li = insights.specs.Specs.df__li
dig = insights.specs.Specs.dig
dig_dnssec = insights.specs.Specs.dig_dnssec
dig_edns = insights.specs.Specs.dig_edns
dig_noedns = insights.specs.Specs.dig_noedns
dirsrv = insights.specs.Specs.dirsrv
dirsrv_access = insights.specs.Specs.dirsrv_access
dirsrv_errors = insights.specs.Specs.dirsrv_errors
display_java = insights.specs.Specs.display_java
display_name = insights.specs.Specs.display_name
dm_mod_use_blk_mq = insights.specs.Specs.dm_mod_use_blk_mq
dmesg = insights.specs.Specs.dmesg
dmesg_log = insights.specs.Specs.dmesg_log
dmidecode = insights.specs.Specs.dmidecode
dmsetup_info = insights.specs.Specs.dmsetup_info
dmsetup_status = insights.specs.Specs.dmsetup_status
dnf_conf = insights.specs.Specs.dnf_conf
dnf_module_info = insights.specs.Specs.dnf_module_info
dnf_module_list = insights.specs.Specs.dnf_module_list
dnf_modules = insights.specs.Specs.dnf_modules
dnsmasq_config = insights.specs.Specs.dnsmasq_config
docker_container_inspect = insights.specs.Specs.docker_container_inspect
docker_host_machine_id = insights.specs.Specs.docker_host_machine_id
docker_image_inspect = insights.specs.Specs.docker_image_inspect
docker_info = insights.specs.Specs.docker_info
docker_list_containers = insights.specs.Specs.docker_list_containers
docker_list_images = insights.specs.Specs.docker_list_images
docker_network = insights.specs.Specs.docker_network
docker_storage = insights.specs.Specs.docker_storage
docker_storage_setup = insights.specs.Specs.docker_storage_setup
docker_sysconfig = insights.specs.Specs.docker_sysconfig
dotnet_version = insights.specs.Specs.dotnet_version
doveconf = insights.specs.Specs.doveconf
dracut_kdump_capture_service = insights.specs.Specs.dracut_kdump_capture_service
du_dirs = insights.specs.Specs.du_dirs
dumpe2fs_h = insights.specs.Specs.dumpe2fs_h
engine_config_all = insights.specs.Specs.engine_config_all
engine_db_query_vdsm_version = insights.specs.Specs.engine_db_query_vdsm_version
engine_log = insights.specs.Specs.engine_log
etc_journald_conf = insights.specs.Specs.etc_journald_conf
etc_journald_conf_d = insights.specs.Specs.etc_journald_conf_d
etc_machine_id = insights.specs.Specs.etc_machine_id
etc_udev_40_redhat_rules = insights.specs.Specs.etc_udev_40_redhat_rules
etcd_conf = insights.specs.Specs.etcd_conf
ethernet_interfaces = insights.specs.Specs.ethernet_interfaces
ethtool = insights.specs.Specs.ethtool
ethtool_S = insights.specs.Specs.ethtool_S
ethtool_T = insights.specs.Specs.ethtool_T
ethtool_a = insights.specs.Specs.ethtool_a
ethtool_c = insights.specs.Specs.ethtool_c
ethtool_g = insights.specs.Specs.ethtool_g
ethtool_i = insights.specs.Specs.ethtool_i
ethtool_k = insights.specs.Specs.ethtool_k
exim_conf = insights.specs.Specs.exim_conf
facter = insights.specs.Specs.facter
fc_match = insights.specs.Specs.fc_match
fcoeadm_i = insights.specs.Specs.fcoeadm_i
fdisk_l = insights.specs.Specs.fdisk_l
fdisk_l_sos = insights.specs.Specs.fdisk_l_sos
findmnt_lo_propagation = insights.specs.Specs.findmnt_lo_propagation
firewall_cmd_list_all_zones = insights.specs.Specs.firewall_cmd_list_all_zones
firewalld_conf = insights.specs.Specs.firewalld_conf
foreman_production_log = insights.specs.Specs.foreman_production_log
foreman_proxy_conf = insights.specs.Specs.foreman_proxy_conf
foreman_proxy_log = insights.specs.Specs.foreman_proxy_log
foreman_rake_db_migrate_status = insights.specs.Specs.foreman_rake_db_migrate_status
foreman_satellite_log = insights.specs.Specs.foreman_satellite_log
foreman_ssl_access_ssl_log = insights.specs.Specs.foreman_ssl_access_ssl_log
foreman_tasks_config = insights.specs.Specs.foreman_tasks_config
freeipa_healthcheck_log = insights.specs.Specs.freeipa_healthcheck_log
fstab = insights.specs.Specs.fstab
galera_cnf = insights.specs.Specs.galera_cnf
gcp_license_codes = insights.specs.Specs.gcp_license_codes
getcert_list = insights.specs.Specs.getcert_list
getconf_page_size = insights.specs.Specs.getconf_page_size
getenforce = insights.specs.Specs.getenforce
getsebool = insights.specs.Specs.getsebool
gfs2_file_system_block_size = insights.specs.Specs.gfs2_file_system_block_size
glance_api_conf = insights.specs.Specs.glance_api_conf
glance_api_log = insights.specs.Specs.glance_api_log
glance_cache_conf = insights.specs.Specs.glance_cache_conf
glance_registry_conf = insights.specs.Specs.glance_registry_conf
gluster_peer_status = insights.specs.Specs.gluster_peer_status
gluster_v_info = insights.specs.Specs.gluster_v_info
gluster_v_status = insights.specs.Specs.gluster_v_status
gnocchi_conf = insights.specs.Specs.gnocchi_conf
gnocchi_metricd_log = insights.specs.Specs.gnocchi_metricd_log
greenboot_status = insights.specs.Specs.greenboot_status
grub1_config_perms = insights.specs.Specs.grub1_config_perms
grub2_cfg = insights.specs.Specs.grub2_cfg
grub2_efi_cfg = insights.specs.Specs.grub2_efi_cfg
grub_conf = insights.specs.Specs.grub_conf
grub_config_perms = insights.specs.Specs.grub_config_perms
grub_efi_conf = insights.specs.Specs.grub_efi_conf
grubby_default_index = insights.specs.Specs.grubby_default_index
grubby_default_kernel = insights.specs.Specs.grubby_default_kernel
hammer_ping = insights.specs.Specs.hammer_ping
hammer_task_list = insights.specs.Specs.hammer_task_list
haproxy_cfg = insights.specs.Specs.haproxy_cfg
heat_api_log = insights.specs.Specs.heat_api_log
heat_conf = insights.specs.Specs.heat_conf
heat_crontab = insights.specs.Specs.heat_crontab
heat_crontab_container = insights.specs.Specs.heat_crontab_container
heat_engine_log = insights.specs.Specs.heat_engine_log
hostname = insights.specs.Specs.hostname
hostname_default = insights.specs.Specs.hostname_default
hostname_short = insights.specs.Specs.hostname_short
hosts = insights.specs.Specs.hosts
hponcfg_g = insights.specs.Specs.hponcfg_g
httpd24_httpd_error_log = insights.specs.Specs.httpd24_httpd_error_log
httpd_M = insights.specs.Specs.httpd_M
httpd_V = insights.specs.Specs.httpd_V
httpd_access_log = insights.specs.Specs.httpd_access_log
httpd_conf = insights.specs.Specs.httpd_conf
httpd_conf_scl_httpd24 = insights.specs.Specs.httpd_conf_scl_httpd24
httpd_conf_scl_jbcs_httpd24 = insights.specs.Specs.httpd_conf_scl_jbcs_httpd24
httpd_error_log = insights.specs.Specs.httpd_error_log
httpd_limits = insights.specs.Specs.httpd_limits
httpd_on_nfs = insights.specs.Specs.httpd_on_nfs
httpd_ssl_access_log = insights.specs.Specs.httpd_ssl_access_log
httpd_ssl_error_log = insights.specs.Specs.httpd_ssl_error_log
ifcfg = insights.specs.Specs.ifcfg
ifcfg_static_route = insights.specs.Specs.ifcfg_static_route
ifconfig = insights.specs.Specs.ifconfig
imagemagick_policy = insights.specs.Specs.imagemagick_policy
init_ora = insights.specs.Specs.init_ora
init_process_cgroup = insights.specs.Specs.init_process_cgroup
initctl_lst = insights.specs.Specs.initctl_lst
initscript = insights.specs.Specs.initscript
insights_client_conf = insights.specs.Specs.insights_client_conf
installed_rpms = insights.specs.Specs.installed_rpms
interrupts = insights.specs.Specs.interrupts
ip6tables = insights.specs.Specs.ip6tables
ip6tables_permanent = insights.specs.Specs.ip6tables_permanent
ip_addr = insights.specs.Specs.ip_addr
ip_addresses = insights.specs.Specs.ip_addresses
ip_neigh_show = insights.specs.Specs.ip_neigh_show
ip_netns_exec_namespace_lsof = insights.specs.Specs.ip_netns_exec_namespace_lsof
ip_route_show_table_all = insights.specs.Specs.ip_route_show_table_all
ipaupgrade_log = insights.specs.Specs.ipaupgrade_log
ipcs_m = insights.specs.Specs.ipcs_m
ipcs_m_p = insights.specs.Specs.ipcs_m_p
ipcs_s = insights.specs.Specs.ipcs_s
ipcs_s_i = insights.specs.Specs.ipcs_s_i
ipsec_conf = insights.specs.Specs.ipsec_conf
iptables = insights.specs.Specs.iptables
iptables_permanent = insights.specs.Specs.iptables_permanent
ipv4_neigh = insights.specs.Specs.ipv4_neigh
ipv6_neigh = insights.specs.Specs.ipv6_neigh
ironic_conf = insights.specs.Specs.ironic_conf
ironic_inspector_log = insights.specs.Specs.ironic_inspector_log
iscsiadm_m_session = insights.specs.Specs.iscsiadm_m_session
jbcs_httpd24_httpd_error_log = insights.specs.Specs.jbcs_httpd24_httpd_error_log
jboss_domain_server_log = insights.specs.Specs.jboss_domain_server_log
jboss_standalone_main_config = insights.specs.Specs.jboss_standalone_main_config
jboss_standalone_server_log = insights.specs.Specs.jboss_standalone_server_log
jboss_version = insights.specs.Specs.jboss_version
journal_since_boot = insights.specs.Specs.journal_since_boot
katello_service_status = insights.specs.Specs.katello_service_status
kdump_conf = insights.specs.Specs.kdump_conf
kerberos_kdc_log = insights.specs.Specs.kerberos_kdc_log
kernel_config = insights.specs.Specs.kernel_config
kexec_crash_loaded = insights.specs.Specs.kexec_crash_loaded
kexec_crash_size = insights.specs.Specs.kexec_crash_size
keystone_conf = insights.specs.Specs.keystone_conf
keystone_crontab = insights.specs.Specs.keystone_crontab
keystone_crontab_container = insights.specs.Specs.keystone_crontab_container
keystone_log = insights.specs.Specs.keystone_log
kpatch_list = insights.specs.Specs.kpatch_list
krb5 = insights.specs.Specs.krb5
ksmstate = insights.specs.Specs.ksmstate
kubepods_cpu_quota = insights.specs.Specs.kubepods_cpu_quota
lastupload = insights.specs.Specs.lastupload
ld_library_path_of_user = insights.specs.Specs.ld_library_path_of_user
libssh_client_config = insights.specs.Specs.libssh_client_config
libssh_server_config = insights.specs.Specs.libssh_server_config
libvirtd_log = insights.specs.Specs.libvirtd_log
libvirtd_qemu_log = insights.specs.Specs.libvirtd_qemu_log
limits_conf = insights.specs.Specs.limits_conf
locale = insights.specs.Specs.locale
localtime = insights.specs.Specs.localtime
logrotate_conf = insights.specs.Specs.logrotate_conf
lpstat_p = insights.specs.Specs.lpstat_p
ls_R_var_lib_nova_instances = insights.specs.Specs.ls_R_var_lib_nova_instances
ls_boot = insights.specs.Specs.ls_boot
ls_dev = insights.specs.Specs.ls_dev
ls_disk = insights.specs.Specs.ls_disk
ls_docker_volumes = insights.specs.Specs.ls_docker_volumes
ls_edac_mc = insights.specs.Specs.ls_edac_mc
ls_etc = insights.specs.Specs.ls_etc
ls_ipa_idoverride_memberof = insights.specs.Specs.ls_ipa_idoverride_memberof
ls_lib_firmware = insights.specs.Specs.ls_lib_firmware
ls_ocp_cni_openshift_sdn = insights.specs.Specs.ls_ocp_cni_openshift_sdn
ls_origin_local_volumes_pods = insights.specs.Specs.ls_origin_local_volumes_pods
ls_osroot = insights.specs.Specs.ls_osroot
ls_run_systemd_generator = insights.specs.Specs.ls_run_systemd_generator
ls_sys_firmware = insights.specs.Specs.ls_sys_firmware
ls_tmp = insights.specs.Specs.ls_tmp
ls_usr_bin = insights.specs.Specs.ls_usr_bin
ls_usr_lib64 = insights.specs.Specs.ls_usr_lib64
ls_usr_sbin = insights.specs.Specs.ls_usr_sbin
ls_var_cache_pulp = insights.specs.Specs.ls_var_cache_pulp
ls_var_lib_mongodb = insights.specs.Specs.ls_var_lib_mongodb
ls_var_lib_nova_instances = insights.specs.Specs.ls_var_lib_nova_instances
ls_var_log = insights.specs.Specs.ls_var_log
ls_var_opt_mssql = insights.specs.Specs.ls_var_opt_mssql
ls_var_opt_mssql_log = insights.specs.Specs.ls_var_opt_mssql_log
ls_var_run = insights.specs.Specs.ls_var_run
ls_var_spool_clientmq = insights.specs.Specs.ls_var_spool_clientmq
ls_var_spool_postfix_maildrop = insights.specs.Specs.ls_var_spool_postfix_maildrop
ls_var_tmp = insights.specs.Specs.ls_var_tmp
ls_var_www = insights.specs.Specs.ls_var_www
lsblk = insights.specs.Specs.lsblk
lsblk_pairs = insights.specs.Specs.lsblk_pairs
lscpu = insights.specs.Specs.lscpu
lsinitrd = insights.specs.Specs.lsinitrd
lsinitrd_lvm_conf = insights.specs.Specs.lsinitrd_lvm_conf
lsmod = insights.specs.Specs.lsmod
lsof = insights.specs.Specs.lsof
lspci = insights.specs.Specs.lspci
lspci_vmmkn = insights.specs.Specs.lspci_vmmkn
lssap = insights.specs.Specs.lssap
lsscsi = insights.specs.Specs.lsscsi
lsvmbus = insights.specs.Specs.lsvmbus
lvdisplay = insights.specs.Specs.lvdisplay
lvm_conf = insights.specs.Specs.lvm_conf
lvmconfig = insights.specs.Specs.lvmconfig
lvs = insights.specs.Specs.lvs
lvs_noheadings = insights.specs.Specs.lvs_noheadings
lvs_noheadings_all = insights.specs.Specs.lvs_noheadings_all
mac_addresses = insights.specs.Specs.mac_addresses
machine_id = insights.specs.Specs.machine_id
manila_conf = insights.specs.Specs.manila_conf
mariadb_log = insights.specs.Specs.mariadb_log
max_uid = insights.specs.Specs.max_uid
md5chk_files = insights.specs.Specs.md5chk_files
mdadm_E = insights.specs.Specs.mdadm_E
mdstat = insights.specs.Specs.mdstat
meminfo = insights.specs.Specs.meminfo
messages = insights.specs.Specs.messages
metadata_json = insights.specs.Specs.metadata_json
mistral_executor_log = insights.specs.Specs.mistral_executor_log
mlx4_port = insights.specs.Specs.mlx4_port
modinfo = insights.specs.Specs.modinfo
modinfo_all = insights.specs.Specs.modinfo_all
modinfo_i40e = insights.specs.Specs.modinfo_i40e
modinfo_igb = insights.specs.Specs.modinfo_igb
modinfo_ixgbe = insights.specs.Specs.modinfo_ixgbe
modinfo_veth = insights.specs.Specs.modinfo_veth
modinfo_vmxnet3 = insights.specs.Specs.modinfo_vmxnet3
modprobe = insights.specs.Specs.modprobe
mokutil_sbstate = insights.specs.Specs.mokutil_sbstate
mongod_conf = insights.specs.Specs.mongod_conf
mount = insights.specs.Specs.mount
mounts = insights.specs.Specs.mounts
mssql_conf = insights.specs.Specs.mssql_conf
multicast_querier = insights.specs.Specs.multicast_querier
multipath__v4__ll = insights.specs.Specs.multipath__v4__ll
multipath_conf = insights.specs.Specs.multipath_conf
multipath_conf_initramfs = insights.specs.Specs.multipath_conf_initramfs
mysql_log = insights.specs.Specs.mysql_log
mysqladmin_status = insights.specs.Specs.mysqladmin_status
mysqladmin_vars = insights.specs.Specs.mysqladmin_vars
mysqld_limits = insights.specs.Specs.mysqld_limits
named_checkconf_p = insights.specs.Specs.named_checkconf_p
named_conf = insights.specs.Specs.named_conf
namespace = insights.specs.Specs.namespace
ndctl_list_Ni = insights.specs.Specs.ndctl_list_Ni
netconsole = insights.specs.Specs.netconsole
netstat = insights.specs.Specs.netstat
netstat_agn = insights.specs.Specs.netstat_agn
netstat_i = insights.specs.Specs.netstat_i
netstat_s = insights.specs.Specs.netstat_s
networkmanager_conf = insights.specs.Specs.networkmanager_conf
networkmanager_dispatcher_d = insights.specs.Specs.networkmanager_dispatcher_d
neutron_conf = insights.specs.Specs.neutron_conf
neutron_dhcp_agent_ini = insights.specs.Specs.neutron_dhcp_agent_ini
neutron_l3_agent_ini = insights.specs.Specs.neutron_l3_agent_ini
neutron_l3_agent_log = insights.specs.Specs.neutron_l3_agent_log
neutron_metadata_agent_ini = insights.specs.Specs.neutron_metadata_agent_ini
neutron_metadata_agent_log = insights.specs.Specs.neutron_metadata_agent_log
neutron_ml2_conf = insights.specs.Specs.neutron_ml2_conf
neutron_ovs_agent_log = insights.specs.Specs.neutron_ovs_agent_log
neutron_plugin_ini = insights.specs.Specs.neutron_plugin_ini
neutron_server_log = insights.specs.Specs.neutron_server_log
neutron_sriov_agent = insights.specs.Specs.neutron_sriov_agent
nfs_exports = insights.specs.Specs.nfs_exports
nfs_exports_d = insights.specs.Specs.nfs_exports_d
nginx_conf = insights.specs.Specs.nginx_conf
nmcli_conn_show = insights.specs.Specs.nmcli_conn_show
nmcli_dev_show = insights.specs.Specs.nmcli_dev_show
nmcli_dev_show_sos = insights.specs.Specs.nmcli_dev_show_sos
nova_api_log = insights.specs.Specs.nova_api_log
nova_compute_log = insights.specs.Specs.nova_compute_log
nova_conf = insights.specs.Specs.nova_conf
nova_crontab = insights.specs.Specs.nova_crontab
nova_crontab_container = insights.specs.Specs.nova_crontab_container
nova_migration_uid = insights.specs.Specs.nova_migration_uid
nova_uid = insights.specs.Specs.nova_uid
nscd_conf = insights.specs.Specs.nscd_conf
nsswitch_conf = insights.specs.Specs.nsswitch_conf
ntp_conf = insights.specs.Specs.ntp_conf
ntpq_leap = insights.specs.Specs.ntpq_leap
ntpq_pn = insights.specs.Specs.ntpq_pn
ntptime = insights.specs.Specs.ntptime
numa_cpus = insights.specs.Specs.numa_cpus
numeric_user_group_name = insights.specs.Specs.numeric_user_group_name
nvme_core_io_timeout = insights.specs.Specs.nvme_core_io_timeout
oc_get_bc = insights.specs.Specs.oc_get_bc
oc_get_build = insights.specs.Specs.oc_get_build
oc_get_clusterrole_with_config = insights.specs.Specs.oc_get_clusterrole_with_config
oc_get_clusterrolebinding_with_config = insights.specs.Specs.oc_get_clusterrolebinding_with_config
oc_get_configmap = insights.specs.Specs.oc_get_configmap
oc_get_dc = insights.specs.Specs.oc_get_dc
oc_get_egressnetworkpolicy = insights.specs.Specs.oc_get_egressnetworkpolicy
oc_get_endpoints = insights.specs.Specs.oc_get_endpoints
oc_get_event = insights.specs.Specs.oc_get_event
oc_get_node = insights.specs.Specs.oc_get_node
oc_get_pod = insights.specs.Specs.oc_get_pod
oc_get_project = insights.specs.Specs.oc_get_project
oc_get_pv = insights.specs.Specs.oc_get_pv
oc_get_pvc = insights.specs.Specs.oc_get_pvc
oc_get_rc = insights.specs.Specs.oc_get_rc
oc_get_role = insights.specs.Specs.oc_get_role
oc_get_rolebinding = insights.specs.Specs.oc_get_rolebinding
oc_get_route = insights.specs.Specs.oc_get_route
oc_get_service = insights.specs.Specs.oc_get_service
octavia_conf = insights.specs.Specs.octavia_conf
odbc_ini = insights.specs.Specs.odbc_ini
odbcinst_ini = insights.specs.Specs.odbcinst_ini
open_vm_tools_stat_raw_text_session = insights.specs.Specs.open_vm_tools_stat_raw_text_session
openshift_certificates = insights.specs.Specs.openshift_certificates
openshift_fluentd_environ = insights.specs.Specs.openshift_fluentd_environ
openshift_hosts = insights.specs.Specs.openshift_hosts
openshift_router_environ = insights.specs.Specs.openshift_router_environ
openvswitch_daemon_log = insights.specs.Specs.openvswitch_daemon_log
openvswitch_other_config = insights.specs.Specs.openvswitch_other_config
openvswitch_server_log = insights.specs.Specs.openvswitch_server_log
os_release = insights.specs.Specs.os_release
osa_dispatcher_log = insights.specs.Specs.osa_dispatcher_log
ose_master_config = insights.specs.Specs.ose_master_config
ose_node_config = insights.specs.Specs.ose_node_config
ovirt_engine_boot_log = insights.specs.Specs.ovirt_engine_boot_log
ovirt_engine_confd = insights.specs.Specs.ovirt_engine_confd
ovirt_engine_console_log = insights.specs.Specs.ovirt_engine_console_log
ovirt_engine_server_log = insights.specs.Specs.ovirt_engine_server_log
ovirt_engine_ui_log = insights.specs.Specs.ovirt_engine_ui_log
ovs_appctl_fdb_show_bridge = insights.specs.Specs.ovs_appctl_fdb_show_bridge
ovs_ofctl_dump_flows = insights.specs.Specs.ovs_ofctl_dump_flows
ovs_vsctl_list_bridge = insights.specs.Specs.ovs_vsctl_list_bridge
ovs_vsctl_show = insights.specs.Specs.ovs_vsctl_show
ovs_vswitchd_limits = insights.specs.Specs.ovs_vswitchd_limits
pacemaker_log = insights.specs.Specs.pacemaker_log
package_provides_command = insights.specs.Specs.package_provides_command
package_provides_httpd = insights.specs.Specs.package_provides_httpd
package_provides_java = insights.specs.Specs.package_provides_java
pam_conf = insights.specs.Specs.pam_conf
parted__l = insights.specs.Specs.parted__l
partitions = insights.specs.Specs.partitions
passenger_status = insights.specs.Specs.passenger_status
password_auth = insights.specs.Specs.password_auth
pci_rport_target_disk_paths = insights.specs.Specs.pci_rport_target_disk_paths
pcp_metrics = insights.specs.Specs.pcp_metrics
pcs_config = insights.specs.Specs.pcs_config
pcs_quorum_status = insights.specs.Specs.pcs_quorum_status
pcs_status = insights.specs.Specs.pcs_status
php_ini = insights.specs.Specs.php_ini
pluginconf_d = insights.specs.Specs.pluginconf_d
pmlog_summary = insights.specs.Specs.pmlog_summary
pmrep_metrics = insights.specs.Specs.pmrep_metrics
podman_container_inspect = insights.specs.Specs.podman_container_inspect
podman_image_inspect = insights.specs.Specs.podman_image_inspect
podman_list_containers = insights.specs.Specs.podman_list_containers
podman_list_images = insights.specs.Specs.podman_list_images
postconf = insights.specs.Specs.postconf
postconf_builtin = insights.specs.Specs.postconf_builtin
postgresql_conf = insights.specs.Specs.postgresql_conf
postgresql_log = insights.specs.Specs.postgresql_log
prev_uploader_log = insights.specs.Specs.prev_uploader_log
proc_netstat = insights.specs.Specs.proc_netstat
proc_slabinfo = insights.specs.Specs.proc_slabinfo
proc_snmp_ipv4 = insights.specs.Specs.proc_snmp_ipv4
proc_snmp_ipv6 = insights.specs.Specs.proc_snmp_ipv6
proc_stat = insights.specs.Specs.proc_stat
ps_alxwww = insights.specs.Specs.ps_alxwww
ps_aux = insights.specs.Specs.ps_aux
ps_auxcww = insights.specs.Specs.ps_auxcww
ps_auxww = insights.specs.Specs.ps_auxww
ps_ef = insights.specs.Specs.ps_ef
ps_eo = insights.specs.Specs.ps_eo
pulp_worker_defaults = insights.specs.Specs.pulp_worker_defaults
puppet_ca_cert_expire_date = insights.specs.Specs.puppet_ca_cert_expire_date
puppet_ssl_cert_ca_pem = insights.specs.Specs.puppet_ssl_cert_ca_pem
puppetserver_config = insights.specs.Specs.puppetserver_config
pvs = insights.specs.Specs.pvs
pvs_noheadings = insights.specs.Specs.pvs_noheadings
pvs_noheadings_all = insights.specs.Specs.pvs_noheadings_all
qemu_conf = insights.specs.Specs.qemu_conf
qemu_xml = insights.specs.Specs.qemu_xml
qpid_stat_g = insights.specs.Specs.qpid_stat_g
qpid_stat_q = insights.specs.Specs.qpid_stat_q
qpid_stat_u = insights.specs.Specs.qpid_stat_u
qpidd_conf = insights.specs.Specs.qpidd_conf
rabbitmq_env = insights.specs.Specs.rabbitmq_env
rabbitmq_logs = insights.specs.Specs.rabbitmq_logs
rabbitmq_policies = insights.specs.Specs.rabbitmq_policies
rabbitmq_queues = insights.specs.Specs.rabbitmq_queues
rabbitmq_report = insights.specs.Specs.rabbitmq_report
rabbitmq_report_of_containers = insights.specs.Specs.rabbitmq_report_of_containers
rabbitmq_startup_err = insights.specs.Specs.rabbitmq_startup_err
rabbitmq_startup_log = insights.specs.Specs.rabbitmq_startup_log
rabbitmq_users = insights.specs.Specs.rabbitmq_users
rc_local = insights.specs.Specs.rc_local
rdma_conf = insights.specs.Specs.rdma_conf
recvq_socket_buffer = insights.specs.Specs.recvq_socket_buffer
redhat_release = insights.specs.Specs.redhat_release
resolv_conf = insights.specs.Specs.resolv_conf
rhev_data_center = insights.specs.Specs.rhev_data_center
rhn_charsets = insights.specs.Specs.rhn_charsets
rhn_conf = insights.specs.Specs.rhn_conf
rhn_entitlement_cert_xml = insights.specs.Specs.rhn_entitlement_cert_xml
rhn_hibernate_conf = insights.specs.Specs.rhn_hibernate_conf
rhn_schema_stats = insights.specs.Specs.rhn_schema_stats
rhn_schema_version = insights.specs.Specs.rhn_schema_version
rhn_search_daemon_log = insights.specs.Specs.rhn_search_daemon_log
rhn_server_satellite_log = insights.specs.Specs.rhn_server_satellite_log
rhn_server_xmlrpc_log = insights.specs.Specs.rhn_server_xmlrpc_log
rhn_taskomatic_daemon_log = insights.specs.Specs.rhn_taskomatic_daemon_log
rhosp_release = insights.specs.Specs.rhosp_release
rhsm_conf = insights.specs.Specs.rhsm_conf
rhsm_katello_default_ca_cert = insights.specs.Specs.rhsm_katello_default_ca_cert
rhsm_log = insights.specs.Specs.rhsm_log
rhsm_releasever = insights.specs.Specs.rhsm_releasever
rhv_log_collector_analyzer = insights.specs.Specs.rhv_log_collector_analyzer
rndc_status = insights.specs.Specs.rndc_status
root_crontab = insights.specs.Specs.root_crontab
route = insights.specs.Specs.route
rpm_V_packages = insights.specs.Specs.rpm_V_packages
rpm_ostree_status = insights.specs.Specs.rpm_ostree_status
rsyslog_conf = insights.specs.Specs.rsyslog_conf
samba = insights.specs.Specs.samba
samba_logs = insights.specs.Specs.samba_logs
sap_dev_disp = insights.specs.Specs.sap_dev_disp
sap_dev_rd = insights.specs.Specs.sap_dev_rd
sap_hana_landscape = insights.specs.Specs.sap_hana_landscape
sap_hdb_version = insights.specs.Specs.sap_hdb_version
sap_host_profile = insights.specs.Specs.sap_host_profile
sapcontrol_getsystemupdatelist = insights.specs.Specs.sapcontrol_getsystemupdatelist
saphostctl_getcimobject_sapinstance = insights.specs.Specs.saphostctl_getcimobject_sapinstance
saphostexec_status = insights.specs.Specs.saphostexec_status
saphostexec_version = insights.specs.Specs.saphostexec_version
sat5_insights_properties = insights.specs.Specs.sat5_insights_properties
satellite_compute_resources = insights.specs.Specs.satellite_compute_resources
satellite_content_hosts_count = insights.specs.Specs.satellite_content_hosts_count
satellite_custom_ca_chain = insights.specs.Specs.satellite_custom_ca_chain
satellite_custom_hiera = insights.specs.Specs.satellite_custom_hiera
satellite_enabled_features = insights.specs.Specs.satellite_enabled_features
satellite_mongodb_storage_engine = insights.specs.Specs.satellite_mongodb_storage_engine
satellite_non_yum_type_repos = insights.specs.Specs.satellite_non_yum_type_repos
satellite_settings = insights.specs.Specs.satellite_settings
satellite_version_rb = insights.specs.Specs.satellite_version_rb
sched_rt_runtime_us = insights.specs.Specs.sched_rt_runtime_us
scheduler = insights.specs.Specs.scheduler
scsi = insights.specs.Specs.scsi
scsi_eh_deadline = insights.specs.Specs.scsi_eh_deadline
scsi_fwver = insights.specs.Specs.scsi_fwver
scsi_mod_use_blk_mq = insights.specs.Specs.scsi_mod_use_blk_mq
sctp_asc = insights.specs.Specs.sctp_asc
sctp_eps = insights.specs.Specs.sctp_eps
sctp_snmp = insights.specs.Specs.sctp_snmp
sealert = insights.specs.Specs.sealert
secure = insights.specs.Specs.secure
selinux_config = insights.specs.Specs.selinux_config
sendq_socket_buffer = insights.specs.Specs.sendq_socket_buffer
sestatus = insights.specs.Specs.sestatus
setup_named_chroot = insights.specs.Specs.setup_named_chroot
smartctl = insights.specs.Specs.smartctl
smartpdc_settings = insights.specs.Specs.smartpdc_settings
smbstatus_S = insights.specs.Specs.smbstatus_S
smbstatus_p = insights.specs.Specs.smbstatus_p
sockstat = insights.specs.Specs.sockstat
softnet_stat = insights.specs.Specs.softnet_stat
software_collections_list = insights.specs.Specs.software_collections_list
spamassassin_channels = insights.specs.Specs.spamassassin_channels
spfile_ora = insights.specs.Specs.spfile_ora
ss = insights.specs.Specs.ss
ssh_config = insights.specs.Specs.ssh_config
ssh_config_d = insights.specs.Specs.ssh_config_d
ssh_foreman_config = insights.specs.Specs.ssh_foreman_config
ssh_foreman_proxy_config = insights.specs.Specs.ssh_foreman_proxy_config
sshd_config = insights.specs.Specs.sshd_config
sshd_config_perms = insights.specs.Specs.sshd_config_perms
sssd_config = insights.specs.Specs.sssd_config
sssd_logs = insights.specs.Specs.sssd_logs
subscription_manager_id = insights.specs.Specs.subscription_manager_id
subscription_manager_installed_product_ids = insights.specs.Specs.subscription_manager_installed_product_ids
subscription_manager_list_consumed = insights.specs.Specs.subscription_manager_list_consumed
subscription_manager_list_installed = insights.specs.Specs.subscription_manager_list_installed
subscription_manager_release_show = insights.specs.Specs.subscription_manager_release_show
swift_conf = insights.specs.Specs.swift_conf
swift_log = insights.specs.Specs.swift_log
swift_object_expirer_conf = insights.specs.Specs.swift_object_expirer_conf
swift_proxy_server_conf = insights.specs.Specs.swift_proxy_server_conf
sys_kernel_sched_features = insights.specs.Specs.sys_kernel_sched_features
sysconfig_chronyd = insights.specs.Specs.sysconfig_chronyd
sysconfig_httpd = insights.specs.Specs.sysconfig_httpd
sysconfig_irqbalance = insights.specs.Specs.sysconfig_irqbalance
sysconfig_kdump = insights.specs.Specs.sysconfig_kdump
sysconfig_libvirt_guests = insights.specs.Specs.sysconfig_libvirt_guests
sysconfig_memcached = insights.specs.Specs.sysconfig_memcached
sysconfig_mongod = insights.specs.Specs.sysconfig_mongod
sysconfig_network = insights.specs.Specs.sysconfig_network
sysconfig_ntpd = insights.specs.Specs.sysconfig_ntpd
sysconfig_sshd = insights.specs.Specs.sysconfig_sshd
sysconfig_virt_who = insights.specs.Specs.sysconfig_virt_who
sysctl = insights.specs.Specs.sysctl
sysctl_conf = insights.specs.Specs.sysctl_conf
sysctl_conf_initramfs = insights.specs.Specs.sysctl_conf_initramfs
systemctl_cat_rpcbind_socket = insights.specs.Specs.systemctl_cat_rpcbind_socket
systemctl_cinder_volume = insights.specs.Specs.systemctl_cinder_volume
systemctl_httpd = insights.specs.Specs.systemctl_httpd
systemctl_list_unit_files = insights.specs.Specs.systemctl_list_unit_files
systemctl_list_units = insights.specs.Specs.systemctl_list_units
systemctl_mariadb = insights.specs.Specs.systemctl_mariadb
systemctl_nginx = insights.specs.Specs.systemctl_nginx
systemctl_pulp_celerybeat = insights.specs.Specs.systemctl_pulp_celerybeat
systemctl_pulp_resmg = insights.specs.Specs.systemctl_pulp_resmg
systemctl_pulp_workers = insights.specs.Specs.systemctl_pulp_workers
systemctl_qdrouterd = insights.specs.Specs.systemctl_qdrouterd
systemctl_qpidd = insights.specs.Specs.systemctl_qpidd
systemctl_show_all_services = insights.specs.Specs.systemctl_show_all_services
systemctl_show_target = insights.specs.Specs.systemctl_show_target
systemctl_smartpdc = insights.specs.Specs.systemctl_smartpdc
systemd_analyze_blame = insights.specs.Specs.systemd_analyze_blame
systemd_docker = insights.specs.Specs.systemd_docker
systemd_logind_conf = insights.specs.Specs.systemd_logind_conf
systemd_openshift_node = insights.specs.Specs.systemd_openshift_node
systemd_system_conf = insights.specs.Specs.systemd_system_conf
systemd_system_origin_accounting = insights.specs.Specs.systemd_system_origin_accounting
systemid = insights.specs.Specs.systemid
systool_b_scsi_v = insights.specs.Specs.systool_b_scsi_v
tags = insights.specs.Specs.tags
teamdctl_config_dump = insights.specs.Specs.teamdctl_config_dump
teamdctl_state_dump = insights.specs.Specs.teamdctl_state_dump
testparm_s = insights.specs.Specs.testparm_s
testparm_v_s = insights.specs.Specs.testparm_v_s
thp_enabled = insights.specs.Specs.thp_enabled
thp_use_zero_page = insights.specs.Specs.thp_use_zero_page
tmpfilesd = insights.specs.Specs.tmpfilesd
tomcat_server_xml = insights.specs.Specs.tomcat_server_xml
tomcat_vdc_fallback = insights.specs.Specs.tomcat_vdc_fallback
tomcat_vdc_targeted = insights.specs.Specs.tomcat_vdc_targeted
tomcat_web_xml = insights.specs.Specs.tomcat_web_xml
tuned_adm = insights.specs.Specs.tuned_adm
tuned_conf = insights.specs.Specs.tuned_conf
udev_fc_wwpn_id_rules = insights.specs.Specs.udev_fc_wwpn_id_rules
udev_persistent_net_rules = insights.specs.Specs.udev_persistent_net_rules
uname = insights.specs.Specs.uname
up2date = insights.specs.Specs.up2date
up2date_log = insights.specs.Specs.up2date_log
uploader_log = insights.specs.Specs.uploader_log
uptime = insights.specs.Specs.uptime
usr_journald_conf_d = insights.specs.Specs.usr_journald_conf_d
var_qemu_xml = insights.specs.Specs.var_qemu_xml
vdo_status = insights.specs.Specs.vdo_status
vdsm_conf = insights.specs.Specs.vdsm_conf
vdsm_id = insights.specs.Specs.vdsm_id
vdsm_import_log = insights.specs.Specs.vdsm_import_log
vdsm_log = insights.specs.Specs.vdsm_log
vdsm_logger_conf = insights.specs.Specs.vdsm_logger_conf
version_info = insights.specs.Specs.version_info
vgdisplay = insights.specs.Specs.vgdisplay
vgs = insights.specs.Specs.vgs
vgs_noheadings = insights.specs.Specs.vgs_noheadings
vgs_noheadings_all = insights.specs.Specs.vgs_noheadings_all
vhost_net_zero_copy_tx = insights.specs.Specs.vhost_net_zero_copy_tx
virsh_list_all = insights.specs.Specs.virsh_list_all
virt_uuid_facts = insights.specs.Specs.virt_uuid_facts
virt_what = insights.specs.Specs.virt_what
virt_who_conf = insights.specs.Specs.virt_who_conf
virtlogd_conf = insights.specs.Specs.virtlogd_conf
vma_ra_enabled = insights.specs.Specs.vma_ra_enabled
vmcore_dmesg = insights.specs.Specs.vmcore_dmesg
vmware_tools_conf = insights.specs.Specs.vmware_tools_conf
vsftpd = insights.specs.Specs.vsftpd
vsftpd_conf = insights.specs.Specs.vsftpd_conf
x86_ibpb_enabled = insights.specs.Specs.x86_ibpb_enabled
x86_ibrs_enabled = insights.specs.Specs.x86_ibrs_enabled
x86_pti_enabled = insights.specs.Specs.x86_pti_enabled
x86_retp_enabled = insights.specs.Specs.x86_retp_enabled
xfs_info = insights.specs.Specs.xfs_info
xinetd_conf = insights.specs.Specs.xinetd_conf
yum_conf = insights.specs.Specs.yum_conf
yum_list_available = insights.specs.Specs.yum_list_available
yum_list_installed = insights.specs.Specs.yum_list_installed
yum_log = insights.specs.Specs.yum_log
yum_repolist = insights.specs.Specs.yum_repolist
yum_repos_d = insights.specs.Specs.yum_repos_d
yum_updateinfo = insights.specs.Specs.yum_updateinfo
zdump_v = insights.specs.Specs.zdump_v
zipl_conf = insights.specs.Specs.zipl_conf

## insights.specs.default¶

This module defines all datasources used by standard Red Hat Insight components.

To define data sources that override the components in this file, create a insights.core.spec_factory.SpecFactory with “insights.specs” as the constructor argument. Data sources created with that factory will override components in this file with the same name keyword argument. This allows overriding the data sources that standard Insights Parsers resolve against.

class insights.specs.default.DefaultSpecs[source]
abrt_ccpp_conf = <insights.core.spec_factory.simple_file object>
abrt_status_bare = <insights.core.spec_factory.simple_command object>
alternatives_display_python = <insights.core.spec_factory.simple_command object>
amq_broker = <insights.core.spec_factory.glob_file object>
audit_log = <insights.core.spec_factory.simple_file object>
auditctl_status = <insights.core.spec_factory.simple_command object>
auditd_conf = <insights.core.spec_factory.simple_file object>
avc_cache_threshold = <insights.core.spec_factory.simple_file object>
avc_hash_stats = <insights.core.spec_factory.simple_file object>
aws_instance_id_doc = <insights.core.spec_factory.simple_command object>
aws_instance_id_pkcs7 = <insights.core.spec_factory.simple_command object>
awx_manage_check_license = <insights.core.spec_factory.simple_command object>
azure_instance_plan = <insights.core.spec_factory.simple_command object>
azure_instance_type = <insights.core.spec_factory.simple_command object>
bios_uuid = <insights.core.spec_factory.simple_command object>
blkid = <insights.core.spec_factory.simple_command object>
bond = <insights.core.spec_factory.glob_file object>
bond_dynamic_lb = <insights.core.spec_factory.glob_file object>
boot_loader_entries = <insights.core.spec_factory.glob_file object>
branch_info = <insights.core.spec_factory.simple_file object>
brctl_show = <insights.core.spec_factory.simple_command object>
candlepin_log = <insights.core.spec_factory.simple_file object>
catalina_out = <insights.core.spec_factory.foreach_collect object>
cciss = <insights.core.spec_factory.glob_file object>
cdc_wdm = <insights.core.spec_factory.simple_file object>
ceilometer_collector_log = <insights.core.spec_factory.first_file object>
ceilometer_compute_log = <insights.core.spec_factory.first_file object>
ceilometer_conf = <insights.core.spec_factory.first_file object>
ceph_conf = <insights.core.spec_factory.first_file object>
ceph_df_detail = <insights.core.spec_factory.simple_command object>
ceph_health_detail = <insights.core.spec_factory.simple_command object>
ceph_insights = <insights.core.spec_factory.simple_command object>
ceph_log = <insights.core.spec_factory.glob_file object>
ceph_osd_dump = <insights.core.spec_factory.simple_command object>
ceph_osd_ec_profile_ls = <insights.core.spec_factory.simple_command object>
ceph_osd_log = <insights.core.spec_factory.glob_file object>
ceph_osd_tree = <insights.core.spec_factory.simple_command object>
ceph_s = <insights.core.spec_factory.simple_command object>
ceph_v = <insights.core.spec_factory.simple_command object>
certificates_enddate = <insights.core.spec_factory.simple_command object>
cgroups = <insights.core.spec_factory.simple_file object>
chkconfig = <insights.core.spec_factory.simple_command object>
chrony_conf = <insights.core.spec_factory.simple_file object>
chronyc_sources = <insights.core.spec_factory.simple_command object>
cib_xml = <insights.core.spec_factory.simple_file object>
cinder_api_log = <insights.core.spec_factory.first_file object>
cinder_conf = <insights.core.spec_factory.first_file object>
cinder_volume_log = <insights.core.spec_factory.first_file object>
cloud_cfg()[source]

This datasource provides the network configuration collected from /etc/cloud/cloud.cfg.

Typical content of /etc/cloud/cloud.cfg file is:

#cloud-config
users:
- name: demo
ssh-authorized-keys:
- key_one
- key_two
passwd: $6$j212wezy\$7H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7MbYCarYeAHWYPYb2FT.lbioDm2RrkJPb9BZMN1O/

network:
version: 1
config:
- type: physical
name: eth0
subnets:
- type: dhcp
- type: dhcp6

system_info:
default_user:
name: user2
plain_text_passwd: 'someP@assword'
home: /home/user2

debug:
output: /var/log/cloud-init-debug.log
verbose: true


Note

This datasource may be executed using the following command:

insights-cat --no-header cloud_cfg

Example

{"version": 1, "config": [{"type": "physical", "name": "eth0", "subnets": [{"type": "dhcp"}, {"type": "dhcp6"}]}]}

Returns

JSON string when the network parameter is configure, else nothing is returned.

Return type

str

Raises

SkipComponent -- When the path does not exist or any exception occurs.

cloud_cfg_input = <insights.core.spec_factory.simple_file object>
cloud_init_custom_network = <insights.core.spec_factory.simple_file object>
cloud_init_log = <insights.core.spec_factory.simple_file object>
cluster_conf = <insights.core.spec_factory.simple_file object>
cmd_and_pkg()[source]
Returns

List of the command and provider package string of the specified commands.

Return type

list

COMMANDS

List of the specified commands that need to check the provider package.

Type

list

cmdline = <insights.core.spec_factory.simple_file object>
corosync = <insights.core.spec_factory.simple_file object>
corosync_cmapctl = <insights.core.spec_factory.foreach_execute object>
corosync_cmapctl_cmd_list()[source]

corosync-cmapctl add different arguments on RHEL7 and RHEL8.

Returns

A list of related corosync-cmapctl commands based the RHEL version.

Return type

list

corosync_conf = <insights.core.spec_factory.simple_file object>
cpu_cores = <insights.core.spec_factory.glob_file object>
cpu_siblings = <insights.core.spec_factory.glob_file object>
cpu_smt_active = <insights.core.spec_factory.simple_file object>
cpu_vulns = <insights.core.spec_factory.glob_file object>
cpuinfo = <insights.core.spec_factory.simple_file object>
cpupower_frequency_info = <insights.core.spec_factory.simple_command object>
cpuset_cpus = <insights.core.spec_factory.simple_file object>
cron_daily_rhsmd = <insights.core.spec_factory.simple_file object>
crypto_policies_bind = <insights.core.spec_factory.simple_file object>
crypto_policies_config = <insights.core.spec_factory.simple_file object>
crypto_policies_opensshserver = <insights.core.spec_factory.simple_file object>
crypto_policies_state_current = <insights.core.spec_factory.simple_file object>
current_clocksource = <insights.core.spec_factory.simple_file object>
date = <insights.core.spec_factory.simple_command object>
date_utc = <insights.core.spec_factory.simple_command object>
designate_conf = <insights.core.spec_factory.first_file object>
df__al = <insights.core.spec_factory.simple_command object>
df__alP = <insights.core.spec_factory.simple_command object>
df__li = <insights.core.spec_factory.simple_command object>
dig_dnssec = <insights.core.spec_factory.simple_command object>
dig_edns = <insights.core.spec_factory.simple_command object>
dig_noedns = <insights.core.spec_factory.simple_command object>
dirsrv_errors = <insights.core.spec_factory.glob_file object>
dm_mod_use_blk_mq = <insights.core.spec_factory.simple_file object>
dmesg = <insights.core.spec_factory.simple_command object>
dmesg_log = <insights.core.spec_factory.simple_file object>
dmidecode = <insights.core.spec_factory.simple_command object>
dmsetup_info = <insights.core.spec_factory.simple_command object>
dmsetup_status = <insights.core.spec_factory.simple_command object>
dnf_conf = <insights.core.spec_factory.simple_file object>
dnf_modules = <insights.core.spec_factory.glob_file object>
docker_info = <insights.core.spec_factory.simple_command object>
docker_list_containers = <insights.core.spec_factory.simple_command object>
docker_list_images = <insights.core.spec_factory.simple_command object>
docker_storage_setup = <insights.core.spec_factory.simple_file object>
docker_sysconfig = <insights.core.spec_factory.simple_file object>
dotnet_version = <insights.core.spec_factory.simple_command object>
doveconf = <insights.core.spec_factory.simple_command object>
dracut_kdump_capture_service = <insights.core.spec_factory.simple_file object>
du_dirs = <insights.core.spec_factory.foreach_execute object>
du_dirs_list()[source]

Provide a list of directorys for the du_dirs spec to scan

engine_db_query_vdsm_version = <insights.core.spec_factory.simple_command object>
engine_log = <insights.core.spec_factory.simple_file object>
etc_and_sub_dirs = ['/etc', '/etc/cloud/cloud.cfg.d', '/etc/nova/migration', '/etc/pki/ovirt-vmconsole', '/etc/pki/tls/certs', '/etc/pki/tls/private', '/etc/rc.d/init.d', '/etc/sysconfig']
etc_journald_conf = <insights.core.spec_factory.simple_file object>
etc_journald_conf_d = <insights.core.spec_factory.glob_file object>
etc_machine_id = <insights.core.spec_factory.simple_file object>
etc_udev_40_redhat_rules = <insights.core.spec_factory.first_file object>
etcd_conf = <insights.core.spec_factory.simple_file object>
ethernet_interfaces = <insights.core.spec_factory.listdir object>
ethtool = <insights.core.spec_factory.foreach_execute object>
ethtool_S = <insights.core.spec_factory.foreach_execute object>
ethtool_T = <insights.core.spec_factory.foreach_execute object>
ethtool_c = <insights.core.spec_factory.foreach_execute object>
ethtool_g = <insights.core.spec_factory.foreach_execute object>
ethtool_i = <insights.core.spec_factory.foreach_execute object>
ethtool_k = <insights.core.spec_factory.foreach_execute object>
facter = <insights.core.spec_factory.simple_command object>
fc_match = <insights.core.spec_factory.simple_command object>
fcoeadm_i = <insights.core.spec_factory.simple_command object>
findmnt_lo_propagation = <insights.core.spec_factory.simple_command object>
firewall_cmd_list_all_zones = <insights.core.spec_factory.simple_command object>
firewalld_conf = <insights.core.spec_factory.simple_file object>
fstab = <insights.core.spec_factory.simple_file object>
galera_cnf = <insights.core.spec_factory.first_file object>
gcp_license_codes = <insights.core.spec_factory.simple_command object>
getconf_page_size = <insights.core.spec_factory.simple_command object>
getenforce = <insights.core.spec_factory.simple_command object>
getsebool = <insights.core.spec_factory.simple_command object>
gfs2_file_system_block_size = <insights.core.spec_factory.foreach_execute object>
gfs2_mount_points()[source]

Function to search the output of mount to find all the gfs2 file systems. And only run the stat command on RHEL version that’s less than 8.3. With 8.3 and later, the command blkid will also output the block size info.

Returns

a list of mount points of which the file system type is gfs2

Return type

list

gluster_v_info = <insights.core.spec_factory.simple_command object>
gnocchi_conf = <insights.core.spec_factory.first_file object>
gnocchi_metricd_log = <insights.core.spec_factory.first_file object>
greenboot_status = <insights.core.spec_factory.simple_command object>
grub1_config_perms = <insights.core.spec_factory.simple_command object>
grub2_cfg = <insights.core.spec_factory.simple_file object>
grub2_efi_cfg = <insights.core.spec_factory.simple_file object>
grub_conf = <insights.core.spec_factory.simple_file object>
grub_config_perms = <insights.core.spec_factory.simple_command object>
grub_efi_conf = <insights.core.spec_factory.simple_file object>
grubby_default_index = <insights.core.spec_factory.simple_command object>
grubby_default_kernel = <insights.core.spec_factory.simple_command object>
hammer_task_list = <insights.core.spec_factory.simple_command object>
haproxy_cfg = <insights.core.spec_factory.first_file object>
heat_api_log = <insights.core.spec_factory.first_file object>
heat_conf = <insights.core.spec_factory.first_file object>
hostname = <insights.core.spec_factory.simple_command object>
hostname_default = <insights.core.spec_factory.simple_command object>
hostname_short = <insights.core.spec_factory.simple_command object>
hosts = <insights.core.spec_factory.simple_file object>
httpd24_httpd_error_log = <insights.core.spec_factory.simple_file object>
httpd_M = <insights.core.spec_factory.foreach_execute object>
httpd_V = <insights.core.spec_factory.foreach_execute object>
httpd_cmd()[source]

Function to search the output of ps auxcww to find all running Apache webserver processes and extract the binary path.

Returns

List of the binary paths to each running process

Return type

list

httpd_conf = <insights.core.spec_factory.glob_file object>
httpd_conf_scl_httpd24 = <insights.core.spec_factory.glob_file object>
httpd_conf_scl_jbcs_httpd24 = <insights.core.spec_factory.glob_file object>
httpd_error_log = <insights.core.spec_factory.simple_file object>
httpd_limits = <insights.core.spec_factory.foreach_collect object>
httpd_pid = <insights.core.spec_factory.simple_command object>
ifcfg = <insights.core.spec_factory.glob_file object>
ifcfg_static_route = <insights.core.spec_factory.glob_file object>
imagemagick_policy = <insights.core.spec_factory.glob_file object>
init_process_cgroup = <insights.core.spec_factory.simple_file object>
initctl_lst = <insights.core.spec_factory.simple_command object>
insights_client_conf = <insights.core.spec_factory.simple_file object>
installed_rpms = <insights.core.spec_factory.simple_command object>
interrupts = <insights.core.spec_factory.simple_file object>
ip6tables = <insights.core.spec_factory.simple_command object>
ip_addr = <insights.core.spec_factory.simple_command object>
ip_addresses = <insights.core.spec_factory.simple_command object>
ip_route_show_table_all = <insights.core.spec_factory.simple_command object>
ipaupgrade_log = <insights.core.spec_factory.simple_file object>
ipcs_m = <insights.core.spec_factory.simple_command object>
ipcs_m_p = <insights.core.spec_factory.simple_command object>
ipcs_s = <insights.core.spec_factory.simple_command object>
ipsec_conf = <insights.core.spec_factory.simple_file object>
iptables = <insights.core.spec_factory.simple_command object>
iptables_permanent = <insights.core.spec_factory.simple_file object>
ipv4_neigh = <insights.core.spec_factory.simple_command object>
ipv6_neigh = <insights.core.spec_factory.simple_command object>
ironic_inspector_log = <insights.core.spec_factory.first_file object>
is_aws()[source]

bool: Returns True if this node is identified as running in AWS

is_azure()[source]

bool: Returns True if this node is identified as running in Azure

is_ceph_monitor()[source]

bool: Returns True if ceph monitor process ceph-mon is running on this node

is_gcp()[source]

bool: Returns True if this node is identified as running in GCP

is_mod_loaded_for_ss()[source]

bool: Returns True if the kernel modules required by ss -tupna command are loaded.

is_satellite_capsule()[source]

bool: Returns True if the host is satellite capsule.

is_satellite_server()[source]

bool: Returns True if the host is satellite server.

iscsiadm_m_session = <insights.core.spec_factory.simple_command object>
jbcs_httpd24_httpd_error_log = <insights.core.spec_factory.simple_file object>
kdump_conf = <insights.core.spec_factory.simple_file object>
kernel_config = <insights.core.spec_factory.glob_file object>
kexec_crash_size = <insights.core.spec_factory.simple_file object>
keystone_crontab = <insights.core.spec_factory.simple_command object>
kpatch_list = <insights.core.spec_factory.simple_command object>
krb5 = <insights.core.spec_factory.glob_file object>
ksmstate = <insights.core.spec_factory.simple_file object>
kubepods_cpu_quota = <insights.core.spec_factory.glob_file object>
last_upload_globs = ['/etc/redhat-access-insights/.lastupload', '/etc/insights-client/.lastupload']
lastupload = <insights.core.spec_factory.glob_file object>
ld_library_path_of_user()[source]
Returns: The list of LD_LIBRARY_PATH of specified users.

Username is combined from SAP <SID> and ‘adm’ and is also stored.

libssh_client_config = <insights.core.spec_factory.simple_file object>
libssh_server_config = <insights.core.spec_factory.simple_file object>
libvirtd_log = <insights.core.spec_factory.simple_file object>
limits_conf = <insights.core.spec_factory.glob_file object>
localtime = <insights.core.spec_factory.simple_command object>
logrotate_conf = <insights.core.spec_factory.glob_file object>
lpstat_p = <insights.core.spec_factory.simple_command object>
ls_R_var_lib_nova_instances = <insights.core.spec_factory.simple_command object>
ls_boot = <insights.core.spec_factory.simple_command object>
ls_dev = <insights.core.spec_factory.simple_command object>
ls_disk = <insights.core.spec_factory.simple_command object>
ls_edac_mc = <insights.core.spec_factory.simple_command object>
ls_etc = <insights.core.spec_factory.simple_command object>
ls_ipa_idoverride_memberof = <insights.core.spec_factory.simple_command object>
ls_lib_firmware = <insights.core.spec_factory.simple_command object>
ls_ocp_cni_openshift_sdn = <insights.core.spec_factory.simple_command object>
ls_origin_local_volumes_pods = <insights.core.spec_factory.simple_command object>
ls_osroot = <insights.core.spec_factory.simple_command object>
ls_run_systemd_generator = <insights.core.spec_factory.simple_command object>
ls_sys_firmware = <insights.core.spec_factory.simple_command object>
ls_tmp = <insights.core.spec_factory.simple_command object>
ls_usr_bin = <insights.core.spec_factory.simple_command object>
ls_usr_lib64 = <insights.core.spec_factory.simple_command object>
ls_var_cache_pulp = <insights.core.spec_factory.simple_command object>
ls_var_lib_mongodb = <insights.core.spec_factory.simple_command object>
ls_var_lib_nova_instances = <insights.core.spec_factory.simple_command object>
ls_var_log = <insights.core.spec_factory.simple_command object>
ls_var_opt_mssql = <insights.core.spec_factory.simple_command object>
ls_var_opt_mssql_log = <insights.core.spec_factory.simple_command object>
ls_var_run = <insights.core.spec_factory.simple_command object>
ls_var_spool_clientmq = <insights.core.spec_factory.simple_command object>
ls_var_spool_postfix_maildrop = <insights.core.spec_factory.simple_command object>
ls_var_tmp = <insights.core.spec_factory.simple_command object>
ls_var_www = <insights.core.spec_factory.simple_command object>
lsblk = <insights.core.spec_factory.simple_command object>
lsblk_pairs = <insights.core.spec_factory.simple_command object>
lscpu = <insights.core.spec_factory.simple_command object>
lsmod = <insights.core.spec_factory.simple_command object>
lsof = <insights.core.spec_factory.simple_command object>
lspci = <insights.core.spec_factory.simple_command object>
lspci_vmmkn = <insights.core.spec_factory.simple_command object>
lsscsi = <insights.core.spec_factory.simple_command object>
lsvmbus = <insights.core.spec_factory.simple_command object>
lvm_conf = <insights.core.spec_factory.simple_file object>
lvs_noheadings = <insights.core.spec_factory.simple_command object>
mac_addresses = <insights.core.spec_factory.glob_file object>
machine_id = <insights.core.spec_factory.first_file object>
mariadb_log = <insights.core.spec_factory.simple_file object>
max_uid = <insights.core.spec_factory.simple_command object>
md5chk_file_list()[source]

Provide a list of files to be processed by the md5chk_files spec

md5chk_files = <insights.core.spec_factory.foreach_execute object>
md_device_list()[source]
mdadm_E = <insights.core.spec_factory.foreach_execute object>
mdstat = <insights.core.spec_factory.simple_file object>
meminfo = <insights.core.spec_factory.first_file object>
messages = <insights.core.spec_factory.simple_file object>
modinfo_i40e = <insights.core.spec_factory.simple_command object>
modinfo_igb = <insights.core.spec_factory.simple_command object>
modinfo_ixgbe = <insights.core.spec_factory.simple_command object>
modinfo_veth = <insights.core.spec_factory.simple_command object>
modinfo_vmxnet3 = <insights.core.spec_factory.simple_command object>
modprobe = <insights.core.spec_factory.glob_file object>
mokutil_sbstate = <insights.core.spec_factory.simple_command object>
mongod_conf = <insights.core.spec_factory.glob_file object>
mount = <insights.core.spec_factory.simple_command object>
mounts = <insights.core.spec_factory.simple_file object>
mssql_conf = <insights.core.spec_factory.simple_file object>
multicast_querier = <insights.core.spec_factory.simple_command object>
multipath__v4__ll = <insights.core.spec_factory.simple_command object>
multipath_conf = <insights.core.spec_factory.simple_file object>
multipath_conf_initramfs = <insights.core.spec_factory.simple_command object>
mysql_log = <insights.core.spec_factory.glob_file object>
mysqladmin_vars = <insights.core.spec_factory.simple_command object>
named_checkconf_p = <insights.core.spec_factory.simple_command object>
named_conf = <insights.core.spec_factory.simple_file object>
namespace = <insights.core.spec_factory.simple_command object>
ndctl_list_Ni = <insights.core.spec_factory.simple_command object>
netconsole = <insights.core.spec_factory.simple_file object>
netstat = <insights.core.spec_factory.simple_command object>
netstat_agn = <insights.core.spec_factory.simple_command object>
netstat_i = <insights.core.spec_factory.simple_command object>
netstat_s = <insights.core.spec_factory.simple_command object>
networkmanager_conf = <insights.core.spec_factory.simple_file object>
networkmanager_dispatcher_d = <insights.core.spec_factory.glob_file object>
neutron_conf = <insights.core.spec_factory.first_file object>
neutron_dhcp_agent_ini = <insights.core.spec_factory.first_file object>
neutron_l3_agent_ini = <insights.core.spec_factory.first_file object>
neutron_l3_agent_log = <insights.core.spec_factory.first_file object>
neutron_metadata_agent_ini = <insights.core.spec_factory.first_file object>
neutron_metadata_agent_log = <insights.core.spec_factory.first_file object>
neutron_ovs_agent_log = <insights.core.spec_factory.first_file object>
neutron_plugin_ini = <insights.core.spec_factory.first_file object>
neutron_sriov_agent = <insights.core.spec_factory.first_file object>
nfs_exports = <insights.core.spec_factory.simple_file object>
nfs_exports_d = <insights.core.spec_factory.glob_file object>
nginx_conf = <insights.core.spec_factory.glob_file object>
nmcli_conn_show = <insights.core.spec_factory.simple_command object>
nmcli_dev_show = <insights.core.spec_factory.simple_command object>
nova_api_log = <insights.core.spec_factory.first_file object>
nova_compute_log = <insights.core.spec_factory.first_file object>
nova_conf = <insights.core.spec_factory.first_file object>
nova_crontab = <insights.core.spec_factory.simple_command object>
nova_uid = <insights.core.spec_factory.simple_command object>
nscd_conf = <insights.core.spec_factory.simple_file object>
nsswitch_conf = <insights.core.spec_factory.simple_file object>
ntp_conf = <insights.core.spec_factory.simple_file object>
ntpq_leap = <insights.core.spec_factory.simple_command object>
ntptime = <insights.core.spec_factory.simple_command object>
numa_cpus = <insights.core.spec_factory.glob_file object>
numeric_user_group_name = <insights.core.spec_factory.simple_command object>
nvme_core_io_timeout = <insights.core.spec_factory.simple_file object>
oc_get_clusterrole_with_config = <insights.core.spec_factory.simple_command object>
oc_get_clusterrolebinding_with_config = <insights.core.spec_factory.simple_command object>
odbc_ini = <insights.core.spec_factory.simple_file object>
odbcinst_ini = <insights.core.spec_factory.simple_file object>
open_vm_tools_stat_raw_text_session = <insights.core.spec_factory.simple_command object>
openshift_hosts = <insights.core.spec_factory.simple_file object>
openshift_router_environ = <insights.core.spec_factory.foreach_collect object>
openshift_router_pid = <insights.core.spec_factory.simple_command object>
openvswitch_other_config = <insights.core.spec_factory.simple_command object>
os_release = <insights.core.spec_factory.simple_file object>
ose_master_config = <insights.core.spec_factory.simple_file object>
ose_node_config = <insights.core.spec_factory.simple_file object>
ovirt_engine_server_log = <insights.core.spec_factory.simple_file object>
ovirt_engine_ui_log = <insights.core.spec_factory.simple_file object>
ovs_vsctl_list_bridge = <insights.core.spec_factory.simple_command object>
ovs_vsctl_show = <insights.core.spec_factory.simple_command object>
pacemaker_log = <insights.core.spec_factory.first_file object>
package_provides_command = <insights.core.spec_factory.command_with_args object>
package_provides_java = <insights.core.spec_factory.foreach_execute object>
passenger_status = <insights.core.spec_factory.simple_command object>
password_auth = <insights.core.spec_factory.simple_file object>
pci_rport_target_disk_paths = <insights.core.spec_factory.simple_command object>
pcp_enabled()[source]

bool: Returns True if pmproxy service is on in services

pcp_metrics = <insights.core.spec_factory.simple_command object>
pcs_quorum_status = <insights.core.spec_factory.simple_command object>
pcs_status = <insights.core.spec_factory.simple_command object>
php_ini = <insights.core.spec_factory.first_file object>
pluginconf_d = <insights.core.spec_factory.glob_file object>
pmlog_summary = <insights.core.spec_factory.command_with_args object>
pmlog_summary_file()[source]

Determines the name for the pmlogger file and checks for its existance

Returns the name of the latest pmlogger summary file if a running pmlogger process is detected on the system.

Returns

Full path to the latest pmlogger file

Return type

str

Raises

SkipComponent -- raises this exception when the command is not present or the file is not present

pmrep_metrics = <insights.core.spec_factory.simple_command object>
postconf = <insights.core.spec_factory.simple_command object>
postconf_builtin = <insights.core.spec_factory.simple_command object>
postgresql_conf = <insights.core.spec_factory.first_file object>
postgresql_log = <insights.core.spec_factory.first_of object>
proc_netstat = <insights.core.spec_factory.simple_file object>
proc_slabinfo = <insights.core.spec_factory.simple_file object>
proc_snmp_ipv4 = <insights.core.spec_factory.simple_file object>
proc_snmp_ipv6 = <insights.core.spec_factory.simple_file object>
proc_stat = <insights.core.spec_factory.simple_file object>
ps_alxwww = <insights.core.spec_factory.simple_command object>
ps_aux = <insights.core.spec_factory.simple_command object>
ps_auxcww = <insights.core.spec_factory.simple_command object>
ps_auxww = <insights.core.spec_factory.simple_command object>
ps_ef = <insights.core.spec_factory.simple_command object>
ps_eo = <insights.core.spec_factory.simple_command object>
pulp_worker_defaults = <insights.core.spec_factory.simple_file object>
puppet_ca_cert_expire_date = <insights.core.spec_factory.simple_command object>
puppetserver_config = <insights.core.spec_factory.simple_file object>
pvs_noheadings = <insights.core.spec_factory.simple_command object>
qemu_conf = <insights.core.spec_factory.simple_file object>
qemu_xml = <insights.core.spec_factory.glob_file object>
qpidd_conf = <insights.core.spec_factory.simple_file object>
rabbitmq_env = <insights.core.spec_factory.simple_file object>
rabbitmq_report = <insights.core.spec_factory.simple_command object>
rabbitmq_startup_log = <insights.core.spec_factory.simple_file object>
rabbitmq_users = <insights.core.spec_factory.simple_command object>
rc_local = <insights.core.spec_factory.simple_file object>
rdma_conf = <insights.core.spec_factory.simple_file object>
redhat_release = <insights.core.spec_factory.simple_file object>
resolv_conf = <insights.core.spec_factory.simple_file object>
rhn_conf = <insights.core.spec_factory.first_file object>
rhsm_conf = <insights.core.spec_factory.simple_file object>
rhsm_katello_default_ca_cert = <insights.core.spec_factory.simple_command object>
rhsm_log = <insights.core.spec_factory.simple_file object>
rhsm_releasever = <insights.core.spec_factory.simple_file object>
rndc_status = <insights.core.spec_factory.simple_command object>
rpm_V_packages = <insights.core.spec_factory.simple_command object>
rpm_format = '\\{"name":"%{NAME}","epoch":"%{EPOCH}","version":"%{VERSION}","release":"%{RELEASE}","arch":"%{ARCH}","installtime":"%{INSTALLTIME:date}","buildtime":"%{BUILDTIME}","vendor":"%{VENDOR}","buildhost":"%{BUILDHOST}","sigpgp":"%{SIGPGP:pgpsig}"\\}\n'
rpm_ostree_status = <insights.core.spec_factory.simple_command object>
rsyslog_conf = <insights.core.spec_factory.glob_file object>
samba = <insights.core.spec_factory.simple_file object>
sap_hana_instance()[source]

list: List of the SAP HANA Instances.

sap_hana_landscape = <insights.core.spec_factory.foreach_execute object>
sap_hana_sid()[source]

list: List of the SID of SAP HANA Instances.

sap_hana_sid_SID_nr()[source]

list: List of tuples (sid, SID, Nr) of SAP HANA Instances.

sap_hdb_version = <insights.core.spec_factory.foreach_execute object>
sap_instance()[source]

list: List of all SAP Instances.

sap_sid()[source]

list: List of the SID of all the SAP Instances.

saphostctl_getcimobject_sapinstance = <insights.core.spec_factory.simple_command object>
saphostexec_status = <insights.core.spec_factory.simple_command object>
saphostexec_version = <insights.core.spec_factory.simple_command object>
sat5_insights_properties = <insights.core.spec_factory.simple_file object>
satellite_compute_resources = <insights.core.spec_factory.simple_command object>
satellite_content_hosts_count = <insights.core.spec_factory.simple_command object>
satellite_custom_ca_chain = <insights.core.spec_factory.simple_command object>
satellite_custom_hiera = <insights.core.spec_factory.simple_file object>
satellite_mongodb_storage_engine = <insights.core.spec_factory.simple_command object>
satellite_non_yum_type_repos = <insights.core.spec_factory.simple_command object>
satellite_settings = <insights.core.spec_factory.simple_command object>
satellite_version_rb = <insights.core.spec_factory.simple_file object>
scheduler = <insights.core.spec_factory.glob_file object>
scsi = <insights.core.spec_factory.simple_file object>
scsi_eh_deadline = <insights.core.spec_factory.glob_file object>
scsi_fwver = <insights.core.spec_factory.glob_file object>
scsi_mod_use_blk_mq = <insights.core.spec_factory.simple_file object>
sctp_asc = <insights.core.spec_factory.simple_file object>
sctp_eps = <insights.core.spec_factory.simple_file object>
sctp_snmp = <insights.core.spec_factory.simple_file object>
sealert = <insights.core.spec_factory.simple_command object>
selinux_config = <insights.core.spec_factory.simple_file object>
sestatus = <insights.core.spec_factory.simple_command object>
setup_named_chroot = <insights.core.spec_factory.simple_file object>
smartpdc_settings = <insights.core.spec_factory.simple_file object>
smbstatus_p = <insights.core.spec_factory.simple_command object>
sockstat = <insights.core.spec_factory.simple_file object>
softnet_stat = <insights.core.spec_factory.simple_file object>
software_collections_list = <insights.core.spec_factory.simple_command object>
spamassassin_channels = <insights.core.spec_factory.simple_command object>
ss = <insights.core.spec_factory.simple_command object>
ssh_config = <insights.core.spec_factory.simple_file object>
ssh_config_d = <insights.core.spec_factory.glob_file object>
ssh_foreman_proxy_config = <insights.core.spec_factory.simple_file object>
sshd_config = <insights.core.spec_factory.simple_file object>
sshd_config_perms = <insights.core.spec_factory.simple_command object>
sssd_config = <insights.core.spec_factory.simple_file object>
subscription_manager_id = <insights.core.spec_factory.simple_command object>
subscription_manager_installed_product_ids = <insights.core.spec_factory.simple_command object>
swift_object_expirer_conf = <insights.core.spec_factory.first_file object>
swift_proxy_server_conf = <insights.core.spec_factory.first_file object>
sysconfig_kdump = <insights.core.spec_factory.simple_file object>
sysconfig_libvirt_guests = <insights.core.spec_factory.simple_file object>
sysconfig_network = <insights.core.spec_factory.simple_file object>
sysconfig_ntpd = <insights.core.spec_factory.simple_file object>
sysconfig_sshd = <insights.core.spec_factory.simple_file object>
sysconfig_virt_who = <insights.core.spec_factory.simple_file object>
sysctl = <insights.core.spec_factory.simple_command object>
sysctl_conf = <insights.core.spec_factory.simple_file object>
systemctl_cat_rpcbind_socket = <insights.core.spec_factory.simple_command object>
systemctl_cinder_volume = <insights.core.spec_factory.simple_command object>
systemctl_httpd = <insights.core.spec_factory.simple_command object>
systemctl_list_unit_files = <insights.core.spec_factory.simple_command object>
systemctl_list_units = <insights.core.spec_factory.simple_command object>
systemctl_mariadb = <insights.core.spec_factory.simple_command object>
systemctl_nginx = <insights.core.spec_factory.simple_command object>
systemctl_qdrouterd = <insights.core.spec_factory.simple_command object>
systemctl_qpidd = <insights.core.spec_factory.simple_command object>
systemctl_show_all_services = <insights.core.spec_factory.simple_command object>
systemctl_show_target = <insights.core.spec_factory.simple_command object>
systemctl_smartpdc = <insights.core.spec_factory.simple_command object>
systemd_analyze_blame = <insights.core.spec_factory.simple_command object>
systemd_docker = <insights.core.spec_factory.simple_command object>
systemd_logind_conf = <insights.core.spec_factory.simple_file object>
systemd_openshift_node = <insights.core.spec_factory.simple_command object>
systemd_system_conf = <insights.core.spec_factory.simple_file object>
systemid = <insights.core.spec_factory.first_of object>
systool_b_scsi_v = <insights.core.spec_factory.simple_command object>
tags = <insights.core.spec_factory.simple_file object>
testparm_s = <insights.core.spec_factory.simple_command object>
testparm_v_s = <insights.core.spec_factory.simple_command object>
thp_enabled = <insights.core.spec_factory.simple_file object>
thp_use_zero_page = <insights.core.spec_factory.simple_file object>
tmpfilesd = <insights.core.spec_factory.glob_file object>
tomcat_base()[source]

Function to search the output of ps auxww to find all running tomcat processes and extract the base path where the process was started.

Returns

List of the paths to each running process

Return type

list

tomcat_vdc_fallback = <insights.core.spec_factory.simple_command object>
tuned_adm = <insights.core.spec_factory.simple_command object>
udev_fc_wwpn_id_rules = <insights.core.spec_factory.simple_file object>
uname = <insights.core.spec_factory.simple_command object>
up2date = <insights.core.spec_factory.simple_file object>
up2date_log = <insights.core.spec_factory.simple_file object>
uptime = <insights.core.spec_factory.simple_command object>
usr_journald_conf_d = <insights.core.spec_factory.glob_file object>
vdo_status = <insights.core.spec_factory.simple_command object>
vdsm_log = <insights.core.spec_factory.simple_file object>
vdsm_logger_conf = <insights.core.spec_factory.simple_file object>
version_info = <insights.core.spec_factory.simple_file object>
vgdisplay = <insights.core.spec_factory.simple_command object>
vgs_noheadings = <insights.core.spec_factory.simple_command object>
vhost_net_zero_copy_tx = <insights.core.spec_factory.simple_file object>
virsh_list_all = <insights.core.spec_factory.simple_command object>
virt_uuid_facts = <insights.core.spec_factory.simple_file object>
virt_what = <insights.core.spec_factory.simple_command object>
virt_who_conf = <insights.core.spec_factory.glob_file object>
virtlogd_conf = <insights.core.spec_factory.simple_file object>
vma_ra_enabled = <insights.core.spec_factory.simple_file object>
vsftpd = <insights.core.spec_factory.simple_file object>
vsftpd_conf = <insights.core.spec_factory.simple_file object>
x86_ibpb_enabled = <insights.core.spec_factory.simple_file object>
x86_ibrs_enabled = <insights.core.spec_factory.simple_file object>
x86_pti_enabled = <insights.core.spec_factory.simple_file object>
x86_retp_enabled = <insights.core.spec_factory.simple_file object>
xinetd_conf = <insights.core.spec_factory.glob_file object>
yum_conf = <insights.core.spec_factory.simple_file object>
yum_list_available = <insights.core.spec_factory.simple_command object>
yum_log = <insights.core.spec_factory.simple_file object>
yum_repolist = <insights.core.spec_factory.simple_command object>
yum_repos_d = <insights.core.spec_factory.glob_file object>
yum_updateinfo = <insights.core.spec_factory.simple_command object>
zipl_conf = <insights.core.spec_factory.simple_file object>
insights.specs.default.format_rpm(idx=None)
insights.specs.default.get_owner(filename)[source]

tuple: Return tuple containing uid and gid of file filename

## insights.specs.insights_archive¶

class insights.specs.insights_archive.InsightsArchiveSpecs[source]
abrt_status_bare = <insights.core.spec_factory.simple_file object>
all_installed_rpms = <insights.core.spec_factory.glob_file object>
alternatives_display_python = <insights.core.spec_factory.simple_file object>
ansible_host = <insights.core.spec_factory.simple_file object>
auditctl_status = <insights.core.spec_factory.simple_file object>
aws_instance_id_doc = <insights.core.spec_factory.simple_file object>
aws_instance_id_pkcs7 = <insights.core.spec_factory.simple_file object>
awx_manage_check_license = <insights.core.spec_factory.simple_file object>
azure_instance_plan = <insights.core.spec_factory.simple_file object>
azure_instance_type = <insights.core.spec_factory.simple_file object>
bios_uuid = <insights.core.spec_factory.simple_file object>
blkid = <insights.core.spec_factory.simple_file object>
brctl_show = <insights.core.spec_factory.simple_file object>
ceph_df_detail = <insights.core.spec_factory.first_file object>
ceph_health_detail = <insights.core.spec_factory.first_file object>
ceph_insights = <insights.core.spec_factory.simple_file object>
ceph_osd_dump = <insights.core.spec_factory.first_file object>
ceph_osd_tree = <insights.core.spec_factory.first_file object>
ceph_s = <insights.core.spec_factory.first_file object>
ceph_v = <insights.core.spec_factory.simple_file object>
certificates_enddate = <insights.core.spec_factory.first_file object>
chkconfig = <insights.core.spec_factory.simple_file object>
chronyc_sources = <insights.core.spec_factory.simple_file object>
corosync_cmapctl = <insights.core.spec_factory.glob_file object>
cpupower_frequency_info = <insights.core.spec_factory.simple_file object>
date = <insights.core.spec_factory.simple_file object>
date_utc = <insights.core.spec_factory.simple_file object>
df__al = <insights.core.spec_factory.first_file object>
df__alP = <insights.core.spec_factory.first_file object>
df__li = <insights.core.spec_factory.first_file object>
dig_dnssec = <insights.core.spec_factory.simple_file object>
dig_edns = <insights.core.spec_factory.simple_file object>
dig_noedns = <insights.core.spec_factory.simple_file object>
display_name = <insights.core.spec_factory.simple_file object>
dmesg = <insights.core.spec_factory.simple_file object>
dmidecode = <insights.core.spec_factory.simple_file object>
dmsetup_info = <insights.core.spec_factory.simple_file object>
dmsetup_status = <insights.core.spec_factory.simple_file object>
docker_info = <insights.core.spec_factory.simple_file object>
docker_list_containers = <insights.core.spec_factory.simple_file object>
docker_list_images = <insights.core.spec_factory.simple_file object>
dotnet_version = <insights.core.spec_factory.simple_file object>
doveconf = <insights.core.spec_factory.simple_file object>
du_dirs = <insights.core.spec_factory.glob_file object>
engine_db_query_vdsm_version = <insights.core.spec_factory.simple_file object>
ethtool = <insights.core.spec_factory.glob_file object>
ethtool_S = <insights.core.spec_factory.glob_file object>
ethtool_T = <insights.core.spec_factory.glob_file object>
ethtool_c = <insights.core.spec_factory.glob_file object>
ethtool_g = <insights.core.spec_factory.glob_file object>
ethtool_i = <insights.core.spec_factory.glob_file object>
ethtool_k = <insights.core.spec_factory.glob_file object>
facter = <insights.core.spec_factory.simple_file object>
fc_match = <insights.core.spec_factory.simple_file object>
fcoeadm_i = <insights.core.spec_factory.simple_file object>
findmnt_lo_propagation = <insights.core.spec_factory.simple_file object>
firewall_cmd_list_all_zones = <insights.core.spec_factory.simple_file object>
gcp_license_codes = <insights.core.spec_factory.simple_file object>
getconf_page_size = <insights.core.spec_factory.simple_file object>
getenforce = <insights.core.spec_factory.simple_file object>
getsebool = <insights.core.spec_factor