-
Notifications
You must be signed in to change notification settings - Fork 545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[plugins] Implement foreman-debug in native sos plugins #1525
Conversation
Tagging @pmoravec for review as I'm sure you'll be particularly keen on making sure this has full coverage. |
Cc @lzap as the main My very first reaction: On one side, importing data collected by If I am not mistaken, the PR does not carry forward https://github.com/theforeman/foreman-tasks/blob/master/extra/dynflow-debug.sh or https://github.com/theforeman/foreman_hooks/blob/master/extra/foreman-debug.sh that typical deployment of There is duplicated method |
Yep, looks like I completely glossed over that. I'll get something worked up soon-ish and added here.
Yeah, that's what I came up with to - I didn't have a good approach besides putting it in both plugins. It's small enough that I don't think it's worth worrying about, but if we do have a growing need for something similar we should talk about that. I flirted with the idea of putting |
Simple question - why? What are the reasons? I am against rewriting this because it's "cleaner" or "nicer". Our foreman-debug works fine for upstream project, it was designed with sosreport in mind (option -g), it works on non-redhat systems and provides us our own releasing pace which is very important. Sosreport is released with RHEL cadence which is causing huge troubles in Satellite and Foreman release processes, similarly to SELinux base policy. If we want to go this path we need to make sure that: a) sosreport is on par with features and all the logs and commands collected by foreman-debug |
From a purely RH perspective, consolidating support tooling is a big gain for customer experience - both with the product and with support engagement in general. From a sos perspective, this allows us to take advantage of the sos infrastructure - time limiting, size limiting, ability to avoid certain collection entirely (for whatever reason - most notably hanging collection on seriously broken systems), etc... A bash script circumvents all of this. As for the Satellite team's specifics, I'll let @pdudley speak to that.
Even with -g, foreman-debug duplicates some information already collected by sos.
sosreport on RHEL is released with the RHEL cadence. The upstream sos project does 2 releases a year (or at least we aim to), one of which does traditionally line up with a RHEL release with the other not doing so.
I'm curious if you have anything in mind that sosreport is lacking in comparison to foreman-debug today?
sos is available on the Debian and Ubuntu distros, all we'd need to do is verify package names and log locations. If either of those are different, then adjusting the plugin for different distros is trivial.
I'd argue this isn't starting from scratch - we're extending a well maintained and supported collection utility and thus evolving the current collection strategy for a specific product/subset of components. |
04e1872
to
58ff3e5
Compare
I've updated the PR to include dynflow query output from the foreman-debug extension in the foreman plugin. I elected to not do this as a new dynflow plugin as the logs collected by the extension were already being grabbed by Note that I made a slight change to the psql syntax for the timestamp as the existing syntax was causing quoting issues for the commands being run. Rather than setting a |
No discussion that this is a great benefit for RH support, it's pretty clear.
Let's fix that.
That sounds good, although I still have some concerns about RHEL cadence being too slow for us. I guess in case there is some important bug, errata is possible.
I was not comparing features of a generic support collector tool itself, sosreport wins here that's clear but rather amount of files and commends collected by foreman-debug. I am curious if you implemented everything. Can you at least give me git commit sha of the foreman-debug you used as the starting point? I'd like to do side-by-side comparison. Having that said, we have a nice feature - ability to upload debug tarball to our rsync write-only site. I spent one minute digging in the sos codebase but was unable to find relevant code. If there is a way to create some "profile" called foreman with ability to upload tarball that would be great. We can switch from rsync to FTP if this is the only protocol sosreport supports (I think I've heard sosreport can do FTP upload not sure).
Foreman-debug has all the log files locations written in a way that it should also work on Debian/Ubuntu, note /etc/apache2 as an example. I would hate having two tools for debugging purposes, if we decide to go with sosreport path I would rather discourage use of foreman-debug in a warning message asking to install and run sosreport.
Again, I did not mean sosreport as something from scratch, I thought you are coming up with new list of files we should be collecting. But after a closer look it looks like you took existing foreman-debug and implemented the same. After a side-by-side comparison this should be good. As original author of foreman-debug, I have no problems moving to sosreport honestly. I do not like idea of having two tools however and I would like to see a smooth transition period. I suggest the following:
|
As
|
Just to squash this myth once and for all: sos does not (and has not for several years), have a "RHEL cadence". We started moving away from that with the release of At the same time, we normally maintain master in a stable state, and new work is carried out on branches before merging, so we are usually able to issue point releases for downstreams that have particular requirements or schedules - we have done this for Fedora, Ubuntu, Debian and others in the past (including layered Red Hat products), so if there is a problem with our schedules for the pieces you work on, the best solution is to talk to us and give us enough time to find an answer. |
What is missing to collect from files ( @TurboTurtle if you wish I can incorporate the changes (as I shall know where/what/why to collect more, knowing both sos/f-d/Satellite/foreman/..) @lzap: please reply to questions with "LZAP:" if sosreport collects sufficient data (less than what f-d does but still enough). @TurboTurtle and @bmr-cymru : two questions:
Here is the (bigger) list of files that f-d collects but this PR does not:
|
Before going one by one, I want to point out one important thing - size vs how many files (and logrotated files) should we collect. This has been big issue for foreman-debug, we ended up in neverending discussions. Some people had strong opinion of not collecting too much of historical data because this can easily lead to too big support tarballs (> 500 MB), others argued that then the report is useless etc. I think sosreport guys probably have both opinion on that and also solutions (via some parameters etc). So we should stick what's default for sosreport. But customers should be definitely able to specify more than the default (I see there is
Nah, it's fine to collect just minimum stuff.
Nah, it's fine to collect just minimum stuff.
Nah, it's fine to collect just minimum stuff.
Nah, it's fine to collect just minimum stuff.
Nah, it's fine to collect just minimum stuff.
Yes, this is present only for Ubuntu/Debian. It looks like sosreport handles non-RH distros well.
Yeah the purpose of this one is to get the most important potgres log (slow queries and stuff).
Collecting this completely is probably not a good way, sosreport contains "named" plugin already that should be a good start.
These are important directories, depending on the puppet version it can be either /etc/puppet or the other. There are SSL certs so we must be sure to skip private parts. This should be probably a Puppet plugin. Most of the things we collect should break into individual plugins I guess. There is important to understand that there is a puppet client and server (also called puppetmaster). We are interested in both, mostly in the puppetmaster which is not greatly covered in the latest stable version of sos.
I am not aware of anything else than you mentioned.
If you say it was dropped, than let's remove it. You know better than me.
This is really only for /var/log/ipaclient-install.log.
Can be dropped, no reason to collect this anymore.
There is already a squid plugin available in sosreport. Pavel, if you do |
@ekohl this is an effort to merge foreman-debug into sosreport in a proper way. I struggle a bit understanding what are the most important artifacts to collect from puppet master. Would you mind elaborating that? I know that there are three paths depending on the puppet version:
Current proposal is in the PR, file named puppet.py. Thanks! |
Indeed this is a generic dilema in sosreport as well. By default, it collects 25MB of files of given pattern (like f-d collects 10MB), and it has option Thanks for feedback and comments. |
Ah, I was hoping it was sufficient to grab the parent dir, but I guess not with size limits. On that note, do we need to do any control around Same thing for
The PR grabs |
I lean towards yes in this case, but I don't feel particularly strongly about it. It's in this PR mainly as a byproduct of testing it with |
I see sosreport support "profiles", does it make sense to create satellite profile which contains the most interesting plugins: foreman, katello, pulp, candlepin, apache, puppet, qpid maybe few more? If there is some alias support, the profile should be probably named "foreman" with "satellite" alias because that's upstream vs downstream name. Or we can pick one. Edit: Interesting and relevant plugins:
|
My opinion (that isn't documented anywhere afaik) is that it's OK for specific plugins to specify files in these locations that are crucial to the component. They'll get flattened out by the archive duplicate checks anyway if all plugins are running. What's not OK is for other plugins to scoop up the entire |
We can definitely create a foreman profile. One question that would arise from that is what should we do with the preset? We currently enable that on any system that has satellite_common installed on RH hosts and in current master it simply enables rpm -V package checks (and this PR also has it turning on the |
Yep, no problem at all with this: profiles are very cheap, and they reduce the complexity of command lines that customers have to enter to get the needed information. We also have a facility today to define "presets" - these are saved versions of normal We can include preset definitions in the source tree (via the relevant policy classes), or they can be created by users either on the command line, or by dropping a JSON file into |
I'd have to think a bit on the aliasing question. I'm sure it's feasible but I'm not immediately certain of the best way to do it (right now the implementation is very simple and lightweight, and the code doesn't really "know" about profiles outside individual plugins - each plugin says what profile names it belongs to, and we build the profile lists from there at runtime). |
Ah, right: that was something I did, partly as a demo of the presets system, and partly because I remember being asked by our Satellite folks to turn the option on by default (kinda like the conversation @lzap mentions regarding I'm in no way wed to it - the preset definitions really ought to belong to the teams that support the components. They're in the best position to know what's right and will work best with our customers. If a profile is also going to be added then one option is to wire it into the preset as |
Right, but my concern is if we enable the profile in the preset, what happens when an end user is having a non-foreman related issue and whenever they get a sosreport to their support rep something like this goes down: User: I'm having an LVM issue with this system that happens to be running foreman/satellite. Here's a sosreport. |
So if I understand the code right, sosreport (or plugins I should say) automatically detect if a daemon/component is installed and automatically include the data. Profile is a set of plugins which must be present no matter of if a prerequisite is met and it comes with some extra metadata like default options and stuff. I think for the first version then, we don't need a profile, unless support folks identify some problems with default settings of sosreport. |
Close... a plugin has a set of triggers: file/dir paths, packages, executable command names, kernel modules, or services. If any of those are present (or if the user specifies A profile is just a named collection of plugins that a user can ask to run together as a shorthand - the plugins are still subject to the normal enablement checks, and profiles can be combined, e.g. If that's not working optimally for folks then we can revisit it if we can find a better approach. The last level is presets, and they can do pretty much anything (except create or delete presets :-). |
I've created a discussion on our site: https://community.theforeman.org/t/rfc-deprecate-foreman-debug-in-favor-of-sosreport/12465 Ewoud asked: It is good to note that Debian and Ubuntu probably won’t rebase sosreport so if we need fixes for a release, we may miss them for a long time (probably years for Ubuntu LTS). With RHEL8 we’ll probably be in a similar situation where we still need to start. Is there an option to ship fixes in a separate plugin to sosreport? Can you elaborate on this please? I am interested in Debian/Ubuntu rebasing cadence, if there is any. That would be a problem for us, our deb-based community is huge. |
Tagging @battlemidget for the above question about Ubuntu releases. |
I'm not sure about that - a number of Ubuntu contributors (and Canonical employees) are upstream contributors, and It's worth clarifying, as I know one of the former |
58ff3e5
to
a6699ad
Compare
I've updated the PR again after adding the file patterns for the foreman, katello, pulp, and candlepin plugins that @pmoravec listed. For the non-foreman/sat components listed I believe these are handled currently in their respective plugins today. |
Adds a new plugin for Candlepin as part of the effort to port the foreman-debug script to native sos plugins. Signed-off-by: Jake Hunsaker <[email protected]>
Adds a new plugin for pulp as part of the effort to port the foreman-debug script to native sos plugins. Signed-off-by: Jake Hunsaker <[email protected]>
Sets the Red Hat Satellite preset to enable the apache 'log' option by default so that all of /var/log/httpd is collected Signed-off-by: Jake Hunsaker <[email protected]>
Adds collection of the mongodb log under /var/lib/mongodb Signed-off-by: Jake Hunsaker <[email protected]>
Adds support for this plugin to run on Debian and Ubuntu systems as part of the effort to port foreman-debug to sos plugins. Signed-off-by: Jake Hunsaker <[email protected]>
Adds collection of 'du -sh' for the postgres home directory. Signed-off-by: Jake Hunsaker <[email protected]>
Adds collection of /etc/default/bind and /var/log/named.log. Signed-off-by: Jake Hunsaker <[email protected]>
Adds collection of rotated log files for Red Hat locations. Signed-off-by: Jake Hunsaker <[email protected]>
Adds collection of 'virt-who -dop'. Signed-off-by: Jake Hunsaker <[email protected]>
61706e8
to
bcab65a
Compare
No further issues found, 👍 to merge from me. Thanks for the repetitive ant-work on the PR! |
Adds a new plugin for the ruby runtime. Related: #1525 Signed-off-by: Jake Hunsaker <[email protected]> Signed-off-by: Bryn M. Reeves <[email protected]>
Adds collection of 'facter' and the puppet version in use. Additionally collect directory listings for puppet module dirs. Related: #1525 Signed-off-by: Jake Hunsaker <[email protected]> Signed-off-by: Bryn M. Reeves <[email protected]>
Adds a new plugin for katello as part of the porting of the foreman-debug script to sos plugins. Related: #1525 Signed-off-by: Jake Hunsaker <[email protected]> Signed-off-by: Bryn M. Reeves <[email protected]>
Adds a new plugin for Candlepin as part of the effort to port the foreman-debug script to native sos plugins. Related: #1525 Signed-off-by: Jake Hunsaker <[email protected]> Signed-off-by: Bryn M. Reeves <[email protected]>
Adds a new plugin for pulp as part of the effort to port the foreman-debug script to native sos plugins. Related: #1525 Signed-off-by: Jake Hunsaker <[email protected]> Signed-off-by: Bryn M. Reeves <[email protected]>
Sets the Red Hat Satellite preset to enable the apache 'log' option by default so that all of /var/log/httpd is collected Related: #1525 Signed-off-by: Jake Hunsaker <[email protected]> Signed-off-by: Bryn M. Reeves <[email protected]>
Adds collection of the mongodb log under /var/lib/mongodb Related: #1525 Signed-off-by: Jake Hunsaker <[email protected]> Signed-off-by: Bryn M. Reeves <[email protected]>
Adds support for this plugin to run on Debian and Ubuntu systems as part of the effort to port foreman-debug to sos plugins. Related: #1525 Signed-off-by: Jake Hunsaker <[email protected]> Signed-off-by: Bryn M. Reeves <[email protected]>
Adds collection of 'du -sh' for the postgres home directory. Related: #1525 Signed-off-by: Jake Hunsaker <[email protected]> Signed-off-by: Bryn M. Reeves <[email protected]>
Adds collection of /etc/default/bind and /var/log/named.log. Related: #1525 Signed-off-by: Jake Hunsaker <[email protected]> Signed-off-by: Bryn M. Reeves <[email protected]>
Adds collection of rotated log files for Red Hat locations. Related: #1525 Signed-off-by: Jake Hunsaker <[email protected]> Signed-off-by: Bryn M. Reeves <[email protected]>
Adds collection of 'virt-who -dop'. Related: #1525 Signed-off-by: Jake Hunsaker <[email protected]> Signed-off-by: Bryn M. Reeves <[email protected]>
Great work folks! Thanks all. |
According to senior resources within the RH Satellite support team, it would be desirable to have sos natively collect what the
foreman-debug
script collects. This patch set is an effort to port that script to sos.This creates 4 new plugins -
ruby
,katello
,candlepin
, andpulp
and overhauls theforeman
plugin to gather the bulk of whatforeman-debug
collects.Where advantageous, particularly database output, the sos plugins retain the filenames used by
foreman-debug
, for exampleforeman_settings_table
rather than the long postgres command use to access the database, which includes switching to thepostgres
user as that is the only way to attach to the database by configuration design. This also is to ensure we don't inadvertently break any automated tooling that may be looking for those filenames.Additionally, instead of duplicating
add_copy_spec
s across theforeman
andapache
plugins, the Satellite preset now enables theapache.log
option to gather everything under/var/log/httpd
.As noted in the
foreman
plugin we are adding the catalinaadd_copy_spec
there since, according to support resources, it is very common for support cases to need to go back several days in catalina logs and we don't want to needlessly clutter other sosreports that enabletomcat
.Many thanks to Paul Dudley from Red Hat for assistance with verification and initial identification of the need/desire for this work, and for providing an environment to test these changes in.
Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines