Apache HTTP server is a very popular open source web server. Because it is fast, easy to use and secure, it is estimated that almost half of the world’s websites are hosted on Apache Servers. Monitoring availability, client-server latency and other performance metrics like request rate, CPU load, etc., is of paramount importance for any production Apache server. There are open source tools to monitor the Apache Servers, but based on our customer feedback, most are difficult to use, eat up lots of systems resources and provide a fragmented view of Apache Server’s health and performance status.
Unlike open source tools, Wavefront by VMware is a SaaS-based metrics monitoring and real-time analytics platform that allows engineers to monitor their applications and web servers. It provides a centralized, comprehensive view of everything in a vertical stack in a public, hybrid or private cloud. In this blog, I will go over how to integrate Apache HTTP Server in Wavefront and monitor its activity and performance.
HTTP servers can be seamlessly integrated to Wavefront using an open-source Telegraf agent. Server metrics are then readily available to be viewed in the built-in dashboard and can be correlated with other metric data. DevOps engineers can create customized charts using the Wavefront query language, which has over 100 analytical functions to mold metrics and make catching anomalies and KPIs extremely easy. Smart, real-time alerts can be set on metrics for any event, anomaly, outage or performance issue with the Apache server. To get started, follow the steps below:
Now, I’ll go through the configuration steps for Apache integration.
Step 1: Enable Status (mod_status) module
In order to send Apache HTTP server metrics to Wavefront, make sure that the Status module (mod_status) is enabled (by default it is enabled). The Status module provides server’s activity and performance information. You can verify if the status_module is enabled by running following commands:
For Debian/Ubuntu-based systems:
# apache2ctl -M | grep status
status_module (shared)
For RedHat/CentOS-based systems:
# httpd -M | grep status
status_module (shared)
Update the configuration file/etc/http/conf/http.conf
(RedHat/CentOS-based systems) or /etc/apache2/apache2.conf
(Debian/Ubuntu-based systems) with the following code:
SetHandler server-status
Order deny,allow
Deny from all
Allow From x.x.x.x
Here x.x.x.x is the IP that is allowed to access the status webpage. You can also specify other IP addresses, hostnames or even users that can access the status page. There are some changes from Apache 2.2 to 2.4 for access control and authorization configuration. If you get a permission denied error when you go to the status page, then check out this link and make sure that the configuration is done correctly.
Perform a graceful restart of the Apache server:
apachectl -k graceful
(for Debian/Ubuntu-based systems)
service httpd graceful
(for RedHat/CentOS-based systems)
Go to the status page http://apache_server_name_or_IP/server-status?auto from the host which has access to the status page and the Apache server metrics should show up as shown in the picture below:
Make sure that ExtendedStatus is set to “on” otherwise some metrics will not be loaded. By default, it is “on” when module “mod_status” is loaded from Apache version 2.3.6. The previous default was always Off. If it is not “on” then just add the “ExtendedStatus on” in httpd.conf/apache2.conf file.
Step 2: Configure Telegraf Apache Input Plugin
Now let’s configure the Telegraf plugin. Open file /etc/telegraf/telegraf.conf locate and uncomment apache input plugin [[inputs.apache]] and add the url(s) of the apache server. For example:
# # Read Apache status information (mod_status)
[[inputs.apache]] # ## An array of Apache status URI to gather stats.
# ## Default is “http://localhost/server-status?auto”
urls = [“http://x.x.x.x/server-status?auto”]
Here x.x.x.x is the IP or hostname which is granted access in … configuration. Or add array of urls:
# # Read Apache status information (mod_status)
[[inputs.apache]] # ## An array of Apache status URI to gather stats.
# ## Default is “http://localhost/server-status?auto”
urls = [“http://localhost/server-status?auto”
“http://localhost:8080/server-status?auto”]
There are some additional properties that can also be defined in the Telegraf input plugin as outlined below:
## Credentials for basic HTTP authentication.
# username = “myuser”
# password = “mypassword”
## Maximum time to receive response.
# response_timeout = “5s”
## Optional SSL Config
# ssl_ca = “/etc/telegraf/ca.pem”
# ssl_cert = “/etc/telegraf/cert.pem”
# ssl_key = “/etc/telegraf/key.pem”
## Use SSL but skip chain & host verification
# insecure_skip_verify = false
Out of of all the above properties, the url(s) are mandatory.
Now, restart the Telegraf agent for configuration changes to take effect with the command below:
service telegraf restart
Once the Telegraf is restarted, the apache http server metrics start flowing to the Wavefront proxy which in turn sends them to Wavefront servers and the metrics are readily available to be viewed in Wavefront UI.
Step 3: Monitoring Apache HTTP Server Metrics in Wavefront
The easiest way to view all Apache server metrics in Wavefront is to go to the integration tab on the top of the Wavefront webpage and then click on the “Metrics” tab as shown below:
All the metrics that are available on the server-status page will show up on this page.
Step 4: Apache HTTP built-in Wavefront Dashboard
The Wavefront HTTP integration delivers a packaged Apache HTTP dashboard in the UI which gets automatically installed once Apache HTTP metrics come into the platform. On your dashboards webpage, search for “Apache HTTP” and the packaged dashboard will show up.
Click on the dashboard and you should see all your Apache servers sending metrics to Wavefront in the “Source” drop-down menu:
The Wavefront Apache Server integration delivers important charts that DevOps, developers, SREs, IT Ops teams can use to monitor health, throughput, worker status and platform load average of the servers. The charts under each of these categories are arranged in sections as shown below:
Dashboard Section | Chart Name | Description |
---|---|---|
Health | Servers Down | Chart shows number of apache servers currently down that were up in last 1 week |
Servers Up | Chart shows number of apache servers currently up | |
Uptime | Chart shows uptime value, port number and server name/IP | |
Throughput | Request Per Second | Chart shows rate of requests per second |
Bytes Per Second | Chart shows rate of Bytes per second | |
CPU Load | Chart shows CPU load | |
Workers Status | % Workers Busy | Chart shows percentage of BusyWorkers out of the total workers (busy + Idle) |
Busy | Chart shows number of busy workers | |
Idle | Chart shows number of idle workers | |
Closing | Chart shows worker scoreboard metrics “Closing”. i.e closing status for the workers | |
Keep-Alive | Chart shows worker scoreboard metrics “keepalive”. i.e closing status for the workers | |
Platform Load Avg | Platform Load Avg | Chart shows apache server’s load over last 1m, 5m and 15min |
I hope this blog is useful to you for getting on top of the performance of Apache HTTP servers and integrating it with Wavefront. There is so much more you can do with Wavefront platform including using metrics-driven analytics to give you visibility across your entire cloud applications stack and maximizing your cloud service availability. Check out Wavefront’s rapidly growing list of integrations and sign up for our free trial to explore the power of real-time analytics and metrics monitoring.