Skip to content
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

Closed
wants to merge 13 commits into from

Conversation

TurboTurtle
Copy link
Member

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, and pulp and overhauls the foreman plugin to gather the bulk of what foreman-debug collects.

Where advantageous, particularly database output, the sos plugins retain the filenames used by foreman-debug, for example foreman_settings_table rather than the long postgres command use to access the database, which includes switching to the postgres 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_specs across the foreman and apache plugins, the Satellite preset now enables the apache.log option to gather everything under /var/log/httpd.

As noted in the foreman plugin we are adding the catalina add_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 enable tomcat.

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

  • Is the commit message split over multiple lines and hard-wrapped at 72 characters?
  • Is the subject and message clear and concise?
  • Does the subject start with [plugin_name] if submitting a plugin patch or a [section_name] if part of the core sosreport code?
  • Does the commit contain a Signed-off-by: First Lastname [email protected]?

@TurboTurtle
Copy link
Member Author

Tagging @pmoravec for review as I'm sure you'll be particularly keen on making sure this has full coverage.

@pmoravec
Copy link
Contributor

Cc @lzap as the main foreman-debug contributor for his awareness / possible feedback.

My very first reaction:

On one side, importing data collected by foreman-debug into sosreport simplifies some stuff. On the other side, maintaining sosreport will be harder - any change in foreman-debug will have to be newly/additionally manually added into sosreport as well. I dont have strong opinion on weights of these pros/negs.

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 foreman-debug calls (there are symlinks in /usr/share/foreman/script/foreman-debug.d to these files, and foreman-debug calls all scripts within this directory). (btw. adding such extra scripts by foreman-debug community must be monitored by sosreport maintainers as well, to keep parity/inclusion of collected data).

There is duplicated method build_query_cmd (that's name shall refer to postgres, imho). But I dont see an easy way of merging that code to one place - until we have some "layered plugins structure" (one plugin calls commands from another one), or putting the code into parent Plugin class (does not sound much appropriate to me).

@TurboTurtle
Copy link
Member Author

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 foreman-debug calls (there are symlinks in /usr/share/foreman/script/foreman-debug.d to these files, and foreman-debug calls all scripts within this directory). (btw. adding such extra scripts by foreman-debug community must be monitored by sosreport maintainers as well, to keep parity/inclusion of collected data).

Yep, looks like I completely glossed over that. I'll get something worked up soon-ish and added here.

There is duplicated method build_query_cmd (that's name shall refer to postgres, imho). But I dont see an easy way of merging that code to one place - until we have some "layered plugins structure" (one plugin calls commands from another one), or putting the code into parent Plugin class (does not sound much appropriate to me).

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 build_query_cmd into sos.utilities, but the fact that it's specific to exactly 2 plugins (and postgres like you mention) dissuaded me.

@lzap
Copy link
Contributor

lzap commented Jan 7, 2019

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.

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
b) we have a plan on cadence and release engineering
c) it works for debian and ubuntu users at least
d) we must be sure that we can't evolve what we have rather than starting from scratch

@TurboTurtle
Copy link
Member Author

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.

Simple question - why? What are the reasons? I am against rewriting this because it's "cleaner" or "nicer".

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.

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.

Even with -g, foreman-debug duplicates some information already collected by sos.

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:

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.

a) sosreport is on par with features and all the logs and commands collected by foreman-debug

I'm curious if you have anything in mind that sosreport is lacking in comparison to foreman-debug today?

b) we have a plan on cadence and release engineering
c) it works for debian and ubuntu users at least

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.

d) we must be sure that we can't evolve what we have rather than starting from scratch

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.

@TurboTurtle
Copy link
Member Author

TurboTurtle commented Jan 7, 2019

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 foreman, and the db queries reference the same foreman db.

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 DYNFLOW_EXPORT_MONTHS env var, this is now controlled by a new foreman.months plugin option that defaults to 6 (like the existing behavior).

@lzap
Copy link
Contributor

lzap commented Jan 8, 2019

From a purely RH perspective

No discussion that this is a great benefit for RH support, it's pretty clear.

foreman-debug duplicates some information already collected by sos.

Let's fix that.

The upstream sos project does 2 releases

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'm curious if you have anything in mind that sosreport is lacking in comparison to foreman-debug today?

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).

sos is available on the Debian and Ubuntu distros, all we'd need to do is verify package names and log locations.

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.

I'd argue this isn't starting from scratch

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:

  • Do side-by-side comparison of foreman-debug and this PR to make sure we are not dropping any important file or command.
  • Present this as a proposal to RH support folks for feedback.
  • Present this as a proposal to Foreman community for feedback.
  • Implement deprecated warning in foreman-debug.
  • Ship this code in sosreport upstream release.
  • After transition period, remove all code from foreman-debug in late 2019 leaving it as a simple stub: use sosreport.

