Custom Datasources Catalog
insights.specs.datasources
Custom datasources provide functionality beyond simple_file and simple_command
type datasources. If the custom datasource is short and concise it may be added to
this module. Other datasources should be added as a separate module.
Normally custom datasources are necessary for core-collection. In order for a custom
datasource to execute, all of its dependencies must be explicitly loaded by the client.
The client uses the YAML template insights.collect.default_manifest and each
parser/combiner/component required by a custom datasource must be included in the YAML
template to ensure it is loaded.
- insights.specs.datasources.DEFAULT_SHELL_TIMEOUT = 10
Default timeout in seconds for ctx.shell_out() commands, must be provided as an arg
- Type:
int
- insights.specs.datasources.get_recent_files(target_path, last_modify_hours=24, latest_count=0)[source]
Get the recent updated or created files, limited to lastest_count files
- Parameters:
target_path (string) -- target path to search
last_modify_hours (int) -- specify the recent hours
latest_count (int) -- specify the lastest files count with a positive integer
- Returns:
files that updated or creates just in last_modify_hours hours
- Return type:
list
- insights.specs.datasources.get_running_commands(ps, ctx, commands)[source]
Search for a list of commands in Ps combiner output and returns the full path to the command
- Parameters:
ps -- Ps combiner object
ctx -- Context of the current collection
commands (list) -- List of commands to search for in ps output
- Returns:
List of the full command paths of the all
command.- Return type:
list
- Raises:
TypeError -- Raised when
commandsargs is not a list
insights.specs.datasources.aws
Custom datasources for aws information
- class insights.specs.datasources.aws.LocalSpecs[source]
Bases:
SpecsLocal specs used only by aws datasources
- aws_imdsv2_token = <insights.core.spec_factory.simple_command object>
- context_handlers = {}
- registry = {}
- insights.specs.datasources.aws.aws_imdsv2_token(broker)[source]
This datasource provides a session token for use by other specs to collect metadata information on AWS EC2 nodes with IMDSv2 support..
Typical output of the input spec, which is also the output of this datasource:
AQAEABcCFaLcKRfXhLV9_ezugiVzra-qMBoPbdWGLrbdfqSLEJzP8w==
- Returns:
String that is the actual session token to be used in other commands
- Return type:
str
- Raises:
SkipComponent -- When an error occurs or no token is generated
insights.specs.datasources.awx_manage
Custom datasources for awx-manage information
- class insights.specs.datasources.awx_manage.LocalSpecs[source]
Bases:
SpecsLocal specs used only by awx_manage datasources
- awx_manage_check_license_data_raw = <insights.core.spec_factory.simple_command object>
Returns the output of command
/usr/bin/awx-manage check_license --data
- context_handlers = {}
- registry = {}
- insights.specs.datasources.awx_manage.check_license_data(broker)
This datasource provides the not-sensitive information collected from
/usr/bin/awx-manage check_license --data.Typical content of
/usr/bin/awx-manage check_license --datafile is:{"contact_email": "test@redhat.com", "company_name": "test Inc", "instance_count": 100, "license_date": 1655092799, "license_type": "enterprise", "subscription_name": "Red Hat Ansible Automation, Standard (100 Managed Nodes)", "sku": "MCT3691", "support_level": "Standard", "product_name": "Red Hat Ansible Automation Platform", "valid_key": true, "satellite": null, "pool_id": "2c92808179803e530179ea5989a157a4", "current_instances": 1, "available_instances": 100, "free_instances": 99, "time_remaining": 29885220, "trial": false, "grace_period_remaining": 32477220, "compliant": true, "date_warning": false, "date_expired": false}
- Returns:
JSON string containing non-sensitive information.
- Return type:
str
- Raises:
SkipComponent -- When the filter/path does not exist or any exception occurs.
insights.specs.datasources.candlepin
Custom datasources for candlepin broker.xml
- class insights.specs.datasources.candlepin.LocalSpecs[source]
Bases:
SpecsLocal specs used only by candlepin_broker datasources
- candlepin_broker_input = <insights.core.spec_factory.simple_file object>
Returns the contents of the file
/etc/candlepin/broker.xml
- context_handlers = {}
- registry = {}
- insights.specs.datasources.candlepin.candlepin_broker(broker)[source]
This datasource provides the candlepn broker configuration information collected from
/etc/candlepin/broker.xml.Typical content of
/etc/candlepin/broker.xmlfile is:<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd"> <core xmlns="urn:activemq:core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq:core "> <acceptors> <acceptor name="in-vm">vm://0</acceptor> <acceptor name="stomp">tcp://localhost:61613?protocols=STOMP;useEpoll=false;sslEnabled=true;trustStorePath=/etc/candlepin/certs/truststore;trustStorePassword=CDX9i3K5uPPBzcNtzz5tcycVf5PuXA5w;keyStorePath=/etc/candlepin/certs/keystore;keyStorePassword=4iBpTS45VZjFmVdNzRhRKNXtxbsH5Dij;needClientAuth=true</acceptor> </acceptors> <security-enabled>true</security-enabled> </core> </configuration>Note
This datasource may be executed using the following command:
insights cat --no-header candlepin_broker- Returns:
XML string after removing sensitive information.
- Return type:
str
- Raises:
SkipComponent -- When the path does not exist or any exception occurs.
insights.specs.datasources.client_metadata
Custom datasource for client metadata
- insights.specs.datasources.client_metadata.ansible_host(broker)
Custom datasource for
ansible_hostgetting from insights-client configuration.- Raises:
SkipComponent -- When there is no ansible_host is configured.
- Returns:
The Ansible Hostname
- Return type:
str
- insights.specs.datasources.client_metadata.basic_auth_insights_client(broker)
Custom datasource for
usernameandpasswordgetting from insights-client configuration.- Raises:
SkipComponent -- When there is no insights_config.
- Returns:
username/password exitsing boolean
- Return type:
dict
- insights.specs.datasources.client_metadata.blacklist_report(broker)
Custom datasource for
blacklist_reportgetting from insights-client configuration.- Returns:
The JSON strings
- Return type:
str
- insights.specs.datasources.client_metadata.blacklisted_specs(broker)
Custom datasource for
blacklisted_specsgetting from insights-client configuration.- Raises:
SkipComponent -- When there is no file-redaction is configured.
- Returns:
The JSON strings
- Return type:
str
- insights.specs.datasources.client_metadata.branch_info(broker)
Custom datasource for
branch_infogetting from insights-client configuration.- Returns:
The JSON strings
- Return type:
str
- insights.specs.datasources.client_metadata.display_name(broker)
Custom datasource for
display_namegetting from insights-client configuration.- Raises:
SkipComponent -- When there is no display_name is configured.
- Returns:
The JSON strings
- Return type:
str
- insights.specs.datasources.client_metadata.egg_release(broker)
Custom datasource for
egg_releasegetting from egg release file. It can only be collected when Egg is used as collector.- Raises:
SkipComponent -- When cannot get the egg_release.
- Returns:
Content of the egg release file.
- Return type:
str
- insights.specs.datasources.client_metadata.tags(broker)
Custom datasource for
tagsgetting from insights-client configuration.- Raises:
SkipComponent -- When there is no tags.yaml is configured.
ContentException -- When any exceptions occur.
- Returns:
The JSON strings
- Return type:
str
- insights.specs.datasources.client_metadata.version_info(broker)
Custom datasource for
version_infogetting from insights-client configuration.- Returns:
The JSON strings of version info
- Return type:
str
insights.specs.datasources.cloud_init
Custom datasources for cloud initialization information
- class insights.specs.datasources.cloud_init.LocalSpecs[source]
Bases:
SpecsLocal specs used only by cloud_init datasources
- cloud_cfg_input = <insights.core.spec_factory.simple_file object>
Returns the contents of the file
/etc/cloud/cloud.cfg
- context_handlers = {}
- registry = {}
- insights.specs.datasources.cloud_init.cloud_cfg(broker)
This datasource provides configuration of
/etc/cloud/cloud.cfgfile.Note
Since this file may contain sensitive information, it should be filtered before the Insights collecting it. The filters will be added via the
insights.specs.Specs.cloud_cfgSpec. If nothing is added to the filter, nothing will be collected.Typical content of
/etc/cloud/cloud.cfgfile is:#cloud-config users: - name: demo ssh-authorized-keys: - key_one - key_two passwd: $6$j212wezy$7H/1LT4f9/N3wpgNunhsIqtMj62OKiS3nyNwuizouQc3u7 ssh_deletekeys: 1 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- Returns:
YAML string after removing the sensitive information.
- Return type:
str
- Raises:
SkipComponent -- When the path does not exist, nothing is collected, or any exception occurs.
insights.specs.datasources.compliance.compliance_ds
Custom datasource compliance
Only when option --compliance is specified, the insights collection will
collect data for compliance. When it is specified, only the Insights Spec
insights.specs.default.DefaultSpecs.compliance will be
collected. To collect other specs within the collection of compliance data,
add them to the “persist” section in the “compliance_manifest”
pre-defined in the insights.specs.datasources.manifests
- insights.specs.datasources.compliance.compliance_ds.compliance(broker)
Collect compliance data when ‘--compliance’ is specified.
- insights.specs.datasources.compliance.compliance_ds.compliance_advisor_rule_enabled(broker)
- insights.specs.datasources.compliance.compliance_ds.compliance_assign(broker)
Run when ‘--compliance-assign ID’ is specified.
- insights.specs.datasources.compliance.compliance_ds.compliance_policies(broker)
Run when ‘--compliance-policies’ is specified.
- insights.specs.datasources.compliance.compliance_ds.compliance_unassign(broker)
Run when ‘--compliance-unassign ID’ is specified.
insights.specs.datasources.container
Basic datasources for container specs
insights.specs.datasources.container.containers_inspect
Custom datasources for containers inspect information
- insights.specs.datasources.container.containers_inspect.containers_inspect_data_datasource(broker)
This datasource provides the filtered information collected from
/usr/bin/docker|podman inspect <container ID>.Note
The path of the target key is like raw_data[key1][key2][target_key], then the filter pattern is like “key1|key2|target_key”. If the value type of raw_data[key1][key2] is list, although the target_key is in the list, the filter pattern must be “key1|key2”, this datasource returns the whole value of the list. The value of “Id” and “Image” are checked from raw data directly, no need filter these items.
Typical content of
/usr/bin/docker|podman inspect <container ID>file is:[ { "Id": "aeaea3ead52724bb525bb2b5c619d67836250756920f0cb9884431ba53b476d8", "Created": "2022-10-21T23:47:24.506159696-04:00", "Path": "sleep" ... } ... ]
- Returns:
item is JSON string containing filtered information.
- Return type:
list
- Raises:
SkipComponent -- When the filter/path does not exist or any exception occurs.
insights.specs.datasources.container.nginx_conf
Datasources to collect the nginx configuration files from containers
insights.specs.datasources.corosync
Custom datasources related to corosync
insights.specs.datasources.du
Custom datasources to get a list of directories to check disk size.
insights.specs.datasources.env
Custom datasources for environments.
- insights.specs.datasources.env.ld_library_path_global_conf(broker)
This datasource gets the global LD_LIBRARY_PATH enviorment setting.
- Reads the following config files:
/etc/environment
/etc/env.d/*
/etc/profile
/etc/profile.d/*
/etc/bashrc
/etc/bash.bashrc
/root/.bash_profile
/root/.bashrc
/root/.profile
/root/.cshrc
/root/.zshrc
/root/.tcshrc
When a line likes export LD_LIBRARY_PATH=$LD_LIBRARY_PATH exists, the datasource records the config file as an export file. When a line likes unset LD_LIBRARY_PATH exists, the datasource records the config file as an unset file
- The output of this datasource looks like:
{“export_files”: [“/etc/environment”, “/etc/env.d/test.conf”, “/root/.bash_profile”], “unset_files”: [“/etc/profile”]}
- Returns:
- Returns a JSON format string, export_files contains the config files that define the
LD_LIBRARY_PATH, unset_files contains config files that unset the LD_LIBRARY_PATH. Not return the line, because it might include sensitive information.
- Return type:
str
- Raises:
SkipComponent -- When any exception occurs.
insights.specs.datasources.ethernet
Custom datasource for gathering a list of the ethernet interface names.
- class insights.specs.datasources.ethernet.LocalSpecs[source]
Bases:
SpecsLocal specs used only by ethernet.interfaces datasource.
- context_handlers = {}
- ip_link = <insights.core.spec_factory.simple_command object>
- registry = {}
- insights.specs.datasources.ethernet.interfaces(broker)[source]
This datasource provides a list of the ethernet interfaces available.
Typical content of the spec is:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000\ link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000\ link/ether 52:54:00:13:14:b5 brd ff:ff:ff:ff:ff:ff 3: enp8s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000\ link/ether 52:54:00:e5:11:d4 brd ff:ff:ff:ff:ff:ff 4: enp1s0.2@enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000\ link/ether 52:54:00:13:14:b5 brd ff:ff:ff:ff:ff:ff 5: ib0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 4092 qdisc mq state DOWN group default qlen 256\ link/infiniband 00:01:02:03:fd:90:0:00:00:00:00:00:ef:0d:8b:02:01:d9:82:fd
Note
This datasource may be executed using the following command:
insights cat --no-header ethernet.interfacesSample data returned:
['enp1s0', 'enp8s0', 'enp1s0.2']
- Returns:
List of the ethernet interfaces available.
- Return type:
list
- Raises:
SkipComponent -- When there is not any content.
insights.specs.datasources.httpd
Custom datasources related to httpd
- insights.specs.datasources.httpd.httpd_cmds(broker)[source]
Function to search the output of
ps auxcwwto find all running Apache webserver processes and extract the binary path.- Returns:
List of the binary paths to each running process
- Return type:
list
- insights.specs.datasources.httpd.httpd_on_nfs(broker)
Function to get the count of httpd opened file on nfs v4
- Returns:
JSON string with keys: “httpd_ids”, “nfs_mounts”, “open_nfs_files”
- Return type:
str
insights.specs.datasources.intersystems
Custom datasources to get the iris working configuration/log files.
- insights.specs.datasources.intersystems.iris_working_configuration(broker)[source]
This datasource get information from
iris.cpffile.- Returns:
the file path of the
iris.cpffiles- Return type:
list
- Raises:
SkipComponent -- there is no iris.cpf file
- insights.specs.datasources.intersystems.iris_working_messages_log(broker)[source]
This datasource get information from
messages.logfile.- Returns:
the file path of the
messages.logfiles- Return type:
list
- Raises:
SkipComponent -- there is no messages.log file
insights.specs.datasources.ipcs
Custom datasources to get the semid of all the inter-processes.
- insights.specs.datasources.ipcs.semid(broker)[source]
This datasource provides a list of the semid of all the inter-processes.
Note
This datasource may be executed using the following command:
insights cat --no-header ipcs_s_iSample output:
[ '65570', '98353', '98354' ]
- Returns:
A list of the semid of all the inter-processes.
- Return type:
list
insights.specs.datasources.kernel
Custom datasource to get the current kernel version.
- show-inheritance:
- undoc-members:
- insights.specs.datasources.kernel.current_version(broker)[source]
This datasource provides the current booting kernel version.
Sample data returned:
'4.18.0-240.el8.x86_64'- Returns:
The current kernel version.
- Return type:
- Raises:
UnameError -- When there is a problem occurs with uname data.
- insights.specs.datasources.kernel.default_version(broker)[source]
This datasource provides the default kernel version.
Sample data returned:
'4.18.0-240.el8.x86_64'- Returns:
The default kernel version.
- Return type:
- Raises:
SkipComponent -- When output is empty or an error occurs
insights.specs.datasources.leapp
Custom datasources for leapp
- insights.specs.datasources.leapp.leapp_report(broker)
This datasource get useful information from
leapp-report.json.Note
Since this file may contain sensitive information, this datasource does filter and only keep required data.
- Returns:
JSON string after get the required data.
- Return type:
str
- Raises:
SkipComponent -- When the file does not exist or nothing need to collect
ContentException -- When any exception occurs.
insights.specs.datasources.logrotate
Custom datasources for logrotate
- insights.specs.datasources.logrotate.logrotate_conf_list(broker)[source]
This datasource returns the list of logrotate configuration files. - “/etc/logrotate.conf” is the one must be collected. - Files without extension under “/etc/logrotate.d/” will be collected. - Files with extension, only the “.conf” files will be collected.
- Returns:
- The list of logrotate configuration files.
[“/etc/logrotate.conf”] by default
- Return type:
list
insights.specs.datasources.ls
Custom datasources relate to directory list
- insights.specs.datasources.ls.files_dirs_number(broker)
Return a dict of file numbers from the spec filter
insights.specs.datasources.lsattr
Custom datasources for lsattr command
- insights.specs.datasources.lsattr.paths_to_lsattr(broker)[source]
Get the files or directories by the filters from Specs.lsattr_files_or_dirs
- Returns:
A string by joining all the paths by whitespace
- Return type:
str
- Raises:
SkipComponent -- when there is not any filter
insights.specs.datasources.lpstat
Custom datasources for lpstat information
- class insights.specs.datasources.lpstat.LocalSpecs[source]
Bases:
SpecsLocal specs used only by lpstat datasources
- context_handlers = {}
- lpstat_o = <insights.core.spec_factory.simple_command object>
Returns the output of command
/usr/bin/lpstat -o
- lpstat_v = <insights.core.spec_factory.simple_command object>
Returns the output of command
/usr/bin/lpstat -v
- registry = {}
- insights.specs.datasources.lpstat.lpstat_protocol_printers_info(broker)
This datasource provides the not-sensitive information collected from
/usr/bin/lpstat -v.Typical content of
/usr/bin/lpstat -vfile is:"device for test_printer1: ipp://cups.test.com/printers/test_printer1"- Returns:
Returns the collected content containing non-sensitive information
- Return type:
- Raises:
SkipComponent -- When the filter/path does not exist or any exception occurs.
insights.specs.datasources.luks
Custom datasource for gathering a list of encrypted LUKS block devices and their properties.
- class insights.specs.datasources.luks.LocalSpecs[source]
Bases:
SpecsLocal specs used only by LUKS_data_sources datasource.
- context_handlers = {}
- cryptsetup_luks_dump_commands = <insights.core.spec_factory.foreach_execute object>
- cryptsetup_luks_dump_token_commands = <insights.core.spec_factory.foreach_execute object>
- registry = {}
- insights.specs.datasources.luks.luks_block_devices(broker)[source]
This datasource provides a list of LUKS encrypted device.
Sample data returned:
['/dev/sda', '/dev/nvme0n1p3']
- Returns:
List of the LUKS encrypted block devices.
- Return type:
list
- Raises:
SkipComponent -- When there is not any LUKS encrypted block device on the
system. --
- insights.specs.datasources.luks.luks_data_sources(broker)
This datasource provides the output of ‘cryptsetup luksDump’ command for every LUKS encrypted device on the system. The digest and salt fields are filtered out as they can be potentially sensitive.
- Returns:
List of outputs of the cryptsetup luksDump command.
- Return type:
list
- Raises:
SkipComponent -- When there is not any LUKS encrypted block device on the
system. --
insights.specs.datasources.machine_id
Custom datasource to get the duplicate machine info.
- insights.specs.datasources.machine_id.dup_machine_id_info(broker)
This datasource provides the duplicate machine info.
Sample Output:
dc194312-8cdd-4e75-8cf1-2094bf666f45 hostname1,hostname2
- Returns:
a string containing the machine id and the hostnames with the same machine id
- Return type:
str
- Raises:
SkipComponent -- When the filters does not exist or the machine id is not in the filters or the machine id is not duplicate or any exception occurs.
insights.specs.datasources.malware_detection
Custom datasource malware detection
Only when option --collector malware-detection is specified, the insights
collection will collect data for malware-detection. When it is specified,
only the Insights Spec
insights.specs.default.DefaultSpecs.malware_detection will be
collected. To collect other specs within the collection of malware-detection,
add them to the “persist” section in the “malware_detection_manifest”
pre-defined in the insights.specs.datasources.manifests
- insights.specs.datasources.malware_detection.malware_detection_ds.malware_detection(broker)
Custom datasource to collects content for malware scanner if a scanner is present on the system
insights.specs.datasources.mount
Custom datasource relevant mount command
- insights.specs.datasources.mount.xfs_mounts(broker)[source]
Return the required mount points with ‘xfs’ type.
- Raises:
SkipComponent -- Raised if no ‘xfs’ mount points is available
- Returns:
Sorted list of ‘xfs’ mount points.
- Return type:
List[str]
insights.specs.datasources.md5chk
Custom datasources related to md5
insights.specs.datasources.package_provides
Custom datasource for package_provides
- insights.specs.datasources.package_provides.cmd_and_pkg(broker)
Collect a list of running commands and the associated RPM package providing those commands. The commands are based on filters so rules must add the desired commands as filters to enable collection. If a command is not provided by an RPM then it will not be included in the output.
In order for the full command line to be present in the Ps combiner a filter must be added to the spec
ps_auxww. A filter must also be added topackage_provides_commandso this datasource will look for the command in Ps.- Parameters:
broker -- the broker object for the current session
- Returns:
Returns the collected information as a file with 1 line per command
- Return type:
- Raises:
SkipComponent -- Raised if no data is collected
- insights.specs.datasources.package_provides.get_package(ctx, file_path)[source]
Get the RPM package that owns the specified filename with path
- Parameters:
ctx -- The current execution context
file_path (str) -- The full path and filename for RPM query
- Returns:
The name of the RPM package that provides the
fileor None if file is not associated with an RPM.- Return type:
str
insights.specs.datasources.pcp
Custom datasource related PCP (Performance Co-Pilot)
- insights.specs.datasources.pcp.pcp_enabled(broker)[source]
- Returns:
True if pmproxy service is on in services
- Return type:
bool
- Raises:
SkipComponent -- When pmproxy service is not enabled
- insights.specs.datasources.pcp.pmlog_summary_args(broker)[source]
Determines the pmlogger file and the metrics to collect via pmlog_summary spec.
- Returns:
- Full arguments string that will be passed to the pmlogsummary,
which contains the pmlogger archive file and the required metrics.
- Return type:
str
- Raises:
SkipComponent -- Raises when meeting one of the following scenario: - No pmlogger process is running - No pmlogger file - No “mandatory on” metrics in config.ros
- insights.specs.datasources.pcp.pmlog_summary_args_pcp_zeroconf(broker)[source]
Return the ‘index’ of the PCP Raw data files and the required metrics.
- Returns:
- Full arguments string that will be passed to the pmlogsummary,
which contains the pmlogger index file and the required metrics.
- Return type:
str
- insights.specs.datasources.pcp.ros_collect(broker)[source]
- Returns:
True if “ros_collect=True” is set in “insights-client.conf”
- Return type:
bool
- Raises:
SkipComponent -- When “ros_collect=True” is not set
insights.specs.datasources.ps
Custom datasources for ps information
- class insights.specs.datasources.ps.LocalSpecs[source]
Bases:
SpecsLocal specs used only by ps datasources
- context_handlers = {}
- ps_eo_args = <insights.core.spec_factory.simple_command object>
Returns ps output including pid, ppid, nlwp and full args
- registry = {}
- insights.specs.datasources.ps.jboss_runtime_versions(broker)
Custom datasource to collect the <JBOSS_HOME>/version.txt.
Sample output from the
ps -ewwo pid,ppid,nlwp,argscommand:PID PPID NLWP COMMAND 1 0 1 /usr/lib/systemd/systemd --switched-root --system --deserialize 31 2 0 1 [kthreadd] 3 2 1 [rcu_gp] 4 2 1 [rcu_par_gp] 6 2 1 [kworker/0:0H-events_highpri] 8686 525 1 java -D[Standalone] -server -verbose:gc -Xms64m -Xmx512m -Djboss.home.dir=/opt/jboss-datagrid-7.3.0-server -Djboss.server.base.dir=/opt/jboss-datagrid-7.3.0-server/standalone
Get the Jboss home directory and read the version.txt:
-Djboss.home.dir=/opt/jboss-datagrid-7.3.0-server /opt/jboss-datagrid-7.3.0-server/version.txt
- Returns:
string of dict {<jboss_home>: <content of version.txt>}
- Return type:
str
- Raises:
SkipComponent -- Raised if no data is available
- insights.specs.datasources.ps.ps_eo_cmd(broker)
Custom datasource to collect the full paths to all running commands on the system provided by the
ps -ewwo pid,ppid,nlwp,argscommand. After collecting the data, all of the args are trimmed to leave only the command including full path.Sample output from the
ps -ewwo pid,ppid,nlwp,argscommand:PID PPID NLWP COMMAND 1 0 1 /usr/lib/systemd/systemd --switched-root --system --deserialize 31 2 0 1 [kthreadd] 3 2 1 [rcu_gp] 4 2 1 [rcu_par_gp] 6 2 1 [kworker/0:0H-events_highpri] 9 2 1 [mm_percpu_wq] 10 2 1 [rcu_tasks_kthre] 11 0 1 /usr/bin/python3 /home/user1/python_app.py 12 2 1 [kworker/u16:0-kcryptd/253:0]
This datasource trims off the args to minimize possible PII and sensitive information. After trimming the data looks like this:
PID PPID NLWP COMMAND 1 0 1 /usr/lib/systemd/systemd 2 0 1 [kthreadd] 3 2 1 [rcu_gp] 4 2 1 [rcu_par_gp] 6 2 1 [kworker/0:0H-events_highpri] 9 2 1 [mm_percpu_wq] 10 2 1 [rcu_tasks_kthre] 11 2 1 /usr/bin/python3 12 2 1 [kworker/u16:0-kcryptd/253:0]
- Returns:
Returns a multiline string in the same format as
psoutput- Return type:
str
- Raises:
SkipComponent -- Raised if no data is available
insights.specs.datasources.rpm
Custom datasource for RPM command
- insights.specs.datasources.rpm.pkgs_with_writable_dirs(broker)
Custom datasource for CVE-2021-35937, CVE-2021-35938, and CVE-2021-35939.
It collects packages from the
rpm -qa --nosignature --qf="[%{=NAME}; %{=NEVRA}; %{FILENAMES}; %{FILEMODES:perms}; %{FILEUSERNAME}; %{FILEGROUPNAME}; %{=VENDOR}\n]" command.The output is a sorted list of all packages, which have at least one directory with files inside, and this directory is writable by a specific user/group or the others.
- Raises:
SkipComponent -- Raised if no data is available
- Returns:
Sorted list of strings, where every string contains name, nevra and vendor for a given package, and the pipe is used as a separator. E.g. [“httpd-core|httpd-core-2.4.53-7.el9.x86_64|Red Hat, Inc.”]
- Return type:
List[str]
insights.specs.datasources.rsyslog
Custom datasource to get the list of the rsyslog errorfile paths.
- insights.specs.datasources.rsyslog.rsyslog_errorfile(broker)[source]
This datasource provides the list of the rsyslog errorfile paths.
Sample data returned:
'/var/log/omelasticsearch.log /var/log/oversized.log'- Returns:
string of the errorfile paths that separated by a whitespace.
- Return type:
string
- Raises:
SkipComponent -- When ‘errorfile’ is not configured.
insights.specs.datasources.sap
Custom datasources for SAP related specs
- class insights.specs.datasources.sap.LocalSpecs[source]
Bases:
SpecsLocal specs used only by sap datasources
- context_handlers = {}
- registry = {}
- insights.specs.datasources.sap.ld_library_path_of_user(broker)
list: The list of “Username LD_LIBRARY_PATH”, e.g.:
[ 'sr1adm /usr/sap/RH1/SYS/exe/run:/usr/lib/', 'sr2adm /usr/sap/RH2/SYS/exe/run', ]
Note
Currently, only Sap users are supported.
- insights.specs.datasources.sap.sap_hana_sid(broker)[source]
list: List of the SID of SAP HANA Instances.
insights.specs.datasources.satellite
Custom datasources relate to Satellite Server
- class insights.specs.datasources.satellite.LocalSpecs[source]
Bases:
SpecsLocal specs used only by get_satellite_missed_pulp_agent_queues datasources
- content_host_uuids = <insights.core.spec_factory.simple_command object>
- context_handlers = {}
- qpid_queues = <insights.core.spec_factory.simple_command object>
- registry = {}
- insights.specs.datasources.satellite.satellite_missed_pulp_agent_queues(broker)
This datasource provides the missed pulp agent queues information on satellite server.
Note
This datasource may be executed using the following command:
insights cat --no-header satellite_missed_pulp_agent_queuesSample output:
pulp.agent.09008eec-aba6-4174-aa9f-e930004ce5c9:2018-01-16 00:06:13 pulp.agent.fac7ebbc-ee4f-44b4-9fe0-3f4e42c7f024:2018-01-16 00:06:16 0
- Returns:
- All the missed pulp agent queues and the boolean mark if the data is
truncated in the last line. If the value of last line is 0, it means all the missed queues are returned. If the value of the last line is 1, it means there are a lot of missed queues, to avoid render error, only the first 10 missed queues are returned.
- Return type:
str
- Raises:
SkipComponent -- When the error doen’t happen or the missed queues have been recreated.
insights.specs.datasources.semanage
Custom datasource to get the linux users count who map to a selinux user.
- class insights.specs.datasources.semanage.LocalSpecs[source]
Bases:
SpecsLocal specs used only by users_count_map_selinux_user datasource
- context_handlers = {}
- registry = {}
- selinux_user_mapping = <insights.core.spec_factory.simple_command object>
- insights.specs.datasources.semanage.users_count_map_selinux_user(broker)[source]
Get linux users count who map to the selinux user. It returns a dict with the selinux user type as the key, and the linux users count as the value.
- Raises:
SkipComponent -- Raised when there are no users map the filtered selinux user.
insights.specs.datasources.ssl_certificate
Custom datasource to get ssl certificate file path.
- insights.specs.datasources.ssl_certificate.httpd_certificate_info_in_nss(broker)[source]
Get the certificate info configured in nss database
- Parameters:
broker -- the broker object for the current session
- Returns:
Returns a list of tuple with the Nss database path and the certificate nickname
- Return type:
list
- Raises:
SkipComponent -- Raised when NSSEngine isn’t enabled or “NSSCertificateDatabase” and “NSSNickname” directives aren’t found
- insights.specs.datasources.ssl_certificate.httpd_ssl_certificate_files(broker)[source]
Get the httpd SSL certificate file path configured by “SSLCertificateFile”
- Parameters:
broker -- the broker object for the current session
- Returns:
Returns the SSL certificate file path configured by “SSLCertificateFile”
- Return type:
str
- Raises:
SkipComponent -- Raised if “SSLCertificateFile” directive isn’t found
- insights.specs.datasources.ssl_certificate.mssql_tls_cert_file(broker)[source]
Get the mssql tls certificate file path configured by “ssl_certificate”
- Parameters:
broker -- the broker object for the current session
- Returns:
Returns the SSL certificate file path configured by “ssl_certificate”
- Return type:
str
- Raises:
SkipComponent -- Raised if “ssl_certificate” directive isn’t found
- insights.specs.datasources.ssl_certificate.nginx_ssl_certificate_files(broker)[source]
Get the nginx SSL certificate file path configured by “ssl_certificate”
- Parameters:
broker -- the broker object for the current session
- Returns:
Returns the SSL certificate file path configured by “ssl_certificate”
- Return type:
str
- Raises:
SkipComponent -- Raised if “ssl_certificate” directive isn’t found
- insights.specs.datasources.ssl_certificate.rsyslog_tls_ca_cert_file(broker)[source]
Get the rsyslog tls ca certificate file path configured by “DefaultNetstreamDriverCAFile”
- Parameters:
broker -- the broker object for the current session
- Returns:
Returns the SSL certificate file path configured by “DefaultNetstreamDriverCAFile”
- Return type:
str
- Raises:
SkipComponent -- Raised if “DefaultNetstreamDriverCAFile” isn’t found
- insights.specs.datasources.ssl_certificate.rsyslog_tls_cert_file(broker)[source]
Get the rsyslog tls certificate file path configured by “DefaultNetstreamDriverCertFile”
- Parameters:
broker -- the broker object for the current session
- Returns:
Returns the SSL certificate file path configured by “DefaultNetstreamDriverCertFile”
- Return type:
str
- Raises:
SkipComponent -- Raised if “DefaultNetstreamDriverCertFile” isn’t found
insights.specs.datasources.sys_fs_cgroup_memory
Custom datasources relate to /sys/fs/cgroup/memory
- class insights.specs.datasources.sys_fs_cgroup_memory.LocalSpecs[source]
Bases:
SpecsLocal specs used only by sys_fs_cgroup_memory_tasks_number datasources
- context_handlers = {}
- registry = {}
- sys_fs_cgroup_memory_tasks_raw = <insights.core.spec_factory.simple_command object>
Returns the output of command
/usr/bin/find /sys/fs/cgroup/memory -name 'tasks'
- insights.specs.datasources.sys_fs_cgroup_memory.tasks_number(broker)
This datasource provides the numeber of “tasks” file collected from
/usr/bin/find /sys/fs/cgroup/memory -name 'tasks'.Typical content of
/usr/bin/find /sys/fs/cgroup/memory -name 'tasks'command is:/sys/fs/cgroup/memory/user.slice/tasks /sys/fs/cgroup/memory/system.slice/rh-nginx120-nginx.service/tasks /sys/fs/cgroup/memory/system.slice/named.service/tasks /sys/fs/cgroup/memory/system.slice/rhel-push-plugin.service/tasks
- Returns:
the number of “tasks” file under /sys/fs/cgroup/memory
- Return type:
string
- Raises:
SkipComponent -- When any exception occurs.
- insights.specs.datasources.sys_fs_cgroup_memory.uniq_memory_swappiness(broker)
This datasource reads all the memory.swappiness files under /sys/fs/cgroup/memory directory one by one and returns the uniq memory swappiness setting of the all control groups.
- The output of this datasource looks like:
10 1 60 66
- Returns:
Returns a multiline string in the format as
value count.- Return type:
str
- Raises:
SkipComponent -- When any exception occurs.
insights.specs.datasources.user_group
Custom datasources for user and group related specs
Note
It should be noted that the specs in this module might contains sensitive information, please avoid collecting any of them.
insights.specs.datasources.yum_updates
Custom datasource for collecting yum updates
- insights.specs.datasources.yum_updates.yum_updates(broker)
This datasource provides a list of available updates on the system. It uses the yum python library installed locally, and collects list of available package updates, along with advisory info where applicable.
Sample data returned:
{ "releasever": "8", "basearch": "x86_64", "update_list": { "NetworkManager-1:1.22.8-4.el8.x86_64": { "available_updates": [ { "package": "NetworkManager-1:1.22.8-5.el8_2.x86_64", "repository": "rhel-8-for-x86_64-baseos-rpms", "basearch": "x86_64", "releasever": "8", "erratum": "RHSA-2020:3011" } ] } }, "build_pkgcache": false, "metadata_time": "2021-01-01T09:39:45Z" }
- Returns:
List of available updates
- Return type:
list
- Raises:
SkipComponent -- Raised when neither dnf nor yum is found