Configure Status URL for Apache Monitoring

Configuring the status module (mod_status) for Apache monitoring

The Apache mod_status module enables users to view detailed performance metrics of the Apache web server. 

You must enable and configure the mod_status correctly in the Apache configuration file to get performance metrics from Apache and view performance data in Site24x7. 

If there is an issue in the configuration, you may get the following errors:
HTTP Error 403: Forbidden: This error typically means that the client doesn't have permission to access the requested resource on the server.
HTTP Error 500:  This generic error message indicates that there was a problem on the server while trying to fulfill a request. It typically suggests that there's an issue with the server's configuration or that a script or application running on the server encountered an error.

Perform the following steps in the Apache configuration file to enable and configure the status module and get performance metrics:
  1. Enable the mod_status.

    1. Depending on your Linux distribution, the Apache configuration file will be located at one of the following locations:
      /etc/apache2/httpd.conf (Ubuntu, Debian, openSUSE)
      /etc/apache2/apache2.conf
      (Ubuntu, Debian, openSUSE)
      /etc/httpd/httpd.conf
      (Red Hat)
      /etc/httpd/conf/httpd.conf
      (CentOS, Fedora)

    2. To open the Apache configuration file, for instance etc/httpd/conf/httpd.conf file applicable for CentOS, open the terminal and run the following command:
      $ sudo vi /etc/httpd/conf/httpd.conf

    3. In the same file, for example the /etc/httpd/conf/httpd.conf file, search for the following line:
      #LoadModule status_module modules/mod_status.so

    4. Uncomment the line mentioned above by removing #:
      LoadModule status_module modules/mod_status.so 

  2. In the same Apache configuration file, configure mod_status.

    1. Search for the following code block:
      # Allow server status reports generated by mod_status,
      # with the URL of http://servername/server-status
      # Change the ".example.com" to match your domain to enable.
      #
      #<location server-status="">
      #    SetHandler server-status
      #    Order deny,allow
      #    Deny from all
      #    Allow from .example.com
      #</location>

    2. Uncomment the location block by removing # in front of its lines, and update the Allow, Order, and Deny directives as shown below:
      <Location /server-status>
      SetHandler server-status
      Order allow,deny
      Deny from all
      Allow from all
      </Location>

    3. To restrict access to authenticated users and to specific IP addresses, add the following configurations:
      <Location /server-status>
      SetHandler server-status
      AuthUserFile /passwordlocation
      AuthType Basic
      AuthName <USER_NAME>
      Require user <USER_NAME>
      </Location>


      The above configuration is for the default Apache configuration. To change the URL at which the dashboard is accessible, you can modify the location tag in the above configuration. By making changes to the /server-status path, you can tailor it to your requirements.

      Note:
      This configuration does not work for virtual hosts. If you have virtual hosts configured, place the location block as shown below inside the VirtualHost block:
      <VirtualHost *:80>
       …
      <Location /server-status>
      SetHandler server-status
      Order allow,deny
      Deny from all
      Allow from example.com
       </Location>

      </VirtualHost>

  3. To apply the changes, restart the Apache server using the below Linux command:
    service apache restart

  4. To verify the accessibility of the apache2 stats page, execute the command below:
    curl -I http://localhost:80/server-status?auto

    HTTP/1.1 200 OK
    Date: Fri, 21 Apr 2023 10:11:01 GMT
    Server: Apache/2.4.52 (Ubuntu)
    Vary: Accept-Encoding
    Content-Length: 3864
    Content-Type: text/html; charset=ISO-8859-1


    You can also manually verify it by entering the below URL in a web browser:
    http://localhost:80/server-status?auto

    Note: The URL will differ based on what you have entered in the Apache configuration.
Inspect the credentials in the plugin .cfg file and ensure you have provided the correct username and password.


    • Related Articles

    • Troubleshoot Error 404, Error 111, and "no host given" error when installing the Apache plugin

      When installing the Apache monitoring plugin, you may encounter the following errors: Error_code : URL Error no host given: The "no host given" error message typically indicates an issue with a URL or request that lacks a hostname. If you encounter ...
    • How to configure the NGINX status page for monitoring NGINX performance

      The NGINX plugin uses the NGINX status page to pull the performance metrics of the NGINX server. You may encounter the following errors while installing the NGINX plugin integration: Error_code : HTTP Error 404: This error usually indicates that the ...
    • Enabling SSL for Apache Monitoring

      Enable SSL support on Apache default virtual host file, found in the following location: For Ubuntu/Debian: sudo vi /etc/apache2/sites-enable/000-default.conf For Centos/Redhat: sudo vi /etc/httpd/conf.d/ssl.conf Edit the virtual host file to support ...
    • Troubleshooting steps when the Network Module does not start properly

      Follow the steps below to fix Network Module-related issues. If the issue is not resolved by the first step, try the subsequent steps until the issue is resolved. Step 1: Stop the On-Premise Poller and restart it with administrator or root ...
    • Prerequisites for VMware VDI Monitoring

      Site24x7 monitors VMware Horizon as a part of VMware virtual desktop infrastructure (VDI) monitoring.  Site24x7 collects VMware VDI metrics using Windows On-Premise Poller via the PowerShell scriptlets available in VMware, known as the VMware ...