@bmr-cymru
Copy link
Member

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.

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 3.0, in 2014. We now aim, as @TurboTurtle explained, to release twice a year, roughly every six months - this is the goal, but as we are a small team with no full-time resources, and as we are often flooded with downstream requests from certain distributors around their release times, it is not something we are always able to keep to perfectly.

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.

@pmoravec
Copy link
Contributor

pmoravec commented Jan 9, 2019

What is missing to collect from files (add_files command in f-d) - other missing stuff will be identified later on.

@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:

  • does it make sense to collect /etc/{sysconfig,default}/* files explicitly in individual plugins, when system plugin collects them automatically? It makes sense when --onlyplugin option is used; worth to explicitly collect several such files for foreman-debugas well?
  • does it make sense to collect whole /etc/profile.d? IMHO worth to do to know various customizations but unsure what all secret info might be there..?

Here is the (bigger) list of files that f-d collects but this PR does not:

/var/log/foreman/dynflow_executor*.log*
/var/log/foreman/dynflow_executor*.output*
/var/log/foreman/apipie_cache*.log*
/var/log/foreman/cron*.log*
/var/log/foreman/db_migrate*.log*
/var/log/foreman/db_seed*.log*
/var/log/foreman/production.log-*
/var/log/foreman/production.log
/var/log/foreman/dynflow_executor.output*
  (foreman needs all individual file patterns to collect, not only /var/log/foreman that would skip most of those types and collect e.g. just 2 newest (and big) production.log*)
/var/log/audit/audit.log*
  (logrotated, sos collects audit.log only)
/var/log/syslog*
  (logrotated, sos collects syslog and syslog.1 only)
/usr/share/foreman/Gemfile*
  (other than Gemfile.in; LZAP: can be there a different file?)
/etc/libvirt*
  (LZAP: something other than sos/plugins/libvirt.py collects?)
/etc/libvirt/storage/*
  (LZAP: something other than /etc/libvirt/storage/*.xml ?)
/etc/libvirt/qemu/
  (LZAP: something other than /etc/libvirt/qemu/*.xml ?)
/etc/libvirt/qemu/networks
  (LZAP: something other than /etc/libvirt/qemu/networks/*.xml ?)
/var/lib/puppet/ssl/certs/$(hostname -f).pem
/var/lib/puppet/ssl/certs/ca.pem
/etc/httpd/conf/*
  (LZAP: something else than httpd.conf ?)
/etc/httpd/conf.d/*
  (LZAP: something else than *.conf ?)
/etc/httpd/conf.d/*/*
/etc/apache2/*
  (LZAP: collecting that just on debian/ubuntu is ok, I expect?)
/var/log/{httpd,apache2}/*error_log*
  (other than just error_log)
/var/log/{httpd,apache2}/foreman-ssl_access_ssl.log*
/var/lib/pgsql/data/pg_log/*
  (sosreport collects "just" *log files, so this should be covered, right LZAP: ?)
several /etc/{sysconfig,default}/* files
  (collected by system plugin, but many other plugins collect equivalent stuff directly)
/var/log/foreman-proxy/cron*.log*
/var/log/foreman-proxy/migrate_settings*.log*
/var/log/foreman-proxy/proxy*.log*
/var/log/foreman-proxy/smart_proxy_dynflow_core*.log*
  (as for foreman logs, we need individual types of logs to collect separately, smart_proxy_dynflow_core*.log* properly collected)
/var/lib/dhcp/*.leases
/var/log/named*.log
/var/named
  (LZAP: (when) is this really required? can't it be big? or can't it contain some secure data?)
/var/log/puppet/*.log*
  (other than *.log)
/etc/puppet/ssl/ca/inventory.txt
/var/lib/puppet/ssl/ca/inventory.txt
/etc/puppetlabs/puppet/ssl/certs/$(hostname-f).pem
/etc/puppetlabs/puppet/ssl/certs/ca.pem
/etc/puppetlabs/puppet/*.conf
/etc/puppetlabs/puppetserver/conf.d/*.conf
/etc/puppetlabs/puppet/rack/*
/etc/puppetlabs/puppet/manifests/*
/var/log/puppetlabs/puppetserver/*.log*
/etc/puppetlabs/puppet/ssl/ca/inventory.txt
/var/lib/puppetlabs/puppet/ssl/ca/inventory.txt
/var/log/httpd/katello-reverse-proxy_access_ssl.log*
/var/log/httpd/katello-reverse-proxy_error_ssl.log*
/var/log/candlepin/audit*.log*
/var/log/candlepin/candlepin*.log*
/var/log/candlepin/cpdb*.log*
/var/log/candlepin/cpinit*.log*
/var/log/candlepin/error*.log*
  (again, we need individual types of logs collected separately)
/var/log/tomcat*/catalina*.log*
/var/log/tomcat*/host-manager*.log*
/var/log/tomcat*/localhost*.log*
/var/log/tomcat*/manager*.log*
  (also worth to split, catalina*.log* can be too big to not collecting others)
