[sosreport] fix test in SoSReport._is_in_profile()

All plugins belong to the null (empty) plugin. Fix the test in
_is_in_profile() to check against the list of active profiles and
not the list of all detected profiles.

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
[docker] optional log capturing for all containers

This options provides the user the ability to pull
logs from all containers including the terminated/stopped.

Fixes #360
Fixes #365

Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
[sosreport] fix use of -o and -n without --profile

Break the logic of the combined 'onlyplugins' and profile check
out to make it more readable and fix a bug that caused all default
plugins to be enabled when running '-o someplug'.

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
[systemd,logs] move journalctl logs to logs plugin

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
[logs] improve log collection for journald-only configurations

If no syslog exists collect the last three days worth of
journald logs by default and allow the user to specify a "log_days"
option to control the data collected.

Fixes #325.

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
[logs] make journalctl log collection honour all_logs

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
Try to ensure FQDN of host is collected

Not all systems are required to have the generic hostname command return
the FQDN. We have encountered customers who require the a short name by
default. Adding the "-f" output helps to get that information.

Signed-off-by: Peter Portante <peter.portante@redhat.com>
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
[multipath] fix add_cmd_output usage

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
[utilities,plugin] check for return status 126

A return status of 126 indicates 'found but not executable'. This
is returned from timeout for some malformed commands when running
as a normal user but not when running as root, e.g.:

  Running 1/1: multipath...
[plugin:multipath] collecting path '/etc/multipath/'
[plugin:multipath] unpacked command tuple: ('['multipath -l', 'multipath -v4 -ll']', 'None', 'None', 300, 'None')
[plugin:multipath] collecting output of '['multipath -l', 'multipath -v4 -ll']'
Traceback (most recent call last):
  File "/usr/sbin/sosreport", line 25, in <module>
    main(sys.argv[1:])
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1389, in main
    sos.execute()
AttributeError: 'list' object has no attribute 'split'

> /usr/lib/python2.7/site-packages/sos/plugins/__init__.py(563)get_cmd_output_now()
-> % (exe.split()[0], time() - start))
(Pdb) bt
  /usr/sbin/sosreport(25)<module>()
-> main(sys.argv[1:])
  /usr/lib/python2.7/site-packages/sos/sosreport.py(1389)main()
-> sos.execute()
  /usr/lib/python2.7/site-packages/sos/sosreport.py(1369)execute()
-> self.collect()
  /usr/lib/python2.7/site-packages/sos/sosreport.py(1144)collect()
-> plug.collect()
  /usr/lib/python2.7/site-packages/sos/plugins/__init__.py(633)collect()
-> self._collect_cmd_output()
  /usr/lib/python2.7/site-packages/sos/plugins/__init__.py(613)_collect_cmd_output()
-> timeout=timeout, runat=runat)
> /usr/lib/python2.7/site-packages/sos/plugins/__init__.py(563)get_cmd_output_now()
-> % (exe.split()[0], time() - start))
(Pdb) result
{'status': 126, 'output': u"timeout: failed to run command '[multipath -l,': Permission denied\n"}

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
[sosreport] profile listing improvements

Add a listing of available profiles at the end of --list-plugins
output and add plugin and profile counts to the output of both
--list-plugins and --list-profiles.

Also factor out some common code for formatting commas-separated
multi-line lists.

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
[gluster] remove unnecessary default_enabled()

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
[satellite] make plugin default enabled

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
[soundcard] make plugin default enabled

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
[sosreport] fix whitespace errors

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
[sosreport] change description of non-default plugins

Plugins are currently listed as 'not default' if the plugin's
default_enabled() method evaluates to False:

 sendmail             inactive       sendmail service
 snmp                 inactive       Simple network management protocol
 soundcard            not default    Sound devices
 squid                inactive       Squid caching proxy

It sounds odd and it looks ugly in the plugin listing. Change the
description to 'optional':

 sendmail             inactive       sendmail service
 snmp                 inactive       Simple network management protocol
 soundcard            optional       Sound devices
 squid                inactive       Squid caching proxy

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
[numa] new plugin for NUMA information

And define a new 'memory' profile to group related plugins
together.

Fixes #226.

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
[memory,processor] add to the 'memory' profile

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
[teamd] add plugin for network teaming driver

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>