The agent can parse the Apache mod_status output to show the current requests per second, idle and busy workers. This metric is only available for paid accounts. It also requires some additional configuration of your Apache server.
This article is outdated and will eventually be removed. See v2 agent Apache monitoring
If you do not wish to monitor Apache then leave the default value in the /etc/sd-agent/config.cfg file and the agent will ignore it.
Note: Apache 1.x is not supported.
1) Configuring Apache
mod_status module
You first need to ensure the mod_status module is installed. This is usually compiled in by default but you may need to uncomment a line in your httpd.conf
file:
#LoadModule status_module modules/mod_status.so
Removing the #
will uncomment the line and enable mod_status.
Ubuntu
On packaged Ubuntu Apache installations you can enable the mod_status module by using the a2enmod command:
sudo a2enmod status
2) mod_status configuration
Adding the following line to your httpd.conf
file will enable the mod_status output.
ExtendedStatus On
If you restart Apache after adding this line and get an error, check that mod_status has been installed correctly. Look in your Apache error_log
for details.
You then need to add in the following lines to set up the location from which the status output can be parsed by the agent:
<Location /server-status>
SetHandler server-status
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 PUBLICIP
</Location>
This will allow the status output to be accessed from http://localhost/server-status
(localhost only works on the server itself - replace localhost with your server IP and it will be accessible externally to the IPs you specify in the Allow list, see below).
You should replace PUBLICIP
with your server's public IP address. This means you will have 2 IPs listed (127.0.0.1 and your public IP). This is so the status output can only be accessed from the server itself. If you wish to access it from your browser, you need to add your IP address in (separated by a space). For example
Allow from 127.0.0.1 127.0.0.2 127.0.0.3
You will now need to restart your Apache web server to allow the changes to take effect.
3) Agent configuration
You need to enter the URL into the agent /etc/sd-agent/config.cfg
file for the apache_status_url
option. If your server's IP was 127.0.0.1 then this URL would be http://127.0.0.1/server-status?auto
. Note the ?auto
at the end - this is required.
apache_status_url: http://127.0.0.1/server-status?auto
Password protected URLs
If you have password protected your status URL, as of agent 1.11.4 you can provide the agent with a username and password to log in with. Edit your agent config file to add the following 2 lines, specifying your credentials appropriately:
apache_status_user:
apache_status_pass:
4) Restart agent
Restart the agent to start the monitoring
Problems with server-status not being found
If you get a 404 error or a different page loads when you access the server status, you may have some .htaccess rewrite rules that are preventing Apache from handling the request. You can use this rewrite conditional to ensure requests get processed correctly. This goes above the rewrite rule that is catching the request to server-status
RewriteCond %{REQUEST_URI} !=/server-status
4) Add graphs
Click the name of your server from the Devices list in your Server Density account then go to the Metrics tab. Click the + Graph button on the right then choose the Apache metrics to display the graphs. The metrics will also be available to select when building dashboard graphs.
Comments