/var/log/rhsm/*
  (other than rhsm.log and rhsmcertd.log ? worth to take at least logrotated files but imho no other file patterns can appear there, am I right LZAP: ?)
/var/log/httpd/pulp-http{s,}_access_ssl.log*
/var/log/httpd/pulp-http{s,}_error_ssl.log*
  (also required to split current /var/log/httpd/pulp-http*.log* )
/var/log/mongodb/*
  (other than mongodb.log - imho mongodb.log* is sufficient (appears on older mongo versions upgraded to Sat6.4 equivalent one)
/var/lib/mongodb/mongodb.log*
  (appears since Sat6.4)
/var/log/qdrouterd/qdrouterd.log
  (LZAP: is this required? that was relevant in past only, no? qdrouterd logs to syslog now (again)?)
/var/log/ipa*-install.log
  (LZAP: something else than /var/log/ipaclient-install.log ?)
/var/log/squid/access*.log*
/var/log/squid/cache*.log*
/var/log/squid/store*.log*
/var/log/squid/squid*.out*
  (other than access.log, cache.log, squid.out)
/etc/profile.d/*
  (LZAP: why is that required? all files or just some foreman/katello/puppet/pulp/.. relevant? but IMHO this is worth to be collected by sos every time..)

@lzap
Copy link
Contributor

lzap commented Jan 9, 2019

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 --all-logs option).

something other than sos/plugins/libvirt.py collects?

Nah, it's fine to collect just minimum stuff.

something other than /etc/libvirt/storage/*.xml ?

Nah, it's fine to collect just minimum stuff.

something other than /etc/libvirt/qemu/*.xml ?

Nah, it's fine to collect just minimum stuff.

something other than /etc/libvirt/qemu/networks/*.xml ?

Nah, it's fine to collect just minimum stuff.

something else than httpd.conf ?
something else than *.conf ?

Nah, it's fine to collect just minimum stuff.

http: collecting that just on debian/ubuntu is ok, I expect?

Yes, this is present only for Ubuntu/Debian. It looks like sosreport handles non-RH distros well.

postgres: sosreport collects "just" *log files, so this should be covered?

Yeah the purpose of this one is to get the most important potgres log (slow queries and stuff).

/var/named

Collecting this completely is probably not a good way, sosreport contains "named" plugin already that should be a good start.

/etc/puppet
/etc/puppetlabs

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.

/var/log/rhsm/*

I am not aware of anything else than you mentioned.

/var/log/qdrouterd/qdrouterd.log

If you say it was dropped, than let's remove it. You know better than me.

/var/log/ipa*-install.log

This is really only for /var/log/ipaclient-install.log.

/etc/profile.d/*

Can be dropped, no reason to collect this anymore.

/var/log/squid

There is already a squid plugin available in sosreport. Pavel, if you do sosreport -l you will end up with extensive list covering some of the files listed here.

@lzap
Copy link
Contributor

lzap commented Jan 9, 2019

@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:

  • /etc/puppet (Fedora/EPEL standard)
  • /etc/puppetlabs (Enterprise/Free version)
  • /opt/* (I think I saw this as well)

Current proposal is in the PR, file named puppet.py.

Thanks!

@pmoravec
Copy link
Contributor

pmoravec commented Jan 9, 2019

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 --all-logs option).

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 --log-size equivalent to -s on f-d. So the higher default shall be OK.

Thanks for feedback and comments.

@TurboTurtle
Copy link
Member Author

we need individual types of logs collected separately

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 --all-logs or not? E.G. collecting the most recent log only for each vs. grabbing everything?

Same thing for /var/log/candlepin.

(also worth to split, catalina*.log* can be too big to not collecting others)

The PR grabs /var/log/tomcat/catalina* currently, based on talking with pdudley. Can foreman/Sat drop these in other /var/log/tomcat* directories based on distro or version? They also mentioned that the rotated catalina logs are usually small.

@TurboTurtle
Copy link
Member Author

does it make sense to collect /etc/{sysconfig,default}/* files explicitly in individual plugins, when system plugin collects them automatically? It makes sense when --onlyplugin option is used; worth to explicitly collect several such files for foreman-debug as well?

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 --onlyplugin for the majority of test runs. I guess it comes down to this - if a user runs sosreport -o foreman will a support engineer be particularly/routinely hampered by /etc/{sysconfig,default}/foreman/ not being in the archive?

@lzap
Copy link
Contributor

lzap commented Jan 9, 2019

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:

  • ansible
  • apache
  • cron
  • dhcp
  • firewalld
  • grafana
  • insights
  • ipmitool
  • logrotate
  • mongodb
  • mysql
  • named
  • openssl
  • pcp
  • postgresql
  • postfix
  • puppet
  • qpid
  • qpid_dispatch
  • salt
  • saltmaster
  • selinux
  • squid
  • ssh
  • tftpserver
  • tomcat
  • tuned
  • xinetd

@bmr-cymru
Copy link
Member

I lean towards yes in this case, but I don't feel particularly strongly about it.

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 sysconfig and defaults directories (or similar system paths) - those should be handled by the relevant "system" level plugin.

@TurboTurtle
Copy link
Member Author

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 apache.log option). Should the preset also enable the profile? This would effectively make any bare sosreport command on a satellite (or foreman if we extend it to the upstream project as well) sat-specific, which I'm not sure is something we want.

@bmr-cymru
Copy link
Member

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.

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 sosreport command line options that can be named and recalled with --preset. We have ones for base RHEL, Atomic and I think a couple of other things now - they can override anything that can be specified on with the usual arguments, e.g. setting max --log-size, --all-logs etc., enabling profiles, or enabling/disabling plugins and plugin options.

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 /var/lib/sos/presets (so e.g. a support engineer can provide a "special" preset to a customer for a given case).

@bmr-cymru
Copy link
Member

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).

@bmr-cymru
Copy link
Member

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 apache.log option).

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 foreman-debug defaults).

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 --profile=foreman (or whatever the name ends up being).

@TurboTurtle
Copy link
Member Author

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.
Support: There's no lvm data in this, the plugin didn't run.
User: I just ran 'sosreport'
Support: Ok, run sosreport -e lvm2
User: Here you go
Support: This might actually be a problem with the block devices, but the sosreport didn't run the block plugin....
User: Why am I having to keep running this thing?

@lzap
Copy link
Contributor

lzap commented Jan 9, 2019

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.

@bmr-cymru
Copy link
Member

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 -e <plugin>) then the plugin is enabled.

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. --profile system,satellite. This is how we expected users to deal with the problems @TurboTurtle mentioned with things like block device data being missing.

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 :-).

@lzap
Copy link
Contributor

lzap commented Jan 11, 2019

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.

@TurboTurtle
Copy link
Member Author

Tagging @battlemidget for the above question about Ubuntu releases.

@bmr-cymru
Copy link
Member

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).

I'm not sure about that - a number of Ubuntu contributors (and Canonical employees) are upstream contributors, and sos is used in the commercial support of the distribution - as far as I know they do make regular updates, and we have been asked in the past to make point releases to fit in with their release schedule.

It's worth clarifying, as I know one of the former sos maintainers at Canonical has now left the company, but I expect their packages to be at least reasonably fresh from past experience.

@TurboTurtle
Copy link
Member Author

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]>
@TurboTurtle TurboTurtle force-pushed the foreman-debug-split branch from 61706e8 to bcab65a Compare March 15, 2019 15:13
@pmoravec
Copy link
Contributor

No further issues found, 👍 to merge from me.

Thanks for the repetitive ant-work on the PR!

bmr-cymru pushed a commit that referenced this pull request Mar 21, 2019
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]>
bmr-cymru pushed a commit that referenced this pull request Mar 21, 2019
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]>
bmr-cymru pushed a commit that referenced this pull request Mar 21, 2019
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]>
bmr-cymru pushed a commit that referenced this pull request Mar 21, 2019
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]>
bmr-cymru pushed a commit that referenced this pull request Mar 21, 2019
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]>
bmr-cymru pushed a commit that referenced this pull request Mar 21, 2019
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]>
bmr-cymru pushed a commit that referenced this pull request Mar 21, 2019
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]>
bmr-cymru pushed a commit that referenced this pull request Mar 21, 2019
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]>
bmr-cymru pushed a commit that referenced this pull request Mar 21, 2019
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]>
bmr-cymru pushed a commit that referenced this pull request Mar 21, 2019
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]>
bmr-cymru pushed a commit that referenced this pull request Mar 21, 2019
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]>
bmr-cymru pushed a commit that referenced this pull request Mar 21, 2019
Adds collection of 'virt-who -dop'.

Related: #1525

Signed-off-by: Jake Hunsaker <[email protected]>
Signed-off-by: Bryn M. Reeves <[email protected]>
@bmr-cymru bmr-cymru closed this in 7a44309 Mar 21, 2019
@lzap
Copy link
Contributor

lzap commented Mar 22, 2019

Great work folks! Thanks all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants