Using the Linode Longview App for Apache
Traducciones al EspañolEstamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Longview for Apache is a Longview App. The Longview Apache tab appears in the Linode Cloud Manager when Longview detects that you have Apache installed on your Linode. With the Longview Apache App, you’ll be able to view statistics for Apache on your Linode. It can help you keep track of Apache’s settings, workers and requests, system resource consumption, and other information.
In this Guide:
This guide discusses Linode Longview for Apache. The guide covers the following topics:
- Configuring Linode Longview for Apache.
- Interacting with the Apache data provided by Longview in the Linode Cloud Manager.
- Troubleshooting Linode Longview for Apache.
Before you Begin
In order to use the Longview App for Apache, ensure you have completed the following things:
- A Linode with Apache installed and running.
- Create a Longview client instance using the Cloud Manager.
- Install the Longview Agent on your Linode.
Debian and Ubuntu Automatic Configuration
If Apache is installed and running when you install the Longview client, the Apache App should enable and configure itself automatically.
If you already have Longview installed, and later want to install Apache and enable the Longview App for it, you may find that Apache is not automatically detected on initial setup. When this happens, you can run Longview through its automatic configuration sequence again. In most cases, this will result in Longview finding everything it needs to get the Apache App started. And don’t worry - your old Longview data will stay safe. To run the automatic Longview configuration:
SSH into your Linode whose system you are monitoring with Longview.
Ensure that Apache is running using your distribution’s initialization system.
CentOS, Debian, and Ubuntu
sudo systemctl status apache2 # For distributions with systemd.
Other Distributions
sudo service apache2 status # For distributions without systemd.
Reconfigure the Apache Longview App:
dpkg-reconfigure -phigh linode-longview
For most people, Longview should be able to configure itself automatically, and you will receive output something like this:
[ ok ] Stopping Longview Agent: longview. Checking Apache configuration... Found Apache status page at http://127.0.0.1/server-status?auto (default URL) [ ok ] Starting Longview Agent: longview. update-rc.d: using dependency based boot sequencing
Once you see this successful message, the Longview Apache App should automatically start collecting Apache data. Refresh Longview in the Linode Cloud Manager to start viewing your Apache stats for your Longview Client instance.
If you receive a failure message or the popup shown below, you should visit the Troubleshooting section at the end of this article.
Manual Configuration (All Distributions)
To enable the Apache Longview app manually, follow these steps on your Linode via SSH:
SSH into your Linode whose system you are monitoring with Longview.
Make sure mod_status is enabled for Apache (it should be by default). You can follow the instructions list in the apache.org site. Or, on Debian and Ubuntu systems, run this command:
sudo a2enmod status
Update your Apache configuration file to include the block in the example file below. Depending on your Linux distribution and version, your Apache configuration file may be stored in one of the following locations:
- /etc/apache2/httpd.conf
- /etc/apache2/apache2.conf
- /etc/httpd/httpd.conf
- /etc/httpd/conf/httpd.conf
- File: httpd.conf or apache2.conf
1 2 3 4 5 6 7
<IfModule mod_status.c> ExtendedStatus On <Location /server-status> SetHandler server-status Require local </Location> </IfModule>
Edit
/etc/linode/longview.d/Apache.conf
to look like the following:- File: /etc/linode/longview.d/Apache.conf
1
location http://127.0.0.1/server-status?auto
Restart Apache:
Debian and Ubuntu:
sudo systemctl restart apache2
Other Distributions:
sudo apachectl restart
Restart Longview:
CentOS, Debian, and Ubuntu
sudo systemctl restart longview
Other Distributions
sudo service longview restart
Refresh the Longview in your Linode Cloud Manager.
You should now be able to see Longview data for Apache. If that’s not the case, proceed to the Troubleshooting section at the end of this article.
Viewing Statistics
To see the output for the Longview Apache App:
Log in to the Linode Cloud Manager.
Select the Longview link in the sidebar.
Select the Apache tab.
You’ll see the current version of Apache listed on the upper left hand side of the page.
Mouse over a data point to see the exact numbers for that time. With Longview Pro, you can view older time periods for your data. The next sections cover the Longview Apache App in detail.
Requests
The Requests graph shows the total number of requests Apache handled at the selected time. This is every HTTP and HTTPS request to your Linode.
Throughput
The Throughput graph shows the amount of data that Apache sent and received via web requests at the time selected.
Workers
The Workers graph shows all of the Apache workers at the selected time. The workers are broken down by state:
- Waiting
- Starting
- Reading
- Sending
- Keepalive
- DNS Lookup
- Closing
- Logging
- Finishing
- Cleanup
CPU
The CPU graph shows the percentage of your Linode’s CPU being used by Apache at the selected time. If you want to see the total CPU used instead, check the Overview tab.
Memory
The Memory graph shows the amount of RAM being used by Apache at the selected time. If you want to see your Linode’s total memory use instead, check the Overview tab.
Disk IO
The Disk IO graph shows the amount of input to and output from the disk caused by Apache at the selected time. To see the total IO instead, visit the Disks tab.
Process Count
The Process Count graph shows the total number of processes on your Linode spawned by Apache at the selected time. If you want to see more details, and how this stacks up against the total number of processes on your Linode, see the Processes tab.
Troubleshooting
If you don’t see Longview data for Apache, you’ll instead get an error on the page and instructions on how to fix it. As a general tip, you can check the /var/log/linode/longview.log
file for errors as well. You should also compare your mod_status configuration file to the example shown in Step 2 of the
Manual Configuration (All Distributions) section of this article.
By default Longview uses port 80 for its automatic configuration. In the event you are experiencing problems you may need to edit the /etc/apache2/ports.conf
file to use port 8080 or another non-standard port.
Autoconfigure Mod_Status Popup
If you run the automatic Longview configuration tool, and get the popup message shown below:
This indicates that Longview can’t locate the Apache status page. In turn, this could indicate that either:
The status page is in an unusual and unspecified location.
mod_status
isn’t enabled.An Apache virtual host setting is interfering with requests to the status page.
Apache itself is misconfigured.
If you choose:
<No>: the Longview tool will quit, and you can do a manual configuration. This is the safer option.
<Yes>: the Longview tool will attempt to enable
mod\_status
, set the status page location, and restart Apache. This option is easier, but has the potential to disrupt your current Apache configuration. If you choose yes, and the configuration is successful, you should see output like the following:[ ok ] Stopping Longview Agent: longview. Checking Apache configuration... Enabling module status. To activate the new configuration, you need to run: service apache2 restart [....] Reloading web server config: . ok Apache mod_status enabled [ ok ] Starting Longview Agent: longview. update-rc.d: using dependency based boot sequencing
Refresh the Longview Apache tab in the Linode Manager to verify that it’s working now.
If instead you receive a failure message, such as:
[FAIL] Reloading web server config: apache2 failed!
You will need to double-check your Apache installation, and then do a manual configuration.
Unable to Access Local Server Status for Apache
This error will state Unable to access local server status for Apache at <http://example.com/example?auto>: <error>:
. This error occurs when either:
Apache’s
mod_status
setting is disabled or has been changed from the default location.An Apache virtual host configuration is interfering with web requests to the
mod_status
location.Note
This error occurs when Longview attempts to check the status pagelocation
listed in/etc/linode/longview.d/Apache.conf
, or the default page at127.0.0.1/server-status?auto
, but receives a non-200 HTTP response code. Basically, it means that the status page Longview is expecting is not being returned by the server.
To fix this, follow these steps:
Make sure Apache is running:
Debian and Ubuntu:
sudo systemctl restart apache2
Other Distributions:
sudo apachectl restart
Make sure
mod_status
is enabled. See the Apache website for details. You can also check the output of the following command:apachectl -M
Check the location for
mod_status
. The default location on Debian and Ubuntu systems ishttp://127.0.0.1/server-status?auto
on localhost. In the Apache configuration file, this is designated with the lines:- File: httpd.conf or apache2.conf
1 2
<Location /server-status> SetHandler server-status
The
SetHandler server-status
line indicates that this is the location block for mod_status. The location line itself sets the location.On cPanel/WHM
To direct Longview to the cPanel customized status page, edit the
location
line in/etc/linode/longview.d/Apache.conf
to match the following:- File: /etc/linode/longview.d/Apache.conf
1
location http://localhost/whm-server-status?auto
Longview is designed to check the default location automatically. If you use the default location shown above, you should be done. Refresh the Longview in the Linode Cloud Manager to verify that it’s working now.
If you’re not using the default location, you need to create a new file,
/etc/linode/longview.d/Apache.conf
, and set thelocation
variable to match what you set in the Apache configuration file:- File: /etc/linode/longview.d/Apache.conf
1
location http://127.0.0.1/custom/location/path
Determine if an Apache virtual host configuration is interfering with requests to the
mod_status location. Use a tool like
curlor
wget` to request the server status location:curl http://127.0.0.1/server-status?auto
Observe the output. If the output looks like something other than a simple status page, then you’ll have to fix your Apache virtual host configuration.
Restart Longview:
sudo service longview restart
Refresh the Longview in the Linode Cloud Manager to verify that it’s working now.
The Apache Status Page Doesn’t Look Right
This error will state The Apache status page doesn't look right. Check <http://example.com/example?auto> and investigate any redirects for misconfiguration.
This error occurs when Longview is able to reach the mod_status
page, but doesn’t receive the expected content.
NoteThis error occurs when Longview attempts to check the status page, and receives a 200 HTTP response code, but can’t scrape the expected status content from the page. That is, the page exists on your Linode, but it doesn’t have the right content. If, for example, Longview was to check your website’s home page, you would get this error.
To resolve this issue, follow these steps:
Visit the URL shown in the error. See if it directs or redirects you to a page that isn’t the Apache status page.
Update your Apache and Longview settings so that they specify the same location:
- The <Location > line in your Apache configuration file
- The location line in
/etc/linode/longview.d/Apache.conf
If neither of these is set, the default location of
http://127.0.0.1/server-status?auto
on localhost will be used.Make sure there aren’t any Apache redirects or other settings that are affecting this page.
Restart Longview:
CentOS, Debian, and Ubuntu
sudo systemctl restart longview
Other Distributions
sudo service longview restart
Refresh the Longview in the Linode Cloud Manager to verify that it’s working now.
Missing Graphs: Enable ExtendedStatus
If some of your Apache graphs are missing, you may see the error Enable ExtendedStatus in your Apache configuration for throughput and request graphs.
This indicates that you need to add the following line to your Apache configuration file in the <IfModule mod_status.c>
section:
- File: httpd.conf
1
ExtendedStatus On
When you’ve finished modifying the configuration file, restart Apache:
Debian and Ubuntu:
sudo systemctl restart apache2
Other Distributions:
sudo apachectl restart
Apache Tab is Missing
If the Longview Apache tab is missing entirely, this indicates that Apache is either not installed, or has stopped. If you restart Apache, you will be able to see the tab again and view all of your old data.
More Information
You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.
This page was originally published on