dotlinux blog

How to Monitor Apache Performance using Netdata on CentOS 7

In the world of web hosting, performance is paramount. A slow or unresponsive Apache web server can lead to frustrated users, lost revenue, and a damaged reputation. While Apache is a robust and reliable server, it's not immune to performance bottlenecks. Without proper visibility, you're essentially flying blind, unable to pinpoint the root cause of issues like high latency, traffic spikes, or resource exhaustion.

This is where Netdata shines. Netdata is a powerful, open-source, real-time performance monitoring tool that provides unparalleled visibility into your systems and applications. It's incredibly lightweight, easy to install, and offers a stunning, intuitive web interface that updates in real-time. By integrating Netdata with Apache, you can gain deep insights into your web server's health, from request rates and connection counts to worker status and detailed response codes.

In this comprehensive guide, we will walk you through the entire process of setting up Netdata on a CentOS 7 server and configuring it to monitor Apache's key performance metrics. By the end, you'll have a powerful monitoring dashboard that will help you ensure your web server is running optimally.


2026-05

Table of Contents#

  1. Prerequisites
  2. Step 1: Installing Netdata on CentOS 7
  3. Step 2: Configuring Apache for Status Monitoring
  4. Step 3: Configuring Netdata to Monitor Apache
  5. Step 4: Accessing the Netdata Dashboard
  6. Step 5: Key Apache Metrics to Monitor
  7. Troubleshooting Common Issues
  8. Conclusion
  9. References

Prerequisites#

Before you begin, ensure you have the following:

  • A server running CentOS 7.
  • Root or sudo privileges on the server.
  • Apache HTTP Server installed and running.
    • You can install it with: sudo yum install httpd -y
  • A basic understanding of the Linux command line.
  • Firewall access: Netdata runs on port 19999 by default. Ensure this port is accessible if you want to view the dashboard remotely.

Step 1: Installing Netdata on CentOS 7#

