aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* [Plugin] Allow predicates to match any or all given itemsJake Hunsaker2019-08-251-13/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Expands predicate evaluation to be able to evaluate True or False depending on if any of the passed items are present (previous behavior) or if _all_ the passed items need to be present. This is handled by optionally passing a dict via the 'required' argument to SoSPredicate. The keys in this dict are items supported by SoSPredicate (currently 'kmods' and 'services'), with values being either 'any' or 'all'. Both kmods and services can be passed to the same predicate to allow fine-grained control over if a command should be collected. The default behavior remains the same, meaning that both 'kmods' and 'services' are set to 'any' for the required dict. For example, creating a predicate like the following: SoSPredicate(self, kmods=['foo', 'bar'], services=['oof', 'rab']) implies "required={'kmods': 'any', 'services': 'any'}" and thus as long as either kmods _and_ either of the services exist, the predicate evaluates True. If, for example, neither of the kmods are present, the predicate will evaluate False. Providing a predicate like the following however, will require _both_ kmods to be present and either of the services to evaluate True. If either kmods are not present, and --allow-system-changes is not set by the end user, this predicate will evaluate False: SoSPredicate(self, kmods=['foo', 'bar'], services=['oof', 'rab'], required={'kmods': 'all'}) Further, --allow-system-changes is handled directly in predicate evaluation for kmods, meaning individual plugins (like networking) do not need to separately check for if this flag is set or not. However, they will still need to specify 'changes=True' to the add_cmd_ouput() call if the intent is for the warning message that gets logged to include a mention about using --allow-system-changes. Fixes: #1755 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [vdsm]: Fix executing shell commandsMartin Perina2019-08-251-2/+2
| | | | | | | | | | | | | | | During review process of [1] it was suggested to replace '/bin/sh' with just 'sh', but unfortunately this change caused an error to not include information about VDSM mount points as described in [2]. This fix restores previous state and add full path to shell executions. [1] https://github.com/sosreport/sos/pull/1205 [2] https://bugzilla.redhat.com/1743304 Resolves: #1761 Signed-off-by: Martin Perina <mperina@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [libvirt] Collect rotated qemu logs and remove size limitsJake Hunsaker2019-08-251-4/+6
| | | | | | | | | | | | | | Expands qemu log collection to included rotated logs. Additionally, removes the 5MB limit for each path collection as sos now has implicit size limiting in place, and 5MB would be too small of a limit for systems running a large number of VMs (such as OSP or oVirt nodes). Resolves: #1758 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [Plugin] Apply cmd predicates to add_cmd_outputJake Hunsaker2019-08-251-0/+2
| | | | | | | | | | | | | | | | | If no predicate was passed to add_cmd_output() calls, then a predicate set by set_cmd_predicate() was not being applied to those calls, thus leading to a 'None' predicate being evaluated and potentially causing an exception in plugins such as docker where the bulk of command collection is gated by the service running. Now if no predicate is handed to add_cmd_output(), and a cmd_predicate has been set, then the cmd_predicate is applied before being handed off to the _add_cmd_output() helper. Fixes: #1756 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [ovirt_hosted_engine] Add gluster deployment and cleanup logGobinda Das2019-08-251-0/+6
| | | | | | | Resolves: #1748 Signed-off-by: Gobinda Das <godas@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [leapp] Add Plugin From DownstreamJake Hunsaker2019-08-251-0/+33
| | | | | | | | | | | Adds the downstream leapp plugin directly into sos. Additionally fixing an issue where the leapp database may be truncated, rendering the collected database file unusable. Resolves: #1753 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [candlepin] collect sizes of DB tablesPavel Moravec2019-08-251-0/+58
| | | | | | Relevant to: #1749 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [foreman] collect sizes of DB tablesPavel Moravec2019-08-251-5/+26
| | | | | | | | Also prevent overwriting os.environ["PGPASSWORD"] by other plugins. Resolves: #1749 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [openstack_nova] apply sizelimit to each logfile separatelyPavel Moravec2019-08-251-6/+18
| | | | | | | | | | | | Apply sizelimit separately to individual logfile types to esnure newest logfile of each type is always collected. Further, collect also logrotated version fo those files (up to sizelimit). Resolves: #1747 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [dnf] collect all configs and logrotated logsPavel Moravec2019-08-251-8/+4
| | | | | | | | Collect whole /etc/dnf and logrotated /var/log/dnf{,librepo,rpm}.log* Resolves: #1746 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [kdump] collect kexec_crash_* on all distributionsPavel Moravec2019-08-251-1/+5
| | | | | | | | | Collect /sys/kernel/kexec_crash_[size|loaded] on both RedHat and Debian distributions. Resolves: #1742 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [sosreport,reporting] replace HTML reports by Report subclassPavel Moravec2019-08-254-186/+199
| | | | | | | | | | | | | | | Current HTML report generation is slow and its implementation is full of scattered html code. We shall utilize Report class instead. Additionally, add JSON report format for easy automated parsing. Further, fixed decoding of unicode content of a report. Fixed report_tests suite including some pycodestyle errors. Resolves: #1713 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [crio] Write outputs to subdir, fix possible exception in output parsingJake Hunsaker2019-08-251-4/+5
| | | | | | | | | | | | | Updates the plugin to write container/image/pod output from crictl to subdirs. Additionally, fixes an issue where an exception could be raised when a crictl command has no output at all. Resolves: #1706 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [ovirt] Collect host certsPavel Moravec2019-08-251-0/+8
| | | | | | | | Collecting /etc/pki/ovirt-engine/ helps to identify expired host certs. Resolves: #1704 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [vdsm] collect vdsm certsPavel Moravec2019-08-251-2/+3
| | | | | | | | Collecting /etc/pki/vdsm/certs/ helps to identify expired host certs. Resolves: #1703 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [networkmanager] collect custom scriptsPavel Moravec2019-08-251-1/+2
| | | | | | | | Collect custom scripts from /etc/NetworkManager/dispatcher.d directory Resolves: #1701 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [libraries] Add path environment variablesJake Hunsaker2019-08-251-0/+6
| | | | | | | | | Adds collections of path related env vars. Resolves: #1679 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [qt] Add New PluginJake Hunsaker2019-08-251-0/+29
| | | | | | | | | Adds a new plugin for Qt. Currently, this plugin only collects relevant environment variables and activates/verifies on the 'qt' package on Red Hat family distributions. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [dbus] Add environment variable collectionJake Hunsaker2019-08-251-0/+2
| | | | | | | Adds collection of the DBUS_SESSION_BUS_ADDRESS env var. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [x11] Collect X related environment variablesJake Hunsaker2019-08-251-0/+15
| | | | | | | | Adds collection of XDG environment variables, as well as DISPLAY and DESKTOP_SESSION. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [host] Add collection of environment variablesJake Hunsaker2019-08-251-0/+6
| | | | | | | | Adds collection of common environment variables relevant to support cases surrounding shell issues. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [kubernetes] Collect proxy env varsJake Hunsaker2019-08-251-0/+7
| | | | | | | Adds collection of proxy environment variables. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [podman] Collect proxy env varsJake Hunsaker2019-08-251-0/+7
| | | | | | | Adds collection of proxy environment variables. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [docker] Collect proxy env varsJake Hunsaker2019-08-251-0/+9
| | | | | | | Adds collection of proxy environment variables. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [crio] Capture proxy env varsJake Hunsaker2019-08-251-0/+7
| | | | | | | Adds collection of proxy environment variables. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [sosreport] grab logs since datePavel Moravec2019-08-256-12/+65
| | | | | | | | | | | | Adds a --since switch that takes a date as an argument. This switch will skip the archive files with a mtime older than the date. Also, --since affects journalctl execution for --all. Resolves: #1678 Signed-off-by: David Vallee Delisle <dvd@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [boot] Capture SecureBoot configuration statePavel Moravec2019-08-251-1/+4
| | | | | | | | | | Adds collection of mokutil to show is SecureBoot is enabled on the system or not. Fixes: #1574 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [scsi] call lsscsi with "-i" optionPavel Moravec2019-08-251-4/+2
| | | | | | | | | To get the WWID sd device combination in a single command. Resolves: #1626 Signed-off-by: Nitin U. Yewale <nyewale@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [networking] use automatic pred warning for ss and macsec commandsBryn M. Reeves2019-08-161-18/+6
| | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [networking] collect commands only when required kernel modules are loadedPavel Moravec2019-08-161-4/+42
| | | | | | | | | | | | - "ip -s macsec show" requires "macsec" kmod loaded - "ss -peaonmi" requires 6 *_diag kernel modules Execute the commands only when the modules are loaded, or when explicitly requested via --allow-system-changes option. Resolves: #1435 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [Plugin] log reason for commands skipped by predicateBryn M. Reeves2019-08-161-8/+11
| | | | | | | | | Automatically log the reason that a command was skipped by predicate, and optionally include a message indicating that it may alter system configuration and that collection can be enabled by specifying --allow-system-changes. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [Plugin] add generic log_skipped_command() handlerBryn M. Reeves2019-08-161-0/+21
| | | | | | | | | | | | | Add a generic method to Plugin to log the reason that a command was skipped during predicate evaluation. The method accepts bool arguments indicating whether the command relies on kmod or service presence checks, and a 'change' argument that indicates that it may alter system configuration (adn so can be collected if the user supplies --allow-system-changes). Related: #1678 Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [SoSPredicate] override kernel module tests if --allow-system-changesBryn M. Reeves2019-08-163-0/+7
| | | | | | | | | | If the --allow-system-changes option is in effect, bypass checking of kernel modules and allow commands to attempt to auto-load any missing modules when run. Related: #1678 Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [SoSPredicate] make predicate evaluation members publicBryn M. Reeves2019-08-161-13/+13
| | | | | | | | | | | The predicate values used to evaluate a SoSPredicate are useful to code outside the class and can be safely read and set by plugin code: make these members public to allow details of predicate state to be more easily reported by generic Plugin code. Related: #1678 Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [sosreport] log warning messages to stdout instead of stderrPavel Moravec2019-08-151-1/+6
| | | | | | | warning and lower priority logs should be logged to stdout error or higher logs should be logged to stderr Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [sosreport] add option --allow-system-changesPavel Moravec2019-08-153-11/+19
| | | | | | | | | | | Running some commands can change the system e.g. by loading a kernel modules. That disqualifies the commands from being called by default. Add an option that overrides this default behaviour. Related to: #1435 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [plugins] fix mangled command filenames collisionsPavel Moravec2019-08-151-7/+14
| | | | | | | | | | | | - Command filenames collisions must be tested tested against absolute path, not relative. Otherwise false positive results about no collisions are returned. - If collision happens for long filenames, ensure that appending ".1" or similar does not exceed the max filename length. Resolves: #1684 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [gluster] Add volume, state information and dump glusterd processesJake Hunsaker2019-08-151-37/+30
| | | | | | | | | | | | | | | | | | | | | Adds collection of 'gluster volume get $vol all' output for all volume names as well as the generate dumpfile from 'gluster get-state' when the 'dump' option is used. Note that this file will be under /var/run/gluster in the archive. Adds 'glusterd' to the list of processes sent signal USR1 when the 'dump' option is used. Removed the prep work previously done to redirect where the statedump files are written to, as it has been reported that those attempts do not function as intended. Statedumps are now collected from /var/run/gluster. Finally, some re-organization to ease future maintenance and updating the size-limiting logic to use the implicit limiting in add_copy_spec(). Resolves: #1664 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [kdump] Collect vmcore-dmesg.txt files based on path and deviceMikel Olasagasti Uranga2019-08-151-0/+27
| | | | | | | | | | | | | | | kdump allows to configure to which filesystem and what path it will write contents of '/proc/vmcore'. kdump plugin currently only checks against a hardcoded path '/var/crash/*/vmcore-dmesg.txt'. With this change it will check the 'path' variable and also filesystems type ext2, ext3, ext4 or xfs against fstab. This will make the plugin check in the correct path in the system. Resolves: #1546 Signed-off-by: Mikel Olasagasti Uranga <mikel@olasagasti.info> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [nvme] collect config file everytimePavel Moravec2019-07-301-1/+1
| | | | | | | | Collect /etc/nvme/discovery.conf every time, outside any for-loop block. Resolves: #1740 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [plugins] Stop plugin execution after timeout hitPavel Moravec2019-07-291-0/+11
| | | | | | | | | | | When a plugin timeouts, it must stop collecting further data. Otherwise a race issues with archive.finalize() can happen. So any data collection must be skipped if _timeout_hit is True. Resolves: #1736 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [peripety] collect proper config filePavel Moravec2019-07-291-1/+1
| | | | | | | | The config file is /etc/peripetyd.conf . Resolves: #1737 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [utilities] Fix high CPU usage and slow command collectionKazuhito Hagio2019-07-291-1/+3
| | | | | | | | | | | | | | | | | commit fc6721ac83c2 ("[Plugin] Terminate running commands when a plugin exceeds timeout") introduced a polling method to sos_get_command_output() but it is busy wait, and seems to increase the CPU usage and slow down AsyncReader significantly. As a result, a command that outputs much data like journalctl takes longer time, and the plugin times out. Inserting a sleep is a possible fix for this. Resolves: #1732 Signed-off-by: Kazuhito Hagio <k-hagio@ab.jp.nec.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [openstack] Extract Placement plugin from NovaLee Yarwood2019-07-291-0/+112
| | | | | | | | | | | | | | | | | The OpenStack Placement service is being extracted from Nova [1] duringthe Stein development cycle [2]. This change extracts the required plugin logic from the original Nova plugin into a new Placement plugin ahead of this extraction. [1] https://docs.openstack.org/placement/latest/ [2] https://releases.openstack.org/stein/schedule.html Co-Authored-by: Piotr Kopec <pkopec@redhat.com> Resolves: #1676 Signed-off-by: Lee Yarwood <lyarwood@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [frr] FRR pluginPavel Moravec2019-07-091-0/+25
| | | | | | | | | A plugin for FRR alternative to Quagga. Path to conf is /etc/frr/. Resolves: #1666 Signed-off-by: Filip Krska <fkrska@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [archive] Handle checking container sysroot in _make_leading_pathsPavel Moravec2019-07-093-7/+17
| | | | | | | | | | | | | | | Previously, in _make_leading_paths(), checking host file paths did not account for non / sysroots, for situations where sos is run in a container and the host's / is actually mounted under /host for example. This would lead to copy errors when trying to copy symlinks. This method now will use sysroot if one is set, thus avoiding copy errors. Resolves: #1705 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [archive] convert absolute symlink targets to relativePavel Moravec2019-07-091-0/+5
| | | | | | | | | | Calling _make_leading_paths for a symlink with absolute symlink target must create the symlink relative to the source. This will prevent creating symlinks outside sosreport build dir. Resolves: #1710 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [sar] collect whole sar log dirPavel Moravec2019-07-091-17/+2
| | | | | | | | | | | Currently, sosreport does not collect files in saYYYYMMDD or similar format. Assuming sar log dir contains only sar related data it is safe to collect whole dir (up to size limit, from newest to oldest files). Resolves: #1700 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [policies] redhat policy to use hostname instead of rhn idPavel Moravec2019-07-091-23/+0
| | | | | | | | | As rhn is getting obsoleted and each host has its hostname, even redhat policy should use host name as the local name. Resolves: #1702 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [kubernetes] Write resource outputs to subdirsJake Hunsaker2019-05-211-4/+7
| | | | | | | | | | | | Updates the plugin to write 'kubectl get' and 'kubectl describe' output to a subdir named for each resource we iterate over. Additionally, logs output (when using the podlogs option) will be written to the 'pods' subdir. Resolves: #1628 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>