{"id":3673,"date":"2017-12-09T05:21:38","date_gmt":"2017-12-09T05:21:38","guid":{"rendered":"https:\/\/qbytes.cloud\/?p=3673"},"modified":"2017-12-09T05:21:38","modified_gmt":"2017-12-09T05:21:38","slug":"view-apache-statistics-apache-mod_status-module","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2017\/12\/09\/view-apache-statistics-apache-mod_status-module\/","title":{"rendered":"View Apache Statistics with Apache mod_status module"},"content":{"rendered":"<p>The Apache mod_status module is something that can be very useful when troubleshooting high CPU or Memory usage with Apache.<\/p>\n<p>Taken it directly from the Apache documentation:<\/p>\n<p>&#8211; The number of worker serving requests.<br \/>\n&#8211; The number of idle worker.<br \/>\n&#8211; The status of each worker, the number of requests that worker has performed and the total number of bytes served by the worker.<br \/>\n&#8211; A total number of accesses and byte count served.<br \/>\n&#8211; The time the server was started\/restarted and the time it has been running for.<br \/>\n&#8211; Averages giving the number of requests per second, the number of bytes served per second and the average number of bytes per request.<br \/>\n&#8211; The current percentage CPU used by each worker and in total by all workers combined.<br \/>\n&#8211; The current hosts and requests being processed.<\/p>\n<p>Setting it up is simple. <\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# CentOS 6 \/ CentOS 7\n&#x5B;root@web01 ~]# vim \/etc\/httpd\/conf.d\/status.conf\n\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# Ubuntu 12.04\n&#x5B;root@web01 ~]# vim \/etc\/apache2\/conf.d\/status.conf\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# Ubuntu 14.04\n&#x5B;root@web01 ~]# vim \/etc\/apache2\/conf-available\/status.conf\n\n<\/pre>\n<p>Using the correct location for your distro use the following configuration to enable mod_status. Update the AuthUserFile line accordingly for your distro:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n&lt;IfModule mod_status.c&gt;\n#\n# ExtendedStatus controls whether Apache will generate &quot;full&quot; status\n# information (ExtendedStatus On) or just basic information (ExtendedStatus\n# Off) when the &quot;server-status&quot; handler is called. The default is Off.\n#\nExtendedStatus On\n\n# Allow server status reports generated by mod_status,\n# with the URL of http:\/\/servername\/server-status\n# Uncomment and change the &quot;.example.com&quot; to allow\n# access from other hosts.\n#\n&lt;Location \/server-status&gt;\n     SetHandler server-status\n     Order deny,allow\n     Deny from all\n     Allow from localhost ip6-localhost\n     &lt;IfModule mod_rewrite.c&gt;\n          RewriteEngine off\n     &lt;\/IfModule&gt;\n     Allow from 127.0.0.1\n\n# On CentOS \/ RedHat systems, uncomment the following line\n     AuthUserFile \/etc\/httpd\/status-htpasswd\n\n# On Debian \/ Ubuntu systems, uncomment the following line\n#     AuthUserFile \/etc\/apache2\/status-htpasswd\n\n     AuthName &quot;Password protected&quot;\n     AuthType Basic\n     Require valid-user\n\n     # Allow password-less access for allowed IPs\n     Satisfy any\n&lt;\/Location&gt;\n\n&lt;\/IfModule&gt;\n\n<\/pre>\n<p>Once you have the configuration in place, you can secure it with a username and password:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n# CentOS 6 \/ CentOS 7\n&#x5B;root@web01 ~]# htpasswd -c \/etc\/httpd\/status-htpasswd serverinfo\n&#x5B;root@web01 ~]# service httpd restart\n\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n\n\n# Ubuntu 12.04\n&#x5B;root@web01 ~]# htpasswd -c \/etc\/apache2\/status-htpasswd serverinfo\n&#x5B;root@web01 ~]# service apache2 restart\n\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n\n# Ubuntu 14.04\n&#x5B;root@web01 ~]# htpasswd -c \/etc\/apache2\/status-htpasswd serverinfo\n&#x5B;root@web01 ~]# a2enconf status.conf\n&#x5B;root@web01 ~]# service apache2 restart\n\n<\/pre>\n<p>Now go to:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\nhttp:\/\/serverip\/server-status\n\n<\/pre>\n<p>You can have the \/server-status page refresh automatically by using the following in the URL:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\nhttp:\/\/serverip\/server-status?refresh=2\n\n<\/pre>\n<p>It may give you some idea of what client, or what types of requests, are causing the resource contention issues. Usually it is a specific web application misbehaving, or a specific client is attacking a site.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Apache mod_status module is something that can be very useful when troubleshooting high CPU or Memory usage with Apache. Taken it directly from the Apache documentation: &#8211; The number of worker serving requests. &#8211; The number of idle worker. &#8211; The status of each worker, the number of requests that worker has performed and &#8230; <a title=\"View Apache Statistics with Apache mod_status module\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2017\/12\/09\/view-apache-statistics-apache-mod_status-module\/\" aria-label=\"Read more about View Apache Statistics with Apache mod_status module\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-3673","post","type-post","status-publish","format-standard","hentry","category-apache"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/3673","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=3673"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/3673\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=3673"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=3673"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=3673"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}