Netdata provides an automatic installation script that handles all dependencies and configurations. It's the recommended method for most users.

  1. Connect to your server via SSH.

  2. Download and run the automatic installation script.

    bash <(curl -Ss https://my-netdata.io/kickstart.sh)

    This script will:

    • Update your system packages.
    • Install necessary dependencies (like gcc, git, etc.).
    • Download the latest Netdata source code.
    • Compile and install it.
    • Install the netdata service so it starts automatically on boot.
  3. Wait for the installation to complete. The process may take a few minutes.

  4. Verify the installation.

    • Check if the Netdata service is running:
      sudo systemctl status netdata
    • You should see an output indicating that the service is active (running).
  5. Configure the Firewall (if firewalld is active). Open port 19999 to allow HTTP traffic to the Netdata dashboard.

    sudo firewall-cmd --permanent --add-port=19999/tcp
    sudo firewall-cmd --reload

At this point, Netdata is installed and running. You can proceed to configure Apache.


Step 2: Configuring Apache for Status Monitoring#

Netdata fetches Apache metrics by querying the Apache server-status page, which must be enabled. This page provides a detailed, machine-readable snapshot of the server's activity.

  1. Enable the status module in Apache.

    sudo vi /etc/httpd/conf.modules.d/00-base.conf

    Ensure the following line is present and not commented out (it usually is by default):

    LoadModule status_module modules/mod_status.so
  2. Configure the server-status location. Create a new configuration file to define the status page location and access controls.

    sudo vi /etc/httpd/conf.d/status.conf
  3. Add the following configuration to the file. Replace your_server_IP with your server's actual IP address or a range (e.g., 192.168.1.0/24). For security, it's best to restrict access to localhost or your trusted network.

    <Location "/server-status">
        SetHandler server-status
        Require ip 127.0.0.1 ::1 your_server_IP
    </Location>
    • SetHandler server-status: Tells Apache to use the status module for this URL.
    • Require ip ...: Restricts access to the specified IP addresses. 127.0.0.1 and ::1 (localhost) are crucial as Netdata will access the page from the local machine.
  4. Enable ExtendedStatus to get more detailed metrics. Edit the main Apache configuration file.

    sudo vi /etc/httpd/conf/httpd.conf

    Search for the term ExtendedStatus and set it to On. If it's commented out, uncomment it.

    ExtendedStatus On
  5. Restart the Apache service to apply the changes.

    sudo systemctl restart httpd
  6. Test the server-status page. From the server itself, run the following command to verify it's working:

    curl http://localhost/server-status?auto

    You should see a plain-text output with metrics like Total Accesses, Total kBytes, CPULoad, ReqPerSec, and a breakdown of worker processes.


Step 3: Configuring Netdata to Monitor Apache#

Now that Apache is exposing its metrics, we need to tell Netdata where to find them.

  1. Navigate to the Netdata configuration directory.

    cd /etc/netdata
  2. Edit the python.d/apache.conf configuration file.

    sudo vi python.d/apache.conf
  3. Configure the Apache job. The file contains a default, disabled configuration. You need to enable it and point it to your server-status URL.

    # /etc/netdata/python.d/apache.conf
     
    local:
      url: 'http://127.0.0.1/server-status?auto'
      # If your server-status page requires authentication, uncomment and fill in:
      # user: 'username'
      # pass: 'password'
    • local: This is the name of the job. You can change it if you wish.
    • url: This is the most important setting. It must point to the URL you tested in the previous step.
  4. Restart the Netdata service to load the new configuration.

    sudo systemctl restart netdata
  5. Check the Netdata logs to ensure the Apache module started correctly.

    sudo tail -f /var/log/netdata/error.log

    Look for any error messages related to apache. A successful line will look something like:

    apache: INFO: job 'local' started data collection
    

Step 4: Accessing the Netdata Dashboard#

With everything configured, it's time to view the metrics.

  1. Open a web browser and navigate to your server's IP address or hostname on port 19999.

    http://your_server_ip:19999
    
  2. You will be greeted by the comprehensive Netdata dashboard.

  3. To find the Apache metrics, scroll down the main page. You should see a section titled "Apache" or "Apache Local" (depending on the job name you used).

  4. Click on the section header to expand it and explore the various charts.


Step 5: Key Apache Metrics to Monitor#

Netdata provides a wealth of information. Here are the most critical Apache metrics to keep an eye on:

  • Requests/s (Requests per Second): The rate of incoming requests. A sudden spike or drop can indicate traffic changes or problems.
  • Connections:
    • Busy Workers: The number of active connections/workers. If this number consistently hits the MaxRequestWorkers limit, your server is overloaded and needs tuning.
    • Idle Workers: The number of available workers waiting for connections. A healthy server should have idle workers.
  • CPU Load: The CPU utilization attributed to Apache. A high load can slow down the entire server.
  • Request Histogram (by response code): A breakdown of HTTP responses (1xx, 2xx, 3xx, 4xx, 5xx). A rise in 4xx (Client Errors) or 5xx (Server Errors) is a clear sign of trouble.
  • Bandwidth: The amount of data being sent and received by the server.

Troubleshooting Common Issues#

  • "Apache charts not showing up in the dashboard":

    1. Check the Netdata error log: sudo tail -f /var/log/netdata/error.log.
    2. Verify the server-status URL is accessible locally: curl http://127.0.0.1/server-status?auto.
    3. Ensure you restarted Netdata after editing the configuration file.
  • "Permission Denied" when accessing server-status: Double-check the Require ip directive in your /etc/httpd/conf.d/status.conf file. Ensure 127.0.0.1 is included.

  • "Module status_module is not loaded": Confirm that the line LoadModule status_module modules/mod_status.so is uncommented in /etc/httpd/conf.modules.d/00-base.conf.


Conclusion#

You have now successfully set up a powerful, real-time monitoring solution for your Apache server on CentOS 7 using Netdata. This setup provides you with immediate, granular insight into your web server's performance, allowing you to proactively identify and resolve issues before they impact your users.

The combination of Netdata's ease of use and the detailed metrics provided by Apache's mod_status creates a perfect synergy for any system administrator. You can further extend Netdata's capabilities by setting up alerts, monitoring other services (like MySQL, Nginx, or system resources), or even creating a distributed monitoring network across multiple servers.


References#

  1. Netdata Official Documentation
  2. Apache Module mod_status Documentation
  3. CentOS 7 Official Website
  4. Apache HTTP Server Documentation