Bug 1283681

Summary: add DUMP_MODULES output from httpd
Product: Red Hat Enterprise Linux 7 Reporter: Robert Bost <rbost>
Component: sosAssignee: Pavel Moravec <pmoravec>
Status: CLOSED CURRENTRELEASE QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: agk, bmr, dkutalek, gavin, plambri, rbost, sbradley
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1283682 (view as bug list) Environment:
Last Closed: 2016-11-11 08:14:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Robert Bost 2015-11-19 15:00:23 UTC
Description of problem: Knowing the modules that will be loaded by httpd is a fundamental part of understanding an httpd configuration. 

Expected results:

Have a new "httpd" subdirectory in sosreport's sos_commands (<sosreport>/sos_commands/httpd) and in that directory have DUMP_MODULES output. Here is the command that should be used:

# apachectl -t -D DUMP_MODULES
 OR
# apachectl -M

Comment 2 Pavel Moravec 2015-11-20 10:54:18 UTC
(bouncing rhel7.*.0? flag since 7.2 is out)

Apache httpd  plugin is named apache, see /usr/lib/python2.7/site-packages/sos/plugins/apache.py file on RHEL7.

Per my understanding, apachectl is command working on Ubuntu, while on RHEL/Fedora/CentOS, httpd command should be used instead.

So I suggest a patch like:

--- /usr/lib/python2.7/site-packages/sos/plugins/apache.py.orig	2015-11-20 11:48:52.938198696 +0100
+++ /usr/lib/python2.7/site-packages/sos/plugins/apache.py.new	2015-11-20 11:50:36.707243208 +0100
@@ -48,6 +48,9 @@ class RedHatApache(Apache, RedHatPlugin)
         if self.get_option("log"):
             self.add_copy_spec("/var/log/httpd/*")
 
+        # collect list of installed modules
+        self.add_cmd_output(["httpd -M"])
+
 
 class DebianApache(Apache, DebianPlugin, UbuntuPlugin):
     files = ('/etc/apache2/apache2.conf',)
@@ -65,4 +68,7 @@ class DebianApache(Apache, DebianPlugin,
         if self.get_option("log"):
             self.add_copy_spec("/var/log/apache2/*")
 
+        # collect list of installed modules
+        self.add_cmd_output(["apachectl -M"])
+
 # vim: et ts=4 sw=4

(the debian bits due to compatibility with upstream, wont be executed on RHEL)

With that change, sos_commands/apache/httpd_-M file is generated.

Is that ok?

Comment 3 Bryn M. Reeves 2015-11-20 11:20:49 UTC
> Per my understanding, apachectl is command working on Ubuntu, while on 
> RHEL/Fedora/CentOS, httpd command should be used instead.

Err, both work fine here...

# rpm -q httpd
httpd-2.2.15-30.el6_5.x86_64

# apachectl -M | head -3
Syntax OK
Loaded Modules:
 core_module (static)
 mpm_prefork_module (static)

# rpm -q httpd
httpd-2.4.6-31.el7.x86_64

# apachectl -M | head -3
Loaded Modules:
 core_module (static)
 so_module (static)

The apachectl command is just a front-end to httpd that wraps additional administrative functionality in a simple-to-use interface:

  http://httpd.apache.org/docs/2.0/programs/apachectl.html

Both should be available on all distributions shipping a "normal" Apache httpd package.

We definitely don't want to have identical information in different output paths where we can at all avoid it.

Comment 4 Pavel Moravec 2015-11-20 12:58:44 UTC
Mine outputs are different (typical Satellite6 installation including httpd):

[root@pmoravec-sat61-rhel7 ~]# rpm -q httpd
httpd-2.4.6-31.el7_1.1.x86_64
[root@pmoravec-sat61-rhel7 ~]# apachectl -t -D DUMP_MODULES
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.
[root@pmoravec-sat61-rhel7 ~]# apachectl -M
[root@pmoravec-sat61-rhel7 ~]# httpd -M | head -n3
Loaded Modules:
 core_module (static)
 so_module (static)
[root@pmoravec-sat61-rhel7 ~]#

That's why I raised the concern about httpd instead of apachectl command.

Comment 6 Pavel Moravec 2015-11-20 13:22:59 UTC
OK, mine failures of apachectl were most probably due to a tty issue - filed PR https://github.com/sosreport/sos/pull/692 for this request.

Comment 7 Pavel Moravec 2016-01-18 11:31:36 UTC
Fixed in upstream: 43dd41e4f0872e3a9258cd0a0a9d13e3b76a3e1c

Comment 8 Mike McCune 2016-03-28 23:20:28 UTC
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune with any questions

Comment 9 Pavel Moravec 2016-11-11 08:14:42 UTC
This has been fixed in upstream sos 3.3 we rebased to by [1] in RHEL7.3. Errata [2] should resolve this bug.

Please test [2] and in case it does not address the reported problem properly, reopen this BZ.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1293044
[2] https://rhn.redhat.com/errata/RHBA-2016-2